auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<MimeMessage> generateNewInstructorAccountJoinEmail(InstructorAttributes instructor,String shortName, String institute) throws AddressException,MessagingException,UnsupportedEncodingException { MimeMessage messageToUser = getEmptyEmailAddressedToEmail(instructor.email); MimeMessage messageToAdmin = getEmptyEmailAddressedToEmail(Config.SUPPORT_EMAIL); List<MimeMessage> messages = new ArrayList<MimeMessage>(); messages.add(messageToUser); messages.add(messageToAdmin); messageToUser.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT + " " + shortName)); messageToAdmin.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT_COPY + " " + shortName+" "+ "[" + instructor.email + "]")); for(MimeMessage message : messages){ String emailBody = EmailTemplates.NEW_INSTRCUTOR_ACCOUNT_WELCOME; emailBody = emailBody.replace("${UserName}", shortName); String joinUrl = ""; if (instructor != null) { String key; key = StringHelper.encrypt(instructor.key); joinUrl = Config.APP_URL + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN; joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.REGKEY, key); joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.INSTRUCTOR_INSTITUTION, institute); } emailBody = emailBody.replace("${confimationUrl}",joinUrl); System.out.print("*******************************************************\n"); System.out.print(joinUrl); message.setContent(emailBody, "text/html"); } return messages; }

Target:
public List<MimeMessage> generateNewInstructorAccountJoinEmail(InstructorAttributes instructor,String shortName, String institute) throws AddressException,MessagingException,UnsupportedEncodingException { MimeMessage messageToUser = getEmptyEmailAddressedToEmail(instructor.email); MimeMessage messageToAdmin = getEmptyEmailAddressedToEmail(Config.SUPPORT_EMAIL); List<MimeMessage> messages = new ArrayList<MimeMessage>(); messages.add(messageToUser); messages.add(messageToAdmin); messageToUser.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT + " " + shortName)); messageToAdmin.setSubject(String.format(SUBJECT_PREFIX_NEW_INSTRUCTOR_ACCOUNT_COPY + " " + shortName+" "+ "[" + instructor.email + "]")); for(MimeMessage message : messages){ String emailBody = EmailTemplates.NEW_INSTRCUTOR_ACCOUNT_WELCOME; emailBody = emailBody.replace("${userName}", shortName); String joinUrl = ""; if (instructor != null) { String key; key = StringHelper.encrypt(instructor.key); joinUrl = Config.APP_URL + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN; joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.REGKEY, key); joinUrl = Url.addParamToUrl(joinUrl, Const.ParamsNames.INSTRUCTOR_INSTITUTION, institute); } emailBody = emailBody.replace("${joinUrl}",joinUrl); message.setContent(emailBody, "text/html"); } return messages; }
Source:
public void deregisterApplication(ApplicationStatus finalStatus, @Nullable String optionalDiagnostics) { final FinalApplicationStatus yarnStatus = getYarnStatus(finalStatus); log.info("Unregister application from the YARN Resource Manager with final status {}.", yarnStatus); final Optional<URL> historyServerURL = HistoryServerUtils.getHistoryServerURL(flinkConfig); final String appTrackingUrl = historyServerURL.map(URL::toString).orElse(""); try { resourceManagerClient.unregisterApplicationMaster(yarnStatus, optionalDiagnostics, appTrackingUrl); } catch (Throwable t) { log.error("Could not unregister the application master.", t); } Utils.deleteApplicationFiles(configuration.getYarnFiles()); }

Target:
public void deregisterApplication(ApplicationStatus finalStatus, @Nullable String optionalDiagnostics) { final FinalApplicationStatus yarnStatus = getYarnStatus(finalStatus); log.info("Unregister application from the YARN Resource Manager with final status {}.", yarnStatus); final Optional<URL> historyServerURL = HistoryServerUtils.getHistoryServerURL(flinkConfig); final String appTrackingUrl = historyServerURL.map(URL::toString).orElse(""); try { resourceManagerClient.unregisterApplicationMaster(yarnStatus, optionalDiagnostics, appTrackingUrl); } catch (YarnException | IOException e) { log.error("Could not unregister the application master.", e); } Utils.deleteApplicationFiles(configuration.getYarnFiles()); }
Source:
public KeyValue next() throws IOException { if (mReader.next(mKey, mValue)) { MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes()); int mapSize = unpacker.unpackMapHeader(); long offset = 0; long timestamp = 0; byte[] keyBytes = EMPTY_BYTES; for (int i = 0; i < mapSize; i++) { int key = unpacker.unpackInt(); switch (key) { case KAFKA_MESSAGE_OFFSET: offset = unpacker.unpackLong(); break; case KAFKA_MESSAGE_TIMESTAMP: timestamp = unpacker.unpackLong(); break; case KAFKA_HASH_KEY: int keySize = unpacker.unpackBinaryHeader(); keyBytes = new byte[keySize]; unpacker.readPayload(keyBytes); break; } } unpacker.close(); return new KeyValue(offset, keyBytes, Arrays.copyOfRange(mValue.getBytes(), 0, mValue.getLength()), timestamp); } else { return null; } }

Target:
public KeyValue next() throws IOException { if (mReader.next(mKey, mValue)) { MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(mKey.getBytes()); int mapSize = unpacker.unpackMapHeader(); long offset = 0; long timestamp = -1; byte[] keyBytes = EMPTY_BYTES; for (int i = 0; i < mapSize; i++) { int key = unpacker.unpackInt(); switch (key) { case KAFKA_MESSAGE_OFFSET: offset = unpacker.unpackLong(); break; case KAFKA_MESSAGE_TIMESTAMP: timestamp = unpacker.unpackLong(); break; case KAFKA_HASH_KEY: int keySize = unpacker.unpackBinaryHeader(); keyBytes = new byte[keySize]; unpacker.readPayload(keyBytes); break; } } unpacker.close(); return new KeyValue(offset, keyBytes, Arrays.copyOfRange(mValue.getBytes(), 0, mValue.getLength()), timestamp); } else { return null; } }
Source:
public Collection<Privileges> getStorageAuthorities(String path) { return getRoles().stream() .flatMap(r -> r.getAccessModel().getPathPrivileges(path) .stream()) .collect(Collectors.toSet()); }

Target:
public Collection<Privileges> getStorageAuthorities(String path) { return getRoles().stream() .flatMap(r -> r.getAccessModel() .getPathAuthorities(path) .stream()) .collect(Collectors.toSet()); }
Source:
public void import_credentials_provider_extension_credentials() { List<DummyCredentials> dummyCred = CredentialsProvider.lookupCredentials( DummyCredentials.class, j.jenkins, ACL.SYSTEM, Collections.emptyList() ); assertThat(dummyCred, hasSize(1)); assertThat(dummyCred.get(0).getUsername(), equalTo("user1")); List<UsernamePasswordCredentials> ups = CredentialsProvider.lookupCredentials( UsernamePasswordCredentials.class, j.jenkins, ACL.SYSTEM, Collections.singletonList(new HostnameRequirement("api.test.com")) ); Assert.assertThat(ups, hasSize(1)); final UsernamePasswordCredentials up = ups.get(0); Assert.assertThat(up.getPassword().getPlainText(), equalTo("password")); }

Target:
public void import_credentials_provider_extension_credentials() { List<DummyCredentials> dummyCred = CredentialsProvider.lookupCredentials( DummyCredentials.class, j.jenkins, ACL.SYSTEM, Collections.emptyList() ); assertThat(dummyCred, hasSize(1)); assertThat(dummyCred.get(0).getUsername(), equalTo("user1")); List<UsernamePasswordCredentials> ups = CredentialsProvider.lookupCredentials( UsernamePasswordCredentials.class, j.jenkins, ACL.SYSTEM, Collections.singletonList(new HostnameRequirement("api.test.com")) ); assertThat(ups, hasSize(1)); final UsernamePasswordCredentials up = ups.get(0); assertThat(up.getPassword(), hasPlainText("password")); }
Source:
public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new InstanceData( startNew.shiftTimeZone(TimeZone.getDefault()), dueNew.shiftTimeZone(TimeZone.getDefault()), absent(), Instances.INSTANCE_STATUS_NEXT)) )); }

Target:
public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>( new InstanceTable(mAuthority), Instances.TASK_ID, task, new Composite<Instances>( new InstanceTestData( startNew.shiftTimeZone(TimeZone.getDefault()), dueNew.shiftTimeZone(TimeZone.getDefault()), absent(), 0), new CharSequenceRowData<>(Tasks.TZ, "UTC")) ))); }
Source:
private Map<String, String> getHeaderMap(HttpServletRequest request) { Map<String, String> map = new HashMap<String, String>(); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames.hasMoreElements()) { String key = headerNames.nextElement(); Enumeration<String> headerValues = request.getHeaders(key); StringBuilder value = new StringBuilder(headerValues.nextElement()); while (headerValues.hasMoreElements()) { value.append(",").append(headerValues.nextElement()); } map.put(key, value.toString()); } return map; }

Target:
private Map<String, String> getHeaderMap(HttpServletRequest request) { Map<String, String> headers = new HashMap<String, String>(); Enumeration<String> headerNames = request.getHeaderNames(); while (headerNames != null && headerNames.hasMoreElements()) { String key = headerNames.nextElement(); Enumeration<String> headerValues = request.getHeaders(key); StringBuilder value = new StringBuilder(); if (headerValues != null && headerValues.hasMoreElements()) { value.append(headerValues.nextElement()); while (headerValues.hasMoreElements()) { value.append(",").append(headerValues.nextElement()); } } headers.put(key, value.toString()); } return headers; }
Source:
private void handleBlock1Response(final Exchange exchange, final Response response) { BlockOption block1 = response.getOptions().getBlock1(); LOGGER.debug("received response acknowledging block1 {}", block1); final KeyUri key = getKey(exchange, exchange.getRequest()); synchronized (block1Transfers) { Block1BlockwiseStatus status = getBlock1Status(key); if (status == null) { LOGGER.debug("discarding unexpected block1 response: {}", response); } else if (!status.hasMatchingToken(response)) { LOGGER.debug("discarding obsolete block1 response: {}", response); } else if (exchange.getRequest().isCanceled()) { clearBlock1Status(key, status); } else if (response.getCode() == ResponseCode.REQUEST_ENTITY_TOO_LARGE && block1.getSize() < status.getCurrentSize()) { SendBlockAgain(exchange, response, key, status); } else if (!status.isComplete()) { if (block1.isM()) { if (response.getCode() == ResponseCode.CONTINUE) { sendNextBlock(exchange, response, key, status); } else { clearBlock1Status(key, status); exchange.getRequest().setRejected(true); } } else { sendNextBlock(exchange, response, key, status); } } else { clearBlock1Status(key, status); if (response.getOptions().hasBlock2()) { LOGGER.debug("Block1 followed by Block2 transfer"); } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } } } }

Target:
private void handleBlock1Response(final Exchange exchange, final Response response) { BlockOption block1 = response.getOptions().getBlock1(); LOGGER.debug("received response acknowledging block1 {}", block1); final KeyUri key = getKey(exchange, exchange.getRequest()); synchronized (block1Transfers) { Block1BlockwiseStatus status = getBlock1Status(key); if (status == null) { LOGGER.debug("discarding unexpected block1 response: {}", response); } else if (!status.hasMatchingToken(response)) { LOGGER.debug("discarding obsolete block1 response: {}", response); } else if (exchange.getRequest().isCanceled()) { clearBlock1Status(key, status); } else if (!status.isComplete()) { if (block1.isM()) { if (response.getCode() == ResponseCode.CONTINUE) { sendNextBlock(exchange, response, key, status); } else { clearBlock1Status(key, status); exchange.getRequest().setRejected(true); } } else { sendNextBlock(exchange, response, key, status); } } else { clearBlock1Status(key, status); if (response.getOptions().hasBlock2()) { LOGGER.debug("Block1 followed by Block2 transfer"); } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } } } }
Source:
public void testRebaseWithUncommittedMasterChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile(FILE1, "uncommitted modified file1"); git.add().addFilepattern(FILE1).call(); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(result.getStatus(), Status.CONFLICTS); assertEquals(result.getConflicts().size(), 1); assertEquals(result.getConflicts().get(0), FILE1); }

Target:
public void testRebaseWithUncommittedMasterChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile(FILE1, "uncommitted modified file1"); git.add().addFilepattern(FILE1).call(); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(Status.CONFLICTS, result.getStatus()); assertEquals(1, result.getConflicts().size()); assertEquals(FILE1, result.getConflicts().get(0)); }
Source:
public void testAlterTableUnsupportedType() { assertUpdate("CREATE TABLE test_alter_table (c1 bigint, c2 bigint)"); assertQueryFails("ALTER TABLE test_alter_table ADD COLUMN c3 row(bigint)", "Type not supported: row\\(bigint\\)"); }

Target:
public void testAlterTableUnsupportedType() { assertUpdate("CREATE TABLE test_alter_table_unsupported_type (c1 bigint, c2 bigint)"); assertQueryFails("ALTER TABLE test_alter_table_unsupported_type ADD COLUMN c3 row(bigint)", "Type not supported: row\\(bigint\\)"); assertUpdate("DROP TABLE test_alter_table_unsupported_type"); }
Source:
public void setupActions(View layout, T value) { for (ViewAction<T> action : actionList) { View view = layout.findViewById(action.getViewId()); if (view == null) { String message = "Invalid Configuration for " + action.getTriggerType() + " Event. No View with Id " + action.getViewId() + " found in row " + layout.getId(); IllegalStateException exception = new IllegalStateException(message); Log.e(TAG, message, exception); throw exception; } action.prepareView(view, value); } setActionPerformer(layout); }

Target:
public void setupActions(View layout, T value) { for (ViewAction<T> action : viewMap.values()) { View view = layout.findViewById(action.getViewId()); if (view == null) { String message = "Invalid Configuration for " + action.getTriggerType() + " Event. No View with Id " + action.getViewId() + " found in row " + layout.getId(); IllegalStateException exception = new IllegalStateException(message); Log.e(TAG, message, exception); throw exception; } action.prepareView(view, value); setActionPerformer(view, action); } }
Source:
private Void persistAndRunJob(JobGraph jobGraph) throws Exception { jobGraphWriter.putJobGraph(jobGraph); runJob(jobGraph, false); return null; }

Target:
private void persistAndRunJob(JobGraph jobGraph) throws Exception { jobGraphWriter.putJobGraph(jobGraph); runJob(jobGraph, ExecutionType.SUBMISSION); }
Source:
private boolean isVulnerableClassToPrint(String classConstantOperand) { switch(classConstantOperand) { case "java/io/FileNotFoundException": case "java/sql/SQLException": case "java/net/BindException": case "java/util/ConcurrentModificationException": case "javax/naming/InsufficientResourcesException": case "java/util/MissingResourceException": case "java/util/jar/JarException": case "java/security/acl/NotOwnerException": case "java/lang/OutOfMemoryError": case "java/lang/StackOverflowError": return true; default: return false; } }

Target:
private boolean isVulnerableClassToPrint(String classConstantOperand) { switch(classConstantOperand) { case "java/lang/Throwable": case "java/lang/Exception": case "java/lang/Error": case "java/io/FileNotFoundException": case "java/sql/SQLException": case "java/net/BindException": case "java/util/ConcurrentModificationException": case "javax/naming/InsufficientResourcesException": case "java/util/MissingResourceException": case "java/util/jar/JarException": case "java/security/acl/NotOwnerException": case "java/lang/OutOfMemoryError": case "java/lang/StackOverflowError": return true; default: return false; } }
Source:
private DMNShape findShapeByDMNI(org.kie.dmn.model.api.dmndi.DMNDiagram root, String id) { return root.getDMNDiagramElement().stream() .filter(DMNShape.class::isInstance) .map(DMNShape.class::cast) .filter(shape -> shape.getDmnElementRef().getLocalPart().equals(id)) .findFirst().get(); }

Target:
private static DMNShape findShapeByDMNI(org.kie.dmn.model.api.dmndi.DMNDiagram root, String id) { return root.getDMNDiagramElement().stream() .filter(DMNShape.class::isInstance) .map(DMNShape.class::cast) .filter(shape -> shape.getDmnElementRef().getLocalPart().equals(id)) .findFirst() .orElseThrow(() -> new UnsupportedOperationException("There is no DMNShape with id '" + id + "' in DMNDiagram " + root)); }
Source:
public void testLiveErrorVault() throws ClientException { try { Request<Token> request = new Token.CreateRequestBuilder() .card(new Card.Create() .name("Omise Co., Ltd.") .number("4242424242424242") .expiration(10, 2020) .securityCode("123")) .build(); new Client("pkey_test_123", "skey_test_123").sendRequest(request, Token.class); } catch (OmiseException e) { assertEquals("authentication_failure", e.getCode()); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void testLiveErrorVault() throws ClientException { try { Request<Token> request = new Token.CreateRequestBuilder() .card(new Card.Create() .name("Omise Co., Ltd.") .number("4242424242424242") .expiration(10, 2020) .securityCode("123")) .build(); new Client("pkey_test_123", "skey_test_123").sendRequest(request, Token.class); } catch (OmiseException e) { assertEquals("authentication_failure", e.getCode()); } catch (IOException e) { Assert.fail(); } }
Source:
List<T> get(List<String> paths, List<Stat> stats, int options, boolean throwException) throws HelixException; List<T> getChildren(String parentPath, List<Stat> stats, int options); List<T> getChildren(String parentPath, List<Stat> stats, int options, int retryCount, int retryInterval) throws HelixException; List<String> getChildNames(String parentPath, int options); boolean exists(String path, int options); boolean[] exists(List<String> paths, int options); Stat[] getStats(List<String> paths, int options); Stat getStat(String path, int options); void subscribeDataChanges(String path, IZkDataListener listener); void unsubscribeDataChanges(String path, IZkDataListener listener); List<String> subscribeChildChanges(String path, IZkChildListener listener); void unsubscribeChildChanges(String path, IZkChildListener listener); void reset(); default void close() { }

Target:
List<T> get(List<String> paths, List<Stat> stats, int options, boolean throwException) throws HelixException; List<T> getChildren(String parentPath, List<Stat> stats, int options); List<T> getChildren(String parentPath, List<Stat> stats, int options, int retryCount, int retryInterval) throws HelixException; List<String> getChildNames(String parentPath, int options); boolean exists(String path, int options); boolean[] exists(List<String> paths, int options); Stat[] getStats(List<String> paths, int options); Stat getStat(String path, int options); void subscribeDataChanges(String path, IZkDataListener listener); void unsubscribeDataChanges(String path, IZkDataListener listener); List<String> subscribeChildChanges(String path, IZkChildListener listener); void unsubscribeChildChanges(String path, IZkChildListener listener); void reset(); default void close() { System.out.println("Default close() was invoked! No operation was executed."); }
Source:
private void registerCacheEventListener(EventListenerWrapper wrapper) { if(aSyncListenersSet.contains(wrapper) || syncListenersSet.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.listener); } if(wrapper.ordering == EventOrdering.ORDERED) { if (orderedListenerCount.incrementAndGet() == 1) { storeEventSource.setEventOrdering(true); } } if (wrapper.firing == EventFiring.ASYNCHRONOUS) { aSyncListenersSet.add(wrapper); } else { syncListenersSet.add(wrapper); } if (listenersCount.incrementAndGet() == 1) { storeEventSource.addEventListener(eventListener); } }

Target:
private synchronized void registerCacheEventListener(EventListenerWrapper wrapper) { if(aSyncListenersList.contains(wrapper) || syncListenersList.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.getListener()); } if (wrapper.isOrdered() && orderedListenerCount++ == 0) { storeEventSource.setEventOrdering(true); } switch (wrapper.getFiringMode()) { case ASYNCHRONOUS: aSyncListenersList.add(wrapper); break; case SYNCHRONOUS: syncListenersList.add(wrapper); break; default: throw new AssertionError("Unhandled EventFiring value: " + wrapper.getFiringMode()); } if (listenersCount++ == 0) { storeEventSource.addEventListener(eventListener); } }
Source:
public Mono<DetectLanguageResult> detectLanguage(String text) { return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); }

Target:
public Mono<DetectLanguageResult> detectLanguage(String text) { try { return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
private void bumpPromoAnalyticsAndShowPromoDialogIfNecessary() { if (mIsUpdatingStats || mThereWasAnErrorLoadingStats) { return; } if (!StringUtils.isEmpty(AppPrefs.getStatsWidgetsKeys())) { return; } AppPrefs.bumpAnalyticsForStatsWidgetPromo(); if (shouldShouldWidgetPromo()) { AppCompatDialogFragment newFragment = new PromoDialog.Builder( R.drawable.stats_widget_promo_header, R.string.stats_widget_promo_title, R.string.stats_widget_promo_desc, R.string.stats_widget_promo_ok_btn_label) .build(); newFragment.show(getSupportFragmentManager(), "promote_widget_dialog"); } }

Target:
private void bumpPromoAnalyticsAndShowPromoDialogIfNecessary() { if (mIsUpdatingStats || mThereWasAnErrorLoadingStats) { return; } if (!StringUtils.isEmpty(AppPrefs.getStatsWidgetsKeys())) { return; } AppPrefs.bumpAnalyticsForStatsWidgetPromo(); if (shouldShowWidgetPromo()) { AppCompatDialogFragment newFragment = new PromoDialog.Builder( R.drawable.stats_widget_promo_header, R.string.stats_widget_promo_title, R.string.stats_widget_promo_desc, R.string.stats_widget_promo_ok_btn_label) .build(); newFragment.show(getSupportFragmentManager(), "promote_widget_dialog"); } }
Source:
public void testJavadocChild() { final DetailAST commentContentNode = tree.getFirstChild().getNextSibling().getFirstChild(); final ParseTreeTablePModel parseTree = new ParseTreeTablePModel(null); parseTree.setParseMode(ParseMode.JAVA_WITH_JAVADOC_AND_COMMENTS); final Object javadoc = parseTree.getChild(commentContentNode, 0); Assert.assertTrue(javadoc instanceof DetailNode); Assert.assertEquals(JavadocTokenTypes.JAVADOC, ((DetailNode) javadoc).getType()); final Object javadocChild = parseTree.getChild(javadoc, 2); Assert.assertEquals(JavadocTokenTypes.TEXT, ((DetailNode) javadocChild).getType()); }

Target:
public void testJavadocChild() { final DetailAST commentContentNode = tree.getFirstChild().getNextSibling().getFirstChild(); final ParseTreeTablePModel parseTree = new ParseTreeTablePModel(null); parseTree.setParseMode(ParseMode.JAVA_WITH_JAVADOC_AND_COMMENTS); final Object javadoc = parseTree.getChild(commentContentNode, 0); Assert.assertTrue(javadoc instanceof DetailNode); Assert.assertEquals(JavadocTokenTypes.JAVADOC, ((DetailNode) javadoc).getType()); final Object javadocChild = parseTree.getChild(javadoc, 2); Assert.assertTrue(javadocChild instanceof DetailNode); Assert.assertEquals(JavadocTokenTypes.TEXT, ((DetailNode) javadocChild).getType()); }
Source:
public ProfilePreferences defaultValue(ProfilePreferences defaultValue) { String profileStr = System.getProperty("org.kie.workbench.profile", Profile.FULL.name()); Profile defaultProfile = Profile.FULL; try { if(profileStr.startsWith(FORCE_PREFIX)) { profileStr = profileStr.substring(FORCE_PREFIX.length(), profileStr.length()); } defaultProfile = Profile.valueOf(profileStr); } catch(IllegalArgumentException e) { logger.warning("Not able to load profile " + profileStr + ". Loading FULL profile."); } defaultValue.setProfile(defaultProfile); return defaultValue; }

Target:
public ProfilePreferences defaultValue(ProfilePreferences defaultValue) { String profileStr = System.getProperty("org.kie.workbench.profile", Profile.FULL.name()); Profile defaultProfile = Profile.FULL; try { if (profileStr.startsWith(FORCE_PREFIX)) { profileStr = profileStr.substring(FORCE_PREFIX.length()); } defaultProfile = Profile.valueOf(profileStr); } catch(IllegalArgumentException e) { logger.warn("Not able to load profile {}. Loading FULL profile.", profileStr); } defaultValue.setProfile(defaultProfile); return defaultValue; }
Source:
public static PositionedOutputStream wrap(final OutputStream fout) { if (fout instanceof FSDataOutputStream) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((FSDataOutputStream) fout).getPos(); } }; } else if (fout instanceof PositionedOutput) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((PositionedOutput) fout).position(); } }; } else { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { throw new UnsupportedOperationException("Underlying stream does not support position()"); } }; } }

Target:
public static PositionedOutputStream wrap(final OutputStream fout) { Objects.requireNonNull(fout); if (fout instanceof FSDataOutputStream) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((FSDataOutputStream) fout).getPos(); } }; } else if (fout instanceof PositionedOutput) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((PositionedOutput) fout).position(); } }; } else { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { throw new UnsupportedOperationException("Underlying stream does not support position()"); } }; } }
Source:
protected void executeQueryCommand() { List<Disk> allDiskAndSnapshots = diskDao.getAllFromDisksIncludingSnapshots(getUserID(), getParameters().isFiltered()); HashMap<UUID, DiskImage> activeDisks = new HashMap<>(); HashMap<UUID, List<DiskImage>> disksLeftForAggregate = new HashMap<>(); List<Disk> result = new ArrayList<>(); allDiskAndSnapshots.stream() .filter(disk -> { if (disk.isOvfStore()) { result.add(disk); return false; } return true; }) .filter(disk -> { if (disk instanceof LunDisk) { result.add(disk); return false; } return true; }) .map(diskImage -> (DiskImage) diskImage) .forEach(diskImage -> { UUID imageId = diskImage.getId().getUuid(); if (diskImage.getActive()) { activeDisks.put(imageId, diskImage); if (disksLeftForAggregate.containsKey(imageId)) { activeDisks.get(imageId).getSnapshots().addAll(disksLeftForAggregate.get(imageId)); disksLeftForAggregate.remove(imageId); } } else { if (activeDisks.containsKey(imageId)) { activeDisks.get(imageId).getSnapshots().add(diskImage); } else if (disksLeftForAggregate.containsKey(imageId)) { disksLeftForAggregate.get(imageId).add(diskImage); } else { List<DiskImage> newDiskImageList = new ArrayList<>(); newDiskImageList.add(diskImage); disksLeftForAggregate.put(imageId, newDiskImageList); } } }); result.addAll(activeDisks.values().stream().collect(Collectors.toList())); getQueryReturnValue().setReturnValue(result); }

Target:
protected void executeQueryCommand() { List<Disk> allDisksAndSnapshots = diskDao.getAllFromDisksIncludingSnapshots(getUserID(), getParameters().isFiltered()); HashMap<UUID, DiskImage> activeDisks = new HashMap<>(); HashMap<UUID, List<DiskImage>> disksLeftForAggregate = new HashMap<>(); List<Disk> result = new ArrayList<>(); allDisksAndSnapshots.stream() .filter(disk -> { if (disk.isOvfStore()) { result.add(disk); return false; } return true; }) .filter(disk -> { if (disk instanceof LunDisk) { result.add(disk); return false; } return true; }) .map(diskImage -> (DiskImage) diskImage) .forEach(diskImage -> { UUID imageId = diskImage.getId().getUuid(); if (diskImage.getActive()) { activeDisks.put(imageId, diskImage); if (disksLeftForAggregate.containsKey(imageId)) { activeDisks.get(imageId).getSnapshots().addAll(disksLeftForAggregate.get(imageId)); disksLeftForAggregate.remove(imageId); } } else { if (activeDisks.containsKey(imageId)) { activeDisks.get(imageId).getSnapshots().add(diskImage); } else if (disksLeftForAggregate.containsKey(imageId)) { disksLeftForAggregate.get(imageId).add(diskImage); } else { List<DiskImage> newDiskImageList = new ArrayList<>(); newDiskImageList.add(diskImage); disksLeftForAggregate.put(imageId, newDiskImageList); } } }); result.addAll(new ArrayList<>(activeDisks.values())); getQueryReturnValue().setReturnValue(result); }
Source:
public void onResume() { if (mBluetoothAdapter != null && mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) { final BluetoothProfile profile = mBluetoothPan.get(); if (profile == null) { mBluetoothAdapter.getProfileProxy(mContext, mBtProfileServiceListener, BluetoothProfile.PAN); } } if (mAirplaneModeObserver == null) { mAirplaneModeObserver = new SettingObserver(); } if (mTetherReceiver == null) { mTetherReceiver = new TetherBroadcastReceiver(); } mContext.registerReceiver( mTetherReceiver, new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); mContext.getContentResolver() .registerContentObserver(mAirplaneModeObserver.uri, false, mAirplaneModeObserver); }

Target:
public void onResume() { if (mAirplaneModeObserver == null) { mAirplaneModeObserver = new SettingObserver(); } if (mTetherReceiver == null) { mTetherReceiver = new TetherBroadcastReceiver(); } mContext.registerReceiver( mTetherReceiver, new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); mContext.getContentResolver() .registerContentObserver(mAirplaneModeObserver.uri, false, mAirplaneModeObserver); }
Source:
protected void doAccept(HandlerEvent event) { LOGGER.debug("Accepting Database backup event..."); DatabaseBackupRequest request = event.getData(); Selectable result; Long stackId = request.getResourceId(); try { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = stack.getCluster(); InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance(); GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.getGateway() != null); Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN()); ExitCriteriaModel noExitModel = ClusterDeletionBasedExitCriteriaModel.nonCancellableModel(); SaltConfig saltConfig = HandlerMethods.createSaltConfig(request.getBackupLocation(), request.getBackupId(), stack.getCloudPlatform()); hostOrchestrator.backupDatabase(gatewayConfig, gatewayFQDN, stackUtil.collectReachableNodes(stack), saltConfig, noExitModel); result = new DatabaseBackupSuccess(stackId); } catch (Exception e) { LOGGER.info("Database backup event failed", e); result = new DatabaseBackupFailedEvent(stackId, e, DetailedStackStatus.DATABASE_BACKUP_FAILED); } sendEvent(result, event); }

Target:
protected void doAccept(HandlerEvent event) { DatabaseBackupRequest request = event.getData(); Selectable result; Long stackId = request.getResourceId(); LOGGER.debug("Backing up database on stack {}, backup id {}", stackId, request.getBackupId()); try { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = stack.getCluster(); InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance(); GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.hasGateway()); Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN()); ExitCriteriaModel exitModel = ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stackId, cluster.getId()); SaltConfig saltConfig = saltConfigGenerator.createSaltConfig(request.getBackupLocation(), request.getBackupId(), stack.getCloudPlatform()); hostOrchestrator.backupDatabase(gatewayConfig, gatewayFQDN, stackUtil.collectReachableNodes(stack), saltConfig, exitModel); result = new DatabaseBackupSuccess(stackId); } catch (Exception e) { LOGGER.error("Database backup event failed", e); result = new DatabaseBackupFailedEvent(stackId, e, DetailedStackStatus.DATABASE_BACKUP_FAILED); } sendEvent(result, event); }
Source:
private Optional<ConsumedEvent> poll() { Optional<ConsumedEvent> result = Optional.ofNullable(eventsQueue.poll()); if (!result.isPresent()) { eventConsumers.values().forEach(consumer -> consumer.readEvent().ifPresent(eventsQueue::add)); result = Optional.ofNullable(eventsQueue.poll()); } return result; }

Target:
private List<ConsumedEvent> poll() { List<ConsumedEvent> result = null; boolean newCollectionCreated = false; for (final EventConsumer consumer : eventConsumers.values()) { final List<ConsumedEvent> partialResult = consumer.readEvents(); if (null == result) { result = partialResult; } else { if (!newCollectionCreated) { result = new ArrayList<>(result); newCollectionCreated = true; } result.addAll(partialResult); } } return result == null ? Collections.emptyList() : result; }
Source:
public boolean equals(Object o) { if (o instanceof ReassignmentSet) { ReassignmentSet other = (ReassignmentSet) o; return reassignmentsInfo.equals(other.reassignmentsInfo); } return false; }

Target:
public boolean equals(Object o) { if (o instanceof ReassignmentSet) { ReassignmentSet other = (ReassignmentSet) o; return Objects.equals(reassignmentsInfo, other.reassignmentsInfo); } return false; }
Source:
private void loadData() { Session session = new Session(activity, userManager.getActiveUser()); Session.setSharedSession(session); listModel = session.getReviewalClaims(); listModel.addObserver(this); setListAdapter(new ExpenseClaimArrayAdapter(activity, listModel.getItems())); final Context context = activity; session.loadReviewalClaims(new ElasticSearchAPIClient.APICallback<List<ExpenseClaim>>() { @Override public void onSuccess(Response response, final List<ExpenseClaim> model) { activity.runOnUiThread(new Runnable() { @Override public void run() { listModel.replace(model); } }); } @Override public void onFailure(Request request, Response response, IOException e) { activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, R.string.load_fail_error, Toast.LENGTH_LONG).show(); } }); } }); }

Target:
private void loadData() { Session session = Session.getSharedSession(); listModel = session.getReviewalClaims(); listModel.addObserver(this); setListAdapter(new ExpenseClaimArrayAdapter(activity, listModel.getItems())); final Context context = activity; session.loadReviewalClaims(new ElasticSearchAPIClient.APICallback<List<ExpenseClaim>>() { @Override public void onSuccess(Response response, final List<ExpenseClaim> model) { activity.runOnUiThread(new Runnable() { @Override public void run() { listModel.replace(model); } }); } @Override public void onFailure(Request request, Response response, IOException e) { activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, R.string.load_fail_error, Toast.LENGTH_LONG).show(); } }); } }); }
Source:
protected void updateLunDisks() { for (VmDynamic vmDynamic : getPoweringUpVms()) { VmInternalData vmInternalData = getRunningVms().get(vmDynamic.getId()); if (vmInternalData != null) { Map<String, LUNs> lunsMap = vmInternalData.getLunsMap(); List<Disk> vmDisks = getDbFacade().getDiskDao().getAllForVm(vmDynamic.getId(), true); for (Disk disk : vmDisks) { if (disk.getDiskStorageType() != DiskStorageType.LUN) { continue; } LUNs lunFromDB = ((LunDisk) disk).getLun(); LUNs lunFromMap = lunsMap.get(lunFromDB.getId()); if (lunFromMap != null && lunFromMap.getDeviceSize() != 0 && lunFromMap.getDeviceSize() != lunFromDB.getDeviceSize()) { log.infoFormat("Updated LUN device size - ID: {0}, previous size: {1}, new size: {2}.", lunFromDB.getLUN_id(), lunFromDB.getDeviceSize(), lunFromMap.getDeviceSize()); lunFromDB.setDeviceSize(lunFromMap.getDeviceSize()); _vmLunDisksToSave.add(lunFromDB); } } } } }

Target:
protected void updateLunDisks() { for (VmDynamic vmDynamic : getPoweringUpVms()) { VmInternalData vmInternalData = getRunningVms().get(vmDynamic.getId()); if (vmInternalData != null) { Map<String, LUNs> lunsMap = vmInternalData.getLunsMap(); if (lunsMap.isEmpty()) { continue; } List<Disk> vmDisks = getDbFacade().getDiskDao().getAllForVm(vmDynamic.getId(), true); for (Disk disk : vmDisks) { if (disk.getDiskStorageType() != DiskStorageType.LUN) { continue; } LUNs lunFromDB = ((LunDisk) disk).getLun(); LUNs lunFromMap = lunsMap.get(lunFromDB.getId()); if (lunFromMap.getDeviceSize() != 0 && lunFromMap.getDeviceSize() != lunFromDB.getDeviceSize()) { log.infoFormat("Updated LUN device size - ID: {0}, previous size: {1}, new size: {2}.", lunFromDB.getLUN_id(), lunFromDB.getDeviceSize(), lunFromMap.getDeviceSize()); lunFromDB.setDeviceSize(lunFromMap.getDeviceSize()); vmLunDisksToSave.add(lunFromDB); } } } } }
Source:
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(FileTailInboundChannelAdapterFactoryBean.class); if (element.hasAttribute("delay") || element.hasAttribute("end") || element.hasAttribute("reopen")) { if (element.hasAttribute("native-options")) { parserContext.getReaderContext().error( "You cannot have 'native-options' if one or more of " + "'delay', 'end' or 'reopen' is provided", element); } if (element.hasAttribute("task-scheduler")) { parserContext.getReaderContext().error( "You cannot have 'task-scheduler' one or more of " + "'delay', 'end' or 'reopen' is provided", element); } } if (StringUtils.hasText(channelName)) { builder.addPropertyReference("outputChannel", channelName); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "native-options"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-scheduler"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file-delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "end"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reopen"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "phase"); return builder.getBeanDefinition(); }

Target:
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(FileTailInboundChannelAdapterFactoryBean.class); if (StringUtils.hasText(channelName)) { builder.addPropertyReference("outputChannel", channelName); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "native-options"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-scheduler"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file-delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "end"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reopen"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "phase"); return builder.getBeanDefinition(); }
Source:
public static CondaPath build(String path) { Optional<Coordinates> coordinates = parseCoordinates(path); checkNotNull(path); return new CondaPath(path, coordinates); }

Target:
public static CondaPath build(String path) { checkNotNull(path); Optional<Coordinates> coordinates = parseCoordinates(path); return new CondaPath(path, coordinates); }
Source:
private synchronized void handleStartState(String testID) { logger.info("handle start state: " + testID); StartTask startTask = new StartTask(testID); Future future = taskExecutorService.submit(startTask); testTasks.put(testID, future); try { future.get(); if (isTerminated(testID)) { return; } testModelDAO.setTestState(testID, BenchFlowTestState.READY); handleTestState(testID); } catch (InterruptedException | ExecutionException | BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }

Target:
synchronized void handleStartState(String testID) { logger.info("handle start state: " + testID); StartTask startTask = new StartTask(testID); AbortableFutureTask future = (AbortableFutureTask) taskExecutorService.submit(startTask); testTasks.put(testID, future); try { if (getAbortableFutureTask(future).isAborted()) { return; } testModelDAO.setTestState(testID, READY); } catch (InterruptedException | ExecutionException | BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }
Source:
public boolean conflict(LockRequest request) { if (request instanceof TimeChunkLockRequest) { return dataSource.equals(request.getDataSource()) && interval.overlaps(request.getInterval()); } else if (request instanceof SpecificSegmentLockRequest) { if (dataSource.equals(request.getDataSource()) && interval.equals(request.getInterval())) { final SpecificSegmentLockRequest specificSegmentLockRequest = (SpecificSegmentLockRequest) request; return specificSegmentLockRequest.getPartitionId() == partitionId; } else { return dataSource.equals(request.getDataSource()) && interval.overlaps(request.getInterval()); } } else if (request instanceof LockRequestForNewSegment) { return false; } else { throw new ISE("Unknown request type[%s]", request.getClass().getCanonicalName()); } }

Target:
public boolean conflict(LockRequest request) { if (request instanceof LockRequestForNewSegment) { return false; } if (!dataSource.equals(request.getDataSource())) { return false; } if (request instanceof TimeChunkLockRequest) { return interval.overlaps(request.getInterval()); } else if (request instanceof SpecificSegmentLockRequest) { if (interval.equals(request.getInterval())) { final SpecificSegmentLockRequest specificSegmentLockRequest = (SpecificSegmentLockRequest) request; return specificSegmentLockRequest.getPartitionId() == partitionId; } else { return interval.overlaps(request.getInterval()); } } else { throw new ISE("Unknown request type[%s]", request.getClass().getName()); } }
Source:
default Object getIngressTimestamp() { return getBrokerProperty(HDR_INGRESS_TIMESTAMP); }

Target:
default Long getIngressTimestamp() { return (Long) getBrokerProperty(HDR_INGRESS_TIME); }
Source:
public static void main(String[] args) throws Exception { Args searchArgs = new Args(); CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example command: "+ EntityLinking.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } if (searchArgs.hits > 0) EntityLinking.numHits = searchArgs.hits; LOG.info("searching gold data: " + searchArgs.goldData); if (searchArgs.goldData) new EntityLinking(searchArgs.index).searchGoldFile(searchArgs.data); else new EntityLinking(searchArgs.index).searchFile(searchArgs.data); }

Target:
public static void main(String[] args) throws Exception { Args searchArgs = new Args(); CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example command: "+ EntityLinking.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } LOG.info("searching gold data: " + searchArgs.goldData); if (searchArgs.goldData) { new EntityLinking(searchArgs.index).searchGoldFile(searchArgs.data, searchArgs.hits, searchArgs.output); } else { new EntityLinking(searchArgs.index).bruteSearchFile(searchArgs.data, searchArgs.hits, searchArgs.output); } }
Source:
private void createUser(String userId, String password, Role role, String userName, String email) { if (userRepository.findOneByUserId(userId) == null) { User user = new User(); user.setUserId(userId); SecuredUser securedUser = new SecuredUser(user, null); Object salt = saltSource.getSalt(securedUser); user.setPassword(passwordEncoder.encodePassword(password, salt)); user.setRole(role); user.setUserName(userName); user.setEmail(email); Date createdDate = new Date(); user.setCreatedDate(createdDate); user.setLastModifiedDate(createdDate); user.setLastModifiedUser(user); user = userRepository.save(user); fileEntryService.prepare(user); } }

Target:
private void createUser(String userId, String password, Role role, String userName, String email) { if (userRepository.findOneByUserId(userId) == null) { User user = new User(); user.setUserId(userId); SecuredUser securedUser = new SecuredUser(user, null); Object salt = saltSource.getSalt(securedUser); user.setPassword(passwordEncoder.encodePassword(password, salt)); user.setRole(role); user.setUserName(userName); user.setEmail(email); Date now = new Date(); user.setCreatedDate(now); user.setLastModifiedDate(now); user.setCreatedUser(user); user.setLastModifiedUser(user); user = userRepository.save(user); fileEntryService.prepare(user); } }
Source:
protected Object resolveImpl(@Nonnull final Form<?> form, final String name) { if (name.equals("errors")) { return extractErrors(form); } else { final String value = form.field(name).value(); return isFalsy(value) ? false : firstNonNull(value, UNRESOLVED); } }

Target:
private Object resolveImpl(@Nonnull final Form<?> form, final String name) { if (name.equals("errors")) { return extractErrors(form); } else { final String value = form.field(name).value(); return isFalsy(value) ? false : firstNonNull(value, UNRESOLVED); } }