auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void handleConnectionException(ConnectionException connectionException, ConnectionSupplier connectionSupplier) { Optional<String> exceptionConfigName = executionContext.getConfiguration().map(config -> ((ConfigurationInstance) config).getName()); if (isTransactional()) { connectionException.addInfo("wasTransactional", true); } if (isFirstPage) { exceptionConfigName.ifPresent(name -> connectionException.addInfo("operationConfigName", name)); } connectionSupplier.invalidateConnection(); }

Target:
private void handleConnectionException(ConnectionException connectionException, ConnectionSupplier connectionSupplier) { Optional<String> exceptionConfigName = executionContext.getConfiguration().map(config -> ((ConfigurationInstance) config).getName()); if (isPartOfActiveTransaction(config)) { connectionException.addInfo(IS_TRANSACTIONAL, true); } exceptionConfigName.ifPresent(name -> connectionException.addInfo(COMPONENT_CONFIG_NAME, name)); connectionSupplier.invalidateConnection(); }
Source:
private Ref resolve(Ref ref, int depth) throws IOException { if (!ref.isSymbolic()) { return ref; } Ref dst = ref.getTarget(); if (MAX_SYMBOLIC_REF_DEPTH <= depth) { return null; } dst = exactRef(dst.getName()); if (dst == null) { return ref; } dst = resolve(dst, depth + 1); if (dst == null) { return null; } return new VersionedRef(new SymbolicRef(ref.getName(), dst), ref.getUpdateIndex()); }

Target:
private Ref resolve(Ref ref, int depth) throws IOException { if (!ref.isSymbolic()) { return ref; } Ref dst = ref.getTarget(); if (MAX_SYMBOLIC_REF_DEPTH <= depth) { return null; } dst = exactRef(dst.getName()); if (dst == null) { return ref; } dst = resolve(dst, depth + 1); if (dst == null) { return null; } return new SymbolicRef(ref.getName(), dst, ref.getUpdateIndex()); }
Source:
public void offlineDownloadValidEmailTest() throws Exception { when(authService.getUserDetails("test@test.com")) .thenReturn((Map)ImmutableMap.of( "locked", false, "roles", Arrays.asList("ROLE_USER") )); this.mockMvc.perform(get("/occurrences/offline/download*") .param("reasonTypeId", "10") .param("email", "test@test.com")) .andExpect(status().isOk()) .andExpect(content().contentType("application/json;charset=UTF-8")); verify(authService).getUserDetails("test@test.com"); }

Target:
public void offlineDownloadValidEmailTest() throws Exception { when(authService.getUserDetails("test@test.com")) .thenReturn((Map)ImmutableMap.of( "activated", true, "locked", false, "roles", Arrays.asList("ROLE_USER") )); this.mockMvc.perform(get("/occurrences/offline/download*") .param("reasonTypeId", "10") .param("email", "test@test.com")) .andExpect(status().isOk()) .andExpect(content().contentType("application/json;charset=UTF-8")); verify(authService).getUserDetails("test@test.com"); }
Source:
public double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new double[DocIdSetPlanNode.MAX_DOC_PER_CALL]; } byte[][] values = _transformFunction.transformToBytesValuesSV(projectionBlock); Geometry geometry; for (int i = 0; i < projectionBlock.getNumDocs(); i++) { geometry = GeometrySerializer.deserialize(values[i]); _results[i] = GeometryUtils.isGeography(geometry) ? calculateGeographyArea(geometry) : geometry.getArea(); } return _results; }

Target:
public double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new double[DocIdSetPlanNode.MAX_DOC_PER_CALL]; } byte[][] values = _transformFunction.transformToBytesValuesSV(projectionBlock); int numDocs = projectionBlock.getNumDocs(); for (int i = 0; i < numDocs; i++) { Geometry geometry = GeometrySerializer.deserialize(values[i]); _results[i] = GeometryUtils.isGeography(geometry) ? calculateGeographyArea(geometry) : geometry.getArea(); } return _results; }
Source:
public static Result create() { DynamicForm dynamicForm = Application.dynamicForm.bindFromRequest(request()); Record record = createRecordFromParams(dynamicForm.data()); List<ValError> validationErrors = new Validator(Register.instance.registerInfo().keys).validate(record); if (validationErrors.isEmpty()) { try { Register.instance.store().save(record); return redirect("/hash/" + record.getHash()); } catch (DatabaseException e) { dynamicForm.reject(e.getMessage()); return ok(views.html.newEntry.render(Register.instance.registerInfo().keys, dynamicForm)); } } validationErrors.stream().forEach(error -> dynamicForm.reject(error.key, "error.required")); return ok(views.html.newEntry.render(Register.instance.registerInfo().keys, dynamicForm)); }

Target:
public static Result create() { DynamicForm dynamicForm = Application.dynamicForm.bindFromRequest(request()); Record record = createRecordFromParams(dynamicForm.data()); List<ValidationError> validationErrors = new Validator(Register.instance.registerInfo().keys).validate(record); if (validationErrors.isEmpty()) { try { Register.instance.store().save(record); return redirect(controllers.api.routes.Rest.findByHash(record.getHash())); } catch (DatabaseException e) { dynamicForm.reject(e.getMessage()); return ok(views.html.newEntry.render(Register.instance.registerInfo().keys, dynamicForm)); } } validationErrors.stream().forEach(error -> dynamicForm.reject(error.key, "error.required")); return ok(views.html.newEntry.render(Register.instance.registerInfo().keys, dynamicForm)); }
Source:
private void asignChangeOwnerPermissions(Repository git) throws IOException, ConfigInvalidException{ MetaDataUpdate md = new MetaDataUpdate( GitReferenceUpdated.DISABLED, allProjects, git); md.getCommitBuilder().setAuthor(serverUser); md.getCommitBuilder().setCommitter(serverUser); md.setMessage("Assign Change Owner to All-Projects permissions"); ProjectConfig config = ProjectConfig.read(md); AccessSection heads = config.getAccessSection(AccessSection.HEADS, true); grant(config, heads, Permission.ABANDON, changeOwner); grant(config, heads, Permission.EDIT_TOPIC_NAME, true, changeOwner); grant(config, heads, Permission.DELETE_DRAFTS, changeOwner); grant(config, heads, Permission.PUBLISH_DRAFTS, changeOwner); grant(config, heads, Permission.REBASE, changeOwner); grant(config, heads, Permission.REMOVE_REVIEWER, changeOwner); grant(config, heads, Permission.VIEW_DRAFTS, changeOwner); config.commit(md); }

Target:
private void asignChangeOwnerPermissions(Repository git) throws IOException, ConfigInvalidException{ MetaDataUpdate md = new MetaDataUpdate( GitReferenceUpdated.DISABLED, allProjects, git); md.getCommitBuilder().setAuthor(serverUser); md.getCommitBuilder().setCommitter(serverUser); md.setMessage("Assign Change Owner to All-Projects permissions"); ProjectConfig config = ProjectConfig.read(md); AccessSection all = config.getAccessSection(AccessSection.ALL, true); grant(config, all, Permission.ABANDON, changeOwner); grant(config, all, Permission.EDIT_TOPIC_NAME, true, changeOwner); grant(config, all, Permission.DELETE_DRAFTS, changeOwner); grant(config, all, Permission.PUBLISH_DRAFTS, changeOwner); grant(config, all, Permission.REBASE, changeOwner); grant(config, all, Permission.REMOVE_REVIEWER, changeOwner); grant(config, all, Permission.VIEW_DRAFTS, changeOwner); config.commit(md); }
Source:
public static <T, U> PollerFlux<PollResult<T>, U> create( SerializerAdapter serializerAdapter, HttpPipeline pipeline, Type pollResultType, Type finalResultType, Duration defaultPollInterval, Mono<Response<Flux<ByteBuffer>>> lroInitMono) { Objects.requireNonNull(serializerAdapter, "'serializerAdapter' cannot be null."); Objects.requireNonNull(pipeline, "'pipeline' cannot be null."); Objects.requireNonNull(pollResultType, "'pollResultType' cannot be null."); Objects.requireNonNull(finalResultType, "'finalResultType' cannot be null."); Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); Objects.requireNonNull(lroInitMono, "'lroInitMono' cannot be null."); Function<PollingContext<PollResult<T>>, Mono<PollResult<T>>> defaultLroInitOperation = context -> lroInitMono .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue()) .map(contentBytes -> { String content = new String(contentBytes, StandardCharsets.UTF_8); PollingState state = PollingState.create(serializerAdapter, response.getRequest(), response.getStatusCode(), response.getHeaders(), content); state.store(context); T result = deserialize(serializerAdapter, content, pollResultType); return new PollResult<>(result); })); return new PollerFlux<>(defaultPollInterval, defaultLroInitOperation, pollFunction(serializerAdapter, pipeline, pollResultType), cancelFunction(), fetchResultFunction(serializerAdapter, pipeline, finalResultType)); }

Target:
public static <T, U> PollerFlux<PollResult<T>, U> create( SerializerAdapter serializerAdapter, HttpPipeline pipeline, Type pollResultType, Type finalResultType, Duration defaultPollInterval, Mono<Response<Flux<ByteBuffer>>> lroInitMono) { Objects.requireNonNull(serializerAdapter, "'serializerAdapter' cannot be null."); Objects.requireNonNull(pipeline, "'pipeline' cannot be null."); Objects.requireNonNull(pollResultType, "'pollResultType' cannot be null."); Objects.requireNonNull(finalResultType, "'finalResultType' cannot be null."); Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); Objects.requireNonNull(lroInitMono, "'lroInitMono' cannot be null."); Function<PollingContext<PollResult<T>>, Mono<PollResponse<PollResult<T>>>> defaultLroInitOperation = context -> lroInitMono.flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.getValue()) .map(contentBytes -> { String content = new String(contentBytes, StandardCharsets.UTF_8); PollingState state = PollingState.create(serializerAdapter, response.getRequest(), response.getStatusCode(), response.getHeaders(), content); state.store(context); T result = deserialize(serializerAdapter, content, pollResultType); return new PollResponse<>(state.getOperationStatus(), new PollResult<>(result)); })); return PollerFlux.create(defaultPollInterval, defaultLroInitOperation, pollFunction(serializerAdapter, pipeline, pollResultType), cancelFunction(), fetchResultFunction(serializerAdapter, pipeline, finalResultType)); }
Source:
public void tearDown() throws Exception { if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.setTransactionRollbackOnly(); TransactionHelper.commitOrRollbackTransaction(); } Framework.getRuntime().getComponentManager().reset(); Framework.getRuntime().getComponentManager().start(); }

Target:
public void tearDown() throws Exception { if (TransactionHelper.isTransactionActiveOrMarkedRollback()) { TransactionHelper.setTransactionRollbackOnly(); TransactionHelper.commitOrRollbackTransaction(); } }
Source:
public OperationFuture<List<FirewallPolicy>> update( FirewallPolicyFilter firewallPolicyFilter, FirewallPolicyConfig config ) { checkNotNull(firewallPolicyFilter, "Load balancer filter must be not null"); List<FirewallPolicy> firewallPolicyList = findLazy(firewallPolicyFilter) .map(metadata -> FirewallPolicy.refById( metadata.getId(), DataCenter.refById(metadata.getDataCenterId()) )) .collect(toList()); return update(firewallPolicyList, config); }

Target:
public OperationFuture<List<FirewallPolicy>> update( FirewallPolicyFilter firewallPolicyFilter, FirewallPolicyConfig config ) { checkNotNull(firewallPolicyFilter, "Firewall policy filter must be not null"); List<FirewallPolicy> firewallPolicyList = findLazy(firewallPolicyFilter) .map(metadata -> FirewallPolicy.refById( metadata.getId(), DataCenter.refById(metadata.getDataCenterId()) )) .collect(toList()); return update(firewallPolicyList, config); }
Source:
public void callOnRequestPermissionsResultDetectorNoErrorForKotlin() throws Exception { @Language("JAVA") String runtimePerms = getRuntimePermission(); @Language("JAVA") String onNeeds = getOnNeedsPermission(); @Language("JAVA") String onShow = getOnRationaleAnnotation(); @Language("kotlin") String foo = "" + "package permissions.dispatcher;\n" + "@RuntimePermissions\n" + "class Foo : android.app.Activity {\n" + "fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {\n" + "super.onRequestPermissionsResult(requestCode, permissions, grantResults);\n" + "onRequestPermissionsResult(requestCode, grantResults);\n" + "}\n" + "@NeedsPermission(\"Camera\")" + "fun showCamera() {" + "}\n" + "@OnShowRationale(\"Camera\")" + "fun someMethod() {" + "}\n" + "}"; @Language("kotlin") String generatedClass = "" + "package permissions.dispatcher;\n" + "fun Foo.onRequestPermissionsResult(requestCode: Int, grantResults: IntArray) {" + "}"; lint() .files( java("src/permissions/dispatcher/RuntimePermissions.java", runtimePerms), java("src/permissions/dispatcher/NeedsPermission.java", onNeeds), java("src/permissions/dispatcher/OnShowRationale.java", onShow), kt("src/permissions/dispatcher/FooPermissionsDispatcher.kt", generatedClass), kt("src/permissions/dispatcher/Foo.kt", foo)) .issues(CallOnRequestPermissionsResultDetector.ISSUE) .run() .expectClean(); }

Target:
public void callOnRequestPermissionsResultDetectorNoErrorForKotlin() throws Exception { @Language("JAVA") String runtimePerms = getRuntimePermission(); @Language("JAVA") String onNeeds = getOnNeedsPermission(); @Language("JAVA") String onShow = getOnRationaleAnnotation(); @Language("kotlin") String foo = "" + "package permissions.dispatcher\n" + "@RuntimePermissions\n" + "class Foo : android.app.Activity {\n" + "fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {\n" + "super.onRequestPermissionsResult(requestCode, permissions, grantResults)\n" + "onRequestPermissionsResult(requestCode, grantResults)\n" + "}\n" + "@NeedsPermission(\"Camera\")" + "fun showCamera() {" + "}\n" + "@OnShowRationale(\"Camera\")" + "fun someMethod() {" + "}\n" + "}"; @Language("kotlin") String generatedClass = "" + "package permissions.dispatcher\n" + "fun Foo.onRequestPermissionsResult(requestCode: Int, grantResults: IntArray) {" + "}"; lint() .files( java("src/permissions/dispatcher/RuntimePermissions.java", runtimePerms), java("src/permissions/dispatcher/NeedsPermission.java", onNeeds), java("src/permissions/dispatcher/OnShowRationale.java", onShow), kt("src/permissions/dispatcher/FooPermissionsDispatcher.kt", generatedClass), kt("src/permissions/dispatcher/Foo.kt", foo)) .issues(CallOnRequestPermissionsResultDetector.ISSUE) .run() .expectClean(); }
Source:
protected String getShortHelpText(ITmfTrace trace) { return "Analysis module: " + getName() + " for trace " + trace.getName(); }

Target:
protected String getShortHelpText(ITmfTrace trace) { return String.format(Messages.TmfAbstractAnalysisModule_AnalysisForTrace, getName(), trace.getName()); }
Source:
public static void deleteEPerson(UUID uuid) throws SQLException, IOException { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); EPerson ePerson = ePersonService.find(c, uuid); if (ePerson != null) { try { ePersonService.delete(c, ePerson); } catch (AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } } c.complete(); } }

Target:
public static void deleteEPerson(UUID uuid) throws SQLException, IOException { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); EPerson ePerson = ePersonService.find(c, uuid); if (ePerson != null) { try { ePersonService.delete(c, ePerson); } catch (AuthorizeException e) { throw new RuntimeException(e); } } c.complete(); } }
Source:
public void run() throws Exception { if (this.seconds == null) { throw new RuntimeException("Seconds not set"); } final int sec = Integer.parseInt(this.seconds); System.out.println("Sec " + sec); synchronized (this) { try { this.wait(sec * 1000 + 1); } catch (final InterruptedException e) { System.out.println("Interrupted " + this.fail); } } if (this.fail) { if (this.attempts <= 0 || this.currentAttempt <= this.attempts) { throw new Exception("I failed because I had to."); } } }

Target:
public void run() throws Exception { if (this.seconds == null) { throw new RuntimeException("Seconds not set"); } final int sec = Integer.parseInt(this.seconds); System.out.println("Sec " + sec); synchronized (this) { try { if (sec > 0) { this.wait(sec * 1000); } } catch (final InterruptedException e) { System.out.println("Interrupted " + this.fail); } } if (this.fail) { if (this.attempts <= 0 || this.currentAttempt <= this.attempts) { throw new Exception("I failed because I had to."); } } }
Source:
public void onError() { int count = failureCount.incrementAndGet(); if (count >= failureCountThreshold) { if (count == failureCountThreshold) { logger.error("Resource " + resource + " has gone down"); } logger.trace("Adding downtime " + retryBackoffMs + " ms to " + resource); downUntil.set(SystemTime.getInstance().milliseconds() + retryBackoffMs); } }

Target:
public void onError() { int count = failureCount.incrementAndGet(); if (count >= failureCountThreshold) { if (count == failureCountThreshold) { logger.error("Resource " + resource + " has gone down"); } logger.trace("Resource " + resource + " remains in down state at time " + SystemTime.getInstance().milliseconds() + "; Adding downtime of " + retryBackoffMs + " ms"); downUntil.set(SystemTime.getInstance().milliseconds() + retryBackoffMs); } }
Source:
public static Neigh buildFrom(ByteBuffer buf) { if (buf == null) return null; if (buf.remaining() < 12) return null; Neigh neigh = new Neigh(); try { neigh.ndm.family = buf.get(); buf.get(); buf.getShort(); neigh.ndm.ifindex = buf.getInt(); neigh.ndm.state = buf.getShort(); neigh.ndm.flags = buf.get(); neigh.ndm.type = buf.get(); } catch (BufferOverflowException ex) { return null; } NetlinkMessage.scanAttributes(buf, neigh); return neigh; }

Target:
public static Neigh buildFrom(ByteBuffer buf) { if (buf == null) return null; if (buf.remaining() < 12) return null; Neigh neigh = new Neigh(); try { neigh.ndm.family = buf.get(); buf.get(); buf.getShort(); neigh.ndm.ifindex = buf.getInt(); neigh.ndm.state = buf.getShort(); neigh.ndm.flags = buf.get(); neigh.ndm.type = buf.get(); } catch (BufferUnderflowException ex) { return null; } NetlinkMessage.scanAttributes(buf, neigh); return neigh; }
Source:
private MustFightBattle givenFirstStrikeBattleSetup( final boolean attackerDestroyer, final boolean defenderDestroyer, final boolean ww2v2, final boolean defendingSubsSneakAttack) { final MustFightBattle battle = spy(newBattle(WATER)); lenient() .doNothing() .when(battle) .findTargetGroupsAndFire( any(), anyString(), anyBoolean(), any(), any(), anyCollection(), anyCollection(), anyCollection(), anyCollection()); when(gameProperties.get(DEFENDING_SUICIDE_AND_MUNITION_UNITS_DO_NOT_FIRE, false)) .thenReturn(false); when(gameProperties.get(SUB_RETREAT_BEFORE_BATTLE, false)).thenReturn(false); when(gameProperties.get(TRANSPORT_CASUALTIES_RESTRICTED, false)).thenReturn(false); when(gameProperties.get(WW2V2, false)).thenReturn(ww2v2); lenient() .when(gameProperties.get(DEFENDING_SUBS_SNEAK_ATTACK, false)) .thenReturn(defendingSubsSneakAttack); final Unit attackerUnit = attackerDestroyer ? givenUnitDestroyer() : givenAnyUnit(); final Unit defenderUnit = defenderDestroyer ? givenUnitDestroyer() : givenAnyUnit(); battle.setUnits( List.of(defenderUnit, givenUnitFirstStrike()), List.of(attackerUnit, givenUnitFirstStrike()), List.of(), List.of(), defender, List.of()); return battle; }

Target:
private MustFightBattle givenFirstStrikeBattleSetup( final boolean attackerDestroyer, final boolean defenderDestroyer, final boolean ww2v2, final boolean defendingSubsSneakAttack) { final MustFightBattle battle = spy(newBattle(WATER)); when(gameProperties.get(DEFENDING_SUICIDE_AND_MUNITION_UNITS_DO_NOT_FIRE, false)) .thenReturn(false); when(gameProperties.get(SUB_RETREAT_BEFORE_BATTLE, false)).thenReturn(false); when(gameProperties.get(TRANSPORT_CASUALTIES_RESTRICTED, false)).thenReturn(false); when(gameProperties.get(WW2V2, false)).thenReturn(ww2v2); lenient() .when(gameProperties.get(DEFENDING_SUBS_SNEAK_ATTACK, false)) .thenReturn(defendingSubsSneakAttack); final Unit attackerUnit = attackerDestroyer ? givenUnitDestroyer() : givenAnyUnit(); final Unit defenderUnit = defenderDestroyer ? givenUnitDestroyer() : givenAnyUnit(); battle.setUnits( List.of(defenderUnit, givenUnitFirstStrike()), List.of(attackerUnit, givenUnitFirstStrike()), List.of(), List.of(), defender, List.of()); return battle; }
Source:
protected boolean canDoAction() { return super.canDoAction(); }

Target:
protected boolean canDoAction() { DiskProfileValidator validator = new DiskProfileValidator(getParameters().getProfile()); return validate(validator.diskProfileIsSet()) && validate(validator.storageDomainExists()) && validate(validator.qosExistsOrNull()) && validate(validator.diskProfileNameNotUsed()); }
Source:
public void testGetADCValueSuccess() throws Exception { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.when(mockedResponse.getResponse()).thenReturn(new byte[0]); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); HashMap<IOLine, Integer> analogValues = new HashMap<IOLine, Integer>(); analogValues.put(IOLine.DIO0_AD0, 850); IOSample mockedIOSample = Mockito.mock(IOSample.class); Mockito.when(mockedIOSample.hasAnalogValues()).thenReturn(true); Mockito.when(mockedIOSample.getAnalogValues()).thenReturn(analogValues); PowerMockito.whenNew(IOSample.class).withAnyArguments().thenReturn(mockedIOSample); int analogValue = -1; try { analogValue = xbeeDevice.getADCValue(IOLine.DIO0_AD0); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } assertEquals(850, analogValue); }

Target:
public void testGetADCValueSuccess() throws Exception { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.when(mockedResponse.getResponse()).thenReturn(new byte[1]); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); HashMap<IOLine, Integer> analogValues = new HashMap<IOLine, Integer>(); analogValues.put(IOLine.DIO0_AD0, 850); IOSample mockedIOSample = Mockito.mock(IOSample.class); Mockito.when(mockedIOSample.hasAnalogValues()).thenReturn(true); Mockito.when(mockedIOSample.getAnalogValues()).thenReturn(analogValues); PowerMockito.whenNew(IOSample.class).withAnyArguments().thenReturn(mockedIOSample); int analogValue = -1; analogValue = xbeeDevice.getADCValue(IOLine.DIO0_AD0); assertEquals(850, analogValue); }
Source:
public Token retrieveCurrentToken() { Token token = new Token(); if (findAndSetJWT()) { Token userToken = getUserIdentityFromJWT(); if(userToken != null) { token.setUserIdentity(userToken.getUserIdentity()); token.setUserType(userToken.getUserType()); token.setId(userToken.getId()); token.setJwt(getJWT()); } } log.info("retrieveCurrentToken returning {}", token); return token; }

Target:
public Token retrieveCurrentToken() { Token token = new Token(); if (findAndSetJWT()) { Token userToken = getUserIdentityFromJWT(); if(userToken != null) { token.setUserIdentity(userToken.getUserIdentity()); token.setUserType(userToken.getUserType()); token.setJwt(getJWT()); } } log.debug("retrieveCurrentToken returning {}", token); return token; }
Source:
public List<Map<KVariable, K>> match(K k, org.kframework.definition.Rule rule) { return (List<Map<KVariable, K>>) search(k, Optional.of(0), Optional.empty(), rule); }

Target:
public List<? extends Map<? extends KVariable,? extends K>> match(K k, org.kframework.definition.Rule rule) { return search(k, Optional.of(0), Optional.empty(), rule); }
Source:
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, final SyncResult syncResult) { EmailKeyHelper.importContacts(getContext(), new Messenger(new Handler(Looper.getMainLooper(), new Handler.Callback() { @Override public boolean handleMessage(Message msg) { Bundle data = msg.getData(); switch (msg.arg1) { case KeychainIntentServiceHandler.MESSAGE_OKAY: return true; case KeychainIntentServiceHandler.MESSAGE_UPDATE_PROGRESS: if (data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS) && data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS_MAX)) { Log.d("Keychain/ContactSync/DownloadKeys", "Progress: " + data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS) + "/" + data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS_MAX)); return false; } default: Log.d("Keychain/ContactSync/DownloadKeys", "Syncing... " + msg.toString()); return false; } } }))); KeychainApplication.setupAccountAsNeeded(ContactSyncAdapterService.this); ContactHelper.writeKeysToContacts(ContactSyncAdapterService.this); }

Target:
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, final SyncResult syncResult) { EmailKeyHelper.importContacts(getContext(), new Messenger(new Handler(Looper.getMainLooper(), new Handler.Callback() { @Override public boolean handleMessage(Message msg) { Bundle data = msg.getData(); switch (msg.arg1) { case KeychainIntentServiceHandler.MESSAGE_OKAY: return true; case KeychainIntentServiceHandler.MESSAGE_UPDATE_PROGRESS: if (data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS) && data.containsKey(KeychainIntentServiceHandler.DATA_PROGRESS_MAX)) { Log.d(Constants.TAG, "Progress: " + data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS) + "/" + data.getInt(KeychainIntentServiceHandler.DATA_PROGRESS_MAX)); return false; } default: Log.d(Constants.TAG, "Syncing... " + msg.toString()); return false; } } }))); KeychainApplication.setupAccountAsNeeded(ContactSyncAdapterService.this); ContactHelper.writeKeysToContacts(ContactSyncAdapterService.this); }
Source:
public ICPPExecution getConstructorChainExecution() { return getConstructorChainExecution(getDefinition()); }

Target:
public ICPPExecution getConstructorChainExecution() { if(!isConstexpr()) return null; return getConstructorChainExecution(getDefinition()); }
Source:
public HotPlugUnplgNicVDSParameters(Guid vdsId, VM vm, VmNetworkInterface nic, VmDevice vmDevice) { super(vdsId); this.vmId = vm.getId(); this.nic = nic; this.vmDevice = vmDevice; this.clusterVersion = vm.getvds_group_compatibility_version(); }

Target:
public HotPlugUnplgNicVDSParameters(Guid vdsId, VM vm, VmNetworkInterface nic, VmDevice vmDevice) { super(vdsId); this.vm = vm; this.nic = nic; this.vmDevice = vmDevice; }
Source:
public void addTagToImage(String newTag) { select(); new ContextMenu("Add Tag").select(); new LabeledText("New Tag:").setText(newTag); new FinishButton().click(); }

Target:
public void addTagToImage(String newTag) { select(); new ContextMenu("Add Tag").select(); new DefaultShell(""); new LabeledText("New Tag:").setText(newTag); new FinishButton().click(); }
Source:
public static Layer buildLayer(String kerasLayerClass, Map<String,Object> kerasConfig, boolean isOutput) { Layer layer = null; switch (kerasLayerClass) { case "Dense": case "TimeDistributedDense": layer = buildDenseLayer(kerasConfig); break; case "LSTM": layer = buildGravesLstmLayer(kerasConfig); break; case "Convolution2D": layer = buildConvolutionLayer(kerasConfig); break; case "MaxPooling2D": layer = buildSubsamplingLayer(kerasConfig); break; case "Flatten": log.warn("DL4J adds reshaping layers during model compilation"); break; default: throw new IncompatibleKerasConfigurationException("Unsupported keras layer type " + kerasLayerClass); } return layer; }

Target:
public static Layer buildLayer(String kerasLayerClass, Map<String,Object> kerasConfig, boolean isOutput) { Layer layer = null; switch (kerasLayerClass) { case KERAS_LAYER_DENSE: case KERAS_LAYER_TIME_DISTRIBUTED_DENSE: layer = buildDenseLayer(kerasConfig); break; case KERAS_LAYER_LSTM: layer = buildGravesLstmLayer(kerasConfig); break; case KERAS_LAYER_CONVOLUTION_2D: layer = buildConvolutionLayer(kerasConfig); break; case KERAS_LAYER_MAX_POOLING_2D: layer = buildSubsamplingLayer(kerasConfig); break; case KERAS_LAYER_FLATTEN: log.warn("DL4J adds reshaping layers during model compilation: <LINK_0>"); break; default: throw new IncompatibleKerasConfigurationException("Unsupported keras layer type " + kerasLayerClass); } return layer; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Package that = (Package) o; if (!name.equals(that.name)) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Package)) return false; Package that = (Package) o; return name.equals(that.name); }
Source:
public void testEmptyGroup() { try { MessageType t5 = new MessageType("root1", new GroupType(REQUIRED, "g1"), new GroupType(REQUIRED, "g2", new PrimitiveType(OPTIONAL, BINARY, "b"))); } catch (InvalidSchemaException e) { assertEquals("A group type can not be empty. Parquet does not support empty group without leaves. Empty group: g1", e.getMessage()); } }

Target:
public void testEmptyGroup() { try { MessageType t5 = new MessageType("root1", new GroupType(REQUIRED, "g1"), new GroupType(REQUIRED, "g2", new PrimitiveType(OPTIONAL, BINARY, "b"))); fail("should throw InvalidSchemaException when GroupType contains no child"); } catch (InvalidSchemaException e) { assertEquals("A group type can not be empty. Parquet does not support empty group without leaves. Empty group: g1", e.getMessage()); } }
Source:
public void testMagicConversion() { String magicValue0 = KafkaPassthroughRecordMagicConverter.convertMagicToString(RecordBatch.MAGIC_VALUE_V0); Assert.assertEquals(new byte[] { RecordBatch.MAGIC_VALUE_V0 }, KafkaPassthroughRecordMagicConverter.convertMagicStringToByteArray(magicValue0)); String magicValue1 = KafkaPassthroughRecordMagicConverter.convertMagicToString(RecordBatch.MAGIC_VALUE_V1); Assert.assertEquals(new byte[] { RecordBatch.MAGIC_VALUE_V1 }, KafkaPassthroughRecordMagicConverter.convertMagicStringToByteArray(magicValue1)); String magicValue2 = KafkaPassthroughRecordMagicConverter.convertMagicToString(RecordBatch.MAGIC_VALUE_V2); Assert.assertEquals(new byte[] { RecordBatch.MAGIC_VALUE_V2 }, KafkaPassthroughRecordMagicConverter.convertMagicStringToByteArray(magicValue2)); String magicValueCurrent = KafkaPassthroughRecordMagicConverter.convertMagicToString(RecordBatch.CURRENT_MAGIC_VALUE); Assert.assertEquals(new byte[] { RecordBatch.CURRENT_MAGIC_VALUE }, KafkaPassthroughRecordMagicConverter.convertMagicStringToByteArray(magicValueCurrent)); }

Target:
public void testMagicConversion() { byte[] magics = { RecordBatch.MAGIC_VALUE_V0, RecordBatch.MAGIC_VALUE_V1, RecordBatch.MAGIC_VALUE_V2, RecordBatch.CURRENT_MAGIC_VALUE }; for (byte magic : magics) { String magicString = KafkaPassthroughRecordMagicConverter.convertMagicToString(magic); Assert.assertEquals(new byte[] { magic }, KafkaPassthroughRecordMagicConverter.convertMagicStringToByteArray(magicString)); } }
Source:
private String formatString(final long length) { if (length > 1000) { return (long) Math.ceil(length / 1000) + "kb"; } return length + "b"; }

Target:
private String formatString(final long length) { if (length > THOUSAND) { return (long) Math.ceil(length / THOUSAND) + "kb"; } return length + "b"; }
Source:
public String email() throws IOException { final XML body = this.request.fetch().as(XmlResponse.class).xml(); final List<String> lverified = body .xpath("/page/alias/email/text()"); final String verified; if (lverified.isEmpty()) { verified = ""; } else { verified = lverified.get(0); } final List<String> lunverified = body .xpath("/page/alias/newEmail/text()"); final String complete; if (lunverified.isEmpty()) { complete = verified; } else { complete = String.format("%s!%s", verified, lunverified.get(0)); } return complete; }

Target:
public String email() throws IOException { return this.request.fetch() .as(XmlResponse.class) .xml() .xpath("/page/alias/email/text()") .get(0); }
Source:
public void newTsConfig() { Request request = new Request.Builder() .url("http://localhost:" + port + "/new-tsconfig") .post(RequestBody.create(null, "")) .build(); try (Response response = client.newCall(request).execute()) { } catch (IOException e) { LOG.error("Failed to post new-tsconfig", e); } }

Target:
public boolean newTsConfig() { Request request = new Request.Builder() .url(url("new-tsconfig")) .post(RequestBody.create(null, "")) .build(); try (Response response = client.newCall(request).execute()) { String body = response.body().string(); return "OK!".equals(body); } catch (IOException e) { LOG.error("Failed to post new-tsconfig", e); } return false; }
Source:
private <T> Collection<PluginDesc<T>> getPluginDesc( Reflections reflections, Class<T> klass, ClassLoader loader ) throws InstantiationException, IllegalAccessException { Collection<PluginDesc<T>> result = new ArrayList<>(); Set<Class<? extends T>> plugins; try { plugins = reflections.getSubTypesOf(klass); } catch (ReflectionsException e) { log.debug("Reflection scanner could not find any classes for URLs {}", reflections.getConfiguration().getUrls()); return result; } for (Class<? extends T> plugin : plugins) { if (PluginUtils.isConcrete(plugin)) { result.add(new PluginDesc<>(plugin, versionFor(plugin), loader)); } else { log.debug("Skipping as it is not concrete implementation", plugin); } } return result; }

Target:
private <T> Collection<PluginDesc<T>> getPluginDesc( Reflections reflections, Class<T> klass, ClassLoader loader ) throws InstantiationException, IllegalAccessException { Set<Class<? extends T>> plugins; try { plugins = reflections.getSubTypesOf(klass); } catch (ReflectionsException e) { log.debug("Reflections scanner could not find any classes for URLs: " + reflections.getConfiguration().getUrls(), e); return Collections.emptyList(); } Collection<PluginDesc<T>> result = new ArrayList<>(); for (Class<? extends T> plugin : plugins) { if (PluginUtils.isConcrete(plugin)) { result.add(new PluginDesc<>(plugin, versionFor(plugin), loader)); } else { log.debug("Skipping as it is not concrete implementation", plugin); } } return result; }
Source:
public <T> TypeAdapter<T> getFieldAdapter(Field field) { if (fieldAdapterFactories == null || fieldAdapterFactories.isEmpty()) { return null; } for (Annotation fieldAnnotation : field.getAnnotations()) { Class<? extends Annotation> annotationType = fieldAnnotation.annotationType(); if (fieldAdapterFactories.containsKey(annotationType)) { FieldAdapterFactory fieldAdapterFactory = fieldAdapterFactories.get(annotationType); return fieldAdapterFactory.create(fieldAnnotation, field); } } for (Annotation classAnnotation : field.getDeclaringClass().getAnnotations()) { Class<? extends Annotation> annotationType = classAnnotation.annotationType(); if (fieldAdapterFactories.containsKey(annotationType)) { FieldAdapterFactory fieldAdapterFactory = fieldAdapterFactories.get(annotationType); return fieldAdapterFactory.create(classAnnotation, field); } } return null; }

Target:
public <T> TypeAdapter<T> getFieldAdapter(Field field) { if (fieldAdapterFactories == null || fieldAdapterFactories.isEmpty()) { return null; } Class<?> clazz = field.getDeclaringClass(); for (Map.Entry<Class<? extends Annotation>, FieldAdapterFactory> entry : fieldAdapterFactories.entrySet()) { Class<? extends Annotation> annotationType = entry.getKey(); if (field.isAnnotationPresent(annotationType)) { FieldAdapterFactory fieldAdapterFactory = entry.getValue(); return fieldAdapterFactory.create(this, field.getAnnotation(annotationType), field); } if (clazz.isAnnotationPresent(annotationType)) { FieldAdapterFactory fieldAdapterFactory = entry.getValue(); return fieldAdapterFactory.create(this, clazz.getAnnotation(annotationType), field); } } return null; }
Source:
public void probeAndRun(String id) { MigrationStatus status = getStatus(id); if (status == null) { probeAndSetState(id); } var steps = Migration.from(getDescriptor(XP_CONFIG, id), status).getSteps(); if (steps.size() != 1) { throw new IllegalStateException(String.format( "Migration %s must have only one runnable step from state: %s", id, status.getState())); } runStep(id, steps.get(0).getId()); }

Target:
public void probeAndRun(String id) { MigrationStatus status = getStatus(id); if (status == null) { probeAndSetState(id); } var steps = Migration.from(getDescriptor(XP_CONFIG, id), status).getSteps(); if (steps.size() != 1) { throw new IllegalStateException(String.format( "Migration: %s must have only one runnable step from state: %s", id, status.getState())); } runStep(id, steps.get(0).getId()); }
Source:
public void testArraySize() throws Exception { String sqlString = generateThreeElementArrayString((int) MAX_FUNCTION_MEMORY.toBytes() + 1); assertInvalidFunction(sqlString, EXCEEDED_FUNCTION_MEMORY_LIMIT); }

Target:
public void testArraySize() throws Exception { int size = toIntExact(MAX_FUNCTION_MEMORY.toBytes() + 1); assertInvalidFunction( "array_distinct(ARRAY['" + Strings.repeat("x", size) + "', '" + Strings.repeat("y", size) + "', '" + Strings.repeat("z", size) + "'])", EXCEEDED_FUNCTION_MEMORY_LIMIT); }
Source:
private void runAutodefineForOneProvider(Guid providerId, int index) { try (EngineLock lock = acquireLockForProvider(providerId)) { Network externalNetwork = createExternalNetwork(calcExternalNetworkName(index), providerId); AddNetworkStoragePoolParameters storagePoolParameters = new AddNetworkStoragePoolParameters(getNetwork().getStoragePoolId(), externalNetwork); storagePoolParameters.setVnicProfileRequired(false); ActionReturnValue returnValue = runInternalAction(ActionType.AddNetworkOnProvider, storagePoolParameters); if (returnValue.getSucceeded()) { Guid externalNetworkId = returnValue.getActionReturnValue(); networkHelper.attachNetworkToClusters(externalNetworkId, clustersByProvider.get(providerId)); externalNetwork.setId(externalNetworkId); networkHelper.addVnicProfileWithoutFilter(externalNetwork, true); } } catch (Exception e) { log.error("Exception occurred while acquiring lock for provider: {}", providerId.toString()); log.debug("Exception", e); } }

Target:
private void runAutodefineForOneProvider(Guid providerId, int index) { try (EngineLock lock = acquireLockForProvider(providerId)) { Network externalNetwork = createExternalNetwork(calcExternalNetworkName(index), providerId); AddNetworkStoragePoolParameters storagePoolParameters = new AddNetworkStoragePoolParameters(getNetwork().getStoragePoolId(), externalNetwork); storagePoolParameters.setNetworkClusterList(networkHelper.createNetworkClusters(clustersByProvider.get( providerId))); runInternalAction(ActionType.AddNetworkOnProvider, storagePoolParameters); } }
Source:
protected void reject(final Diff diff, boolean rightToLeft) { ReferenceChange referenceChange = (ReferenceChange)diff; DifferenceSource source = referenceChange.getSource(); switch (referenceChange.getKind()) { case ADD: removeFromTarget(referenceChange, rightToLeft); break; case DELETE: addInTarget(referenceChange, rightToLeft); break; case MOVE: moveElement(referenceChange, rightToLeft); break; case CHANGE: EObject container = null; if (source == DifferenceSource.LEFT) { container = referenceChange.getMatch().getLeft(); } else { container = referenceChange.getMatch().getRight(); } if (container != null) { final EObject leftValue = (EObject)safeEGet(container, referenceChange.getReference()); if (leftValue == null) { addInTarget(referenceChange, rightToLeft); } else { resetInTarget(referenceChange, rightToLeft); } } else { addInTarget(referenceChange, rightToLeft); } break; default: break; } }

Target:
protected void reject(final Diff diff, boolean rightToLeft) { ReferenceChange referenceChange = (ReferenceChange)diff; DifferenceSource source = referenceChange.getSource(); switch (referenceChange.getKind()) { case ADD: removeFromTarget(referenceChange, rightToLeft); break; case DELETE: addInTarget(referenceChange, rightToLeft); break; case MOVE: moveElement(referenceChange, rightToLeft); break; case CHANGE: EObject container = null; if (source == DifferenceSource.LEFT) { container = referenceChange.getMatch().getLeft(); } else { container = referenceChange.getMatch().getRight(); } if (container != null) { final EObject leftValue = (EObject)container.eGet(referenceChange.getReference()); if (leftValue == null) { addInTarget(referenceChange, rightToLeft); } else { resetInTarget(referenceChange, rightToLeft); } } else { addInTarget(referenceChange, rightToLeft); } break; default: break; } }
Source:
public String getApplet() { String templateUri = "..?branch={branch-id}&selected_types={selected-types}"; OseeAppletPage pageUtil = new OseeAppletPage(orcsApi.getQueryFactory(null).branchQuery()); ArtifactTypeOptionsRule selectRule = new ArtifactTypeOptionsRule(orcsApi); String toReturn = pageUtil.realizeApplet(resourceRegistry, "publishLowHighReport.html", getClass(), selectRule); toReturn = toReturn.replaceAll(REQ_REPORT__PUBLISH_TEMPLATE_URI_TAG, templateUri); toReturn = toReturn.replaceAll(REQ_REPORT__BRANCH_PARAM_TAG, "{branch-id}"); toReturn = toReturn.replaceAll(REQ_REPORT__SELECTED_TYPES_TAG, "{selected-types}"); return toReturn; }

Target:
public String getApplet() { String templateUri = "..?branch={branch-id}&selected_types={selected-types}"; OseeAppletPage pageUtil = new OseeAppletPage(orcsApi.getQueryFactory(null).branchQuery()); ArtifactTypeOptionsRule selectRule = new ArtifactTypeOptionsRule("artifactTypeSelect", getTypes(), new HashSet<String>()); String toReturn = pageUtil.realizeApplet(resourceRegistry, "publishLowHighReport.html", getClass(), selectRule); toReturn = toReturn.replaceAll(REQ_REPORT__PUBLISH_TEMPLATE_URI_TAG, templateUri); toReturn = toReturn.replaceAll(REQ_REPORT__BRANCH_PARAM_TAG, "{branch-id}"); toReturn = toReturn.replaceAll(REQ_REPORT__SELECTED_TYPES_TAG, "{selected-types}"); return toReturn; }
Source:
public void init( String clientName, Map<String,Value> authToken ) { Collector.InitCollector initCollector = new Collector.InitCollector(); queueMessage( new InitMessage( clientName, authToken ), initCollector ); sync(); this.serverInfo = new InternalServerInfo( socket.address(), initCollector.server() ); }

Target:
public void init( String clientName, Map<String,Value> authToken ) { Collector.InitCollector initCollector = new Collector.InitCollector(); queueMessage( new InitMessage( clientName, authToken ), initCollector ); sync(); this.serverInfo = new InternalServerInfo( socket.address(), initCollector.serverVersion() ); }
Source:
public Set<IType> getType(Call call, ValidationServices services, IValidationResult validationResult, IReadOnlyQueryEnvironment queryEnvironment, List<IType> argTypes) { if (returnTypes == null) { returnTypes = new LinkedHashSet<IType>(); Type returnType = method.getGenericReturnType(); returnTypes.addAll(getIType(queryEnvironment, returnType)); } return returnTypes; }

Target:
public Set<IType> getType(Call call, ValidationServices services, IValidationResult validationResult, IReadOnlyQueryEnvironment queryEnvironment, List<IType> argTypes) { if (knwonEnvironment != queryEnvironment || returnTypes == null) { knwonEnvironment = queryEnvironment; returnTypes = new LinkedHashSet<IType>(); Type returnType = method.getGenericReturnType(); returnTypes.addAll(getIType(queryEnvironment, returnType)); } return returnTypes; }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((version == null) ? 0 : version.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((category == null) ? 0 : category.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(id, name, version, description, category); }
Source:
public ServiceMayNotContinueException(String msg, Throwable cause) { super(msg); initCause(cause); }

Target:
public ServiceMayNotContinueException(String msg, Throwable cause) { super(msg, cause); statusCode = HttpServletResponse.SC_FORBIDDEN; }
Source:
public Mono<Response<Key>> getKey() { return withContext(context -> getKey(context)); }

Target:
public Mono<Key> getKey() { return getKeyWithResponse().flatMap(FluxUtil::toMono); }
Source:
private boolean recoverConnection() throws IOException, InterruptedException { while (!manuallyClosed) { try { RecoveryAwareAMQConnection newConn = this.cf.newConnection(); synchronized(recoveryLock) { if (!manuallyClosed) { this.delegate = newConn; return true; } } try { newConn.close(); } catch (Exception e) { } return false; } catch (Exception e) { Thread.sleep(this.params.getNetworkRecoveryInterval()); this.getExceptionHandler().handleConnectionRecoveryException(this, e); } } return false; }

Target:
private boolean recoverConnection() throws IOException, InterruptedException { while (!manuallyClosed) { try { RecoveryAwareAMQConnection newConn = this.cf.newConnection(); synchronized(recoveryLock) { if (!manuallyClosed) { this.delegate = newConn; return true; } } newConn.abort(); return false; } catch (Exception e) { Thread.sleep(this.params.getNetworkRecoveryInterval()); this.getExceptionHandler().handleConnectionRecoveryException(this, e); } } return false; }
Source:
public GarbageCollectorCycle() { started = finished = candidates = inUse = deleted = errors = 0l; }

Target:
public GarbageCollectorCycle()
Source:
private Item getBasicFilmWithoutBroadcast(ProgData progData) { ImmutableList.Builder<String> uris = ImmutableList.builder(); Optional<String> rtFilmIdentifier = rtFilmIdentifierFor(progData); rtFilmIdentifier.transform(rt -> uris.add(PaHelper.getFilmRtAlias(rt))); uris.add(PaHelper.getAlias(progData.getProgId())); uris.add(PaHelper.getFilmUri(identifierFor(progData))); Map<String, Identified> resolvedContent = contentResolver.findByUris( uris.build() ).asResolvedMap(); Film film = getFilmFromResolvedContent(progData, rtFilmIdentifier, resolvedContent); if (progData.getFilmYear() != null && MoreStrings.containsOnlyAsciiDigits(progData.getFilmYear())) { film.setYear(Integer.parseInt(progData.getFilmYear())); } return film; }

Target:
private Item getBasicFilmWithoutBroadcast(ProgData progData) { ImmutableList.Builder<String> uris = ImmutableList.builder(); Optional<String> rtFilmIdentifier = rtFilmIdentifierFor(progData); Optional<String> legacyFilmUri = rtFilmIdentifier.transform(PaHelper::getLegacyFilmUri); legacyFilmUri.transform(uris::add); uris.add(PaHelper.getAlias(progData.getProgId())); uris.add(PaHelper.getFilmUri(identifierFor(progData))); Map<String, Identified> resolvedContent = contentResolver.findByUris( uris.build() ).asResolvedMap(); Film film = getFilmFromResolvedContent(progData, resolvedContent, legacyFilmUri); if (progData.getFilmYear() != null && MoreStrings.containsOnlyAsciiDigits(progData.getFilmYear())) { film.setYear(Integer.parseInt(progData.getFilmYear())); } return film; }