auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private HashMap<String, String> extractAndReadPluginXmlFromArtifact(PluginArtifact artifact) { FileInputStream fileInputStream = null; ZipInputStream zipInputStream; ZipEntry zipEntry; HashMap<String, String> pluginMap = null; try { fileInputStream = new FileInputStream(artifact.getFile().getCanonicalPath()); zipInputStream = new ZipInputStream(fileInputStream); while ((zipEntry = zipInputStream.getNextEntry()) != null) { if (zipEntry.getName().endsWith("META-INF/maven/plugin.xml")) { pluginMap = readPluginXmlFile(zipInputStream); break; } } } catch (IOException e) { <START> logger.error("*** Error occurred while trying to extract plugin.xml from artifact {}", <END> artifact.getArtifactId(), e); } return pluginMap; }</code><technical_language>drop ***</technical_language>

Target:
private HashMap<String, String> extractAndReadPluginXmlFromArtifact(PluginArtifact artifact) { FileInputStream fileInputStream = null; ZipInputStream zipInputStream; ZipEntry zipEntry; HashMap<String, String> pluginMap = null; try { fileInputStream = new FileInputStream(artifact.getFile().getCanonicalPath()); zipInputStream = new ZipInputStream(fileInputStream); while ((zipEntry = zipInputStream.getNextEntry()) != null) { if (zipEntry.getName().endsWith("META-INF/maven/plugin.xml")) { pluginMap = readPluginXmlFile(zipInputStream); break; } } } catch (IOException e) { logger.error("Error occurred while trying to extract plugin.xml from artifact {}", artifact.getArtifactId(), e); } return pluginMap; }
Source:
<code>private Image getIncomingChangesImage(TaskReview reviewContainer) { <START> if (reviewContainer.getIncoming()) { <END> if (reviewContainer.getSyncState() == SynchronizationState.INCOMING) { return CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING); } else { if (reviewContainer.getSyncState() == SynchronizationState.INCOMING_NEW) { return CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW); } } } return null; }</code><technical_language>I this check is needed</technical_language>

Target:
private Image getIncomingChangesImage(TaskReview reviewContainer) { if (reviewContainer.getSyncState() == SynchronizationState.INCOMING) { return CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING); } else if (reviewContainer.getSyncState() == SynchronizationState.INCOMING_NEW) { return CommonImages.getImage(CommonImages.OVERLAY_SYNC_INCOMMING_NEW); } return CommonImages.getImage(CommonImages.OVERLAY_CLEAR); }
Source:
<code>public boolean isFrozen() { <START> return isFreeze; <END> }</code><technical_language>variable renamed isFrozen well? more grammatically correct :wink:</technical_language>

Target:
public boolean isFrozen() { return isFrozen; }
Source:
<code>public List<? extends Host> getHosts(Collection<? extends StoragePool> pools) { Collection<Long> poolIds = new HashSet<>(); for (StoragePool p : pools) { poolIds.add(p.getId()); <START> } <END> return create() .select(HOST.fields()) .from(HOST) .join(STORAGE_POOL_HOST_MAP) .on(STORAGE_POOL_HOST_MAP.HOST_ID.eq(HOST.ID)) .where(STORAGE_POOL_HOST_MAP.REMOVED.isNull() .and(STORAGE_POOL_HOST_MAP.STORAGE_POOL_ID.in(poolIds))) .fetchInto(HostRecord.class); }</code><technical_language>Minor: return right pools/poolIds is empty</technical_language>

Target:
public List<? extends Host> getHosts(Collection<? extends StoragePool> pools) { if (pools == null || pools.isEmpty()) { return new ArrayList<>(); } Collection<Long> poolIds = new HashSet<>(); for (StoragePool p : pools) { poolIds.add(p.getId()); } return create() .select(HOST.fields()) .from(HOST) .join(STORAGE_POOL_HOST_MAP) .on(STORAGE_POOL_HOST_MAP.HOST_ID.eq(HOST.ID)) .where(STORAGE_POOL_HOST_MAP.REMOVED.isNull() .and(STORAGE_POOL_HOST_MAP.STORAGE_POOL_ID.in(poolIds))) .fetchInto(HostRecord.class); }
Source:
<code>void synchronizeMailboxSynchronous(final Account account, final String folderName, final MessagingListener listener) { Timber.i("Synchronizing folder %s:%s", account.getDescription(), folderName); if (folderName.equals(account.getOutboxFolderName()) || folderName.equals(account.getErrorFolderName())) { for (MessagingListener l : getListeners(listener)) { l.synchronizeMailboxStarted(account, folderName); l.synchronizeMailboxFinished(account, folderName, 0, 0); } return; } String storeUri = account.getStoreUri(); if (ImapStore.isStoreUriImap(storeUri)) { ImapSyncInteractor syncInteractor = new ImapSyncInteractor(account, folderName, listener, this); <START> syncInteractor.performSync(flagSyncHelper, messageDownloader, notificationController, syncHelper); <END> } else { LegacySyncInteractor syncInteractor = new LegacySyncInteractor(account, folderName, listener, this); syncInteractor.performSync(messageDownloader, notificationController); } }</code><technical_language>pick of parameters passed constructor, method? stuff helper, downloader controller more constructor injected parameters, while folderName listeners sound more suited method parameters me</technical_language>

Target:
void synchronizeMailboxSynchronous(final Account account, final String folderName, final MessagingListener listener) { Timber.i("Synchronizing folder %s:%s", account.getDescription(), folderName); if (folderName.equals(account.getOutboxFolderName()) || folderName.equals(account.getErrorFolderName())) { for (MessagingListener l : getListeners(listener)) { l.synchronizeMailboxStarted(account, folderName); l.synchronizeMailboxFinished(account, folderName, 0, 0); } return; } String storeUri = account.getStoreUri(); if (ImapStore.isStoreUriImap(storeUri)) { ImapSyncInteractor syncInteractor = new ImapSyncInteractor(syncHelper, flagSyncHelper, this, messageDownloader, notificationController); syncInteractor.performSync(account, folderName, listener); } else { LegacySyncInteractor syncInteractor = new LegacySyncInteractor(this, messageDownloader, notificationController); syncInteractor.performSync(account, folderName, listener); } }
Source:
<code>protected List<String> buildRunScriptCommand() { <START> String touchCmd = String.format("touch %s; touch %s; touch %s; touch %s", stdoutPath, stderrPath, exitStatusPath, pidPath); <END> String cmd = String.format("( %s > %s 2> %s < /dev/null ; echo $? > %s ) & disown", scriptPath, stdoutPath, stderrPath, exitStatusPath); MutableList.Builder<String> cmds = MutableList.<String>builder() .add((runAsRoot ? BashCommands.sudo(touchCmd) : touchCmd)) .add((runAsRoot ? BashCommands.sudo(cmd) : cmd)) .add("echo $! > "+pidPath) .add("RESULT=$?"); if (noExtraOutput==null || !noExtraOutput) { cmds.add("echo Executing async "+scriptPath); } cmds.add("exit $RESULT"); return cmds.build(); }</code><technical_language>do touch %s %s %s %s a single command</technical_language>

Target:
protected List<String> buildRunScriptCommand() { String touchCmd = String.format("touch %s %s %s %s", stdoutPath, stderrPath, exitStatusPath, pidPath); String cmd = String.format("( %s > %s 2> %s < /dev/null ; echo $? > %s ) & disown", scriptPath, stdoutPath, stderrPath, exitStatusPath); MutableList.Builder<String> cmds = MutableList.<String>builder() .add(runAsRoot ? BashCommands.sudo(touchCmd) : touchCmd) .add(runAsRoot ? BashCommands.sudo(cmd) : cmd) .add("echo $! > "+pidPath) .add("RESULT=$?"); if (noExtraOutput==null || !noExtraOutput) { cmds.add("echo Executing async "+scriptPath); } cmds.add("exit $RESULT"); return cmds.build(); }
Source:
<code>public static CommitMessageComponentState loadState(Repository repository) { IDialogSettings dialogSettings = getDialogSettings(); String[] values = dialogSettings.getArray(repository.getDirectory() .getAbsolutePath()); if (values == null) { return null; } CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(Boolean.parseBoolean(values[0])); state.setAuthor(values[1]); state.setCommitMessage(values[2]); <START> if (values.length == MEMBER_COUNT) { <END> state.setCaretPosition(Integer.parseInt(values[3])); state.setCommitter(values[4]); state.setHeadCommit(ObjectId.fromString(values[5])); } else if (values.length == MEMBER_COUNT_WITHOUT_CARET_POSITION) { state.setCaretPosition( CommitMessageComponentState.CARET_DEFAULT_POSITION); state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); } else { return null; } return state; }</code><technical_language>This needs improved. If this opens workspace Eclipse older Egit version, get InvalidObjectIdException. Add new caret position end. Egit read state saved new EGit (it'll simply ignore caret position)</technical_language>

Target:
public static CommitMessageComponentState loadState(Repository repository) { IDialogSettings dialogSettings = getDialogSettings(); String[] values = dialogSettings.getArray(repository.getDirectory() .getAbsolutePath()); if (values == null) { return null; } CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(Boolean.parseBoolean(values[0])); state.setAuthor(values[1]); state.setCommitMessage(values[2]); if (values.length == MEMBER_COUNT) { state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); state.setCaretPosition(Integer.parseInt(values[5])); } else if (values.length == MEMBER_COUNT_WITHOUT_CARET_POSITION) { state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); state.setCaretPosition( CommitMessageComponentState.CARET_DEFAULT_POSITION); } else { return null; } return state; }
Source:
<code>public static void initAnalytics(Context context) { <START> if (isAnalyticsActive() == false) { <END> GoogleAnalytics.getInstance(context).setAppOptOut(true); } if (BuildConfig.DEBUG) { GoogleAnalytics.getInstance(context).setDryRun(true); } }</code><technical_language>change !isAnalyticsActive()</technical_language>

Target:
public static void initAnalytics(Context context) { if (!isAnalyticsActive()) { GoogleAnalytics.getInstance(context).setAppOptOut(true); } if (BuildConfig.DEBUG) { GoogleAnalytics.getInstance(context).setDryRun(true); } }
Source:
<code>public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes) { MultiSearchRequest request = new MultiSearchRequest(); Iterator<Class<?>> it = classes.iterator(); for (Query query : queries) { Class<?> clazz = it.next(); <START> request.add(requestFactory.searchRequest(query, clazz, getIndexCoordinatesFor(clazz))); <END> } MultiSearchResponse.Item[] items = getMultiSearchResult(request); List<SearchHits<?>> res = new ArrayList<>(queries.size()); int c = 0; Iterator<Class<?>> it1 = classes.iterator(); for (Query query : queries) { Class entityClass = it1.next(); SearchDocumentResponseCallback<SearchHits<?>> callback = new ReadSearchDocumentResponseCallback<>(entityClass, getIndexCoordinatesFor(entityClass)); SearchResponse response = items[c++].getResponse(); res.add(callback.doWith(SearchDocumentResponse.from(response))); } return res; }</code><technical_language>Nit: sense check queries.size() == classes.size()</technical_language>

Target:
public List<SearchHits<?>> multiSearch(List<? extends Query> queries, List<Class<?>> classes) { Assert.notNull(queries, "queries must not be null"); Assert.notNull(classes, "classes must not be null"); Assert.isTrue(queries.size() == classes.size(), "queries and classes must have the same size"); MultiSearchRequest request = new MultiSearchRequest(); Iterator<Class<?>> it = classes.iterator(); for (Query query : queries) { Class<?> clazz = it.next(); request.add(requestFactory.searchRequest(query, clazz, getIndexCoordinatesFor(clazz))); } MultiSearchResponse.Item[] items = getMultiSearchResult(request); List<SearchHits<?>> res = new ArrayList<>(queries.size()); int c = 0; Iterator<Class<?>> it1 = classes.iterator(); for (Query query : queries) { Class entityClass = it1.next(); SearchDocumentResponseCallback<SearchHits<?>> callback = new ReadSearchDocumentResponseCallback<>(entityClass, getIndexCoordinatesFor(entityClass)); SearchResponse response = items[c++].getResponse(); res.add(callback.doWith(SearchDocumentResponse.from(response))); } return res; }
Source:
<code>public void testDateInterval_FormatDateRange() { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2013); calendar.set(Calendar.MONTH, Calendar.JANUARY); calendar.set(Calendar.DAY_OF_MONTH, 20); long timeInMillis = calendar.getTimeInMillis(); String actual = DateIntervalFormat.formatDateRange(ULocale.getDefault(), TimeZone.getDefault(), timeInMillis, timeInMillis, DateUtils.FORMAT_NUMERIC_DATE); DateFormat format = new SimpleDateFormat("MM/dd/yyyy", ULocale.getDefault()); Date date = null; try { date = format.parse(actual); <START> } catch (ParseException e) { <END> e.printStackTrace(); } assertNotNull(date); }</code><technical_language>test throws Exception</technical_language>

Target:
public void testDateInterval_FormatDateRange() throws ParseException { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, 2013); calendar.set(Calendar.MONTH, Calendar.JANUARY); calendar.set(Calendar.DAY_OF_MONTH, 20); long timeInMillis = calendar.getTimeInMillis(); String actual = DateIntervalFormat.formatDateRange(ULocale.getDefault(), TimeZone.getDefault(), timeInMillis, timeInMillis, DateUtils.FORMAT_NUMERIC_DATE); DateFormat format = new SimpleDateFormat("MM/dd/yyyy", ULocale.getDefault()); Date date = format.parse(actual); assertThat(date).isNotNull(); }
Source:
<code>private static void verifyOutputNames( List<DimensionSpec> dimensions, List<AggregatorFactory> aggregators, List<PostAggregator> postAggregators ) { final Set<String> outputNames = Sets.newHashSet(); for (DimensionSpec dimension : dimensions) { if (!outputNames.add(dimension.getOutputName())) { throw new IAE("Duplicate output name[%s]", dimension.getOutputName()); } } for (AggregatorFactory aggregator : aggregators) { if (!outputNames.add(aggregator.getName())) { throw new IAE("Duplicate output name[%s]", aggregator.getName()); } } for (PostAggregator postAggregator : postAggregators) { if (!outputNames.add(postAggregator.getName())) { throw new IAE("Duplicate output name[%s]", postAggregator.getName()); } } if (outputNames.contains(Column.TIME_COLUMN_NAME)) { <START> throw new IAE("'__time' cannot be used as an output name for dimensions, aggregators, or post-aggregators."); <END> } }</code><technical_language>do %s Column.TIME_COLUMN_NAME trouble of in if check</technical_language>

Target:
private static void verifyOutputNames( List<DimensionSpec> dimensions, List<AggregatorFactory> aggregators, List<PostAggregator> postAggregators ) { final Set<String> outputNames = Sets.newHashSet(); for (DimensionSpec dimension : dimensions) { if (!outputNames.add(dimension.getOutputName())) { throw new IAE("Duplicate output name[%s]", dimension.getOutputName()); } } for (AggregatorFactory aggregator : aggregators) { if (!outputNames.add(aggregator.getName())) { throw new IAE("Duplicate output name[%s]", aggregator.getName()); } } for (PostAggregator postAggregator : postAggregators) { if (!outputNames.add(postAggregator.getName())) { throw new IAE("Duplicate output name[%s]", postAggregator.getName()); } } if (outputNames.contains(Column.TIME_COLUMN_NAME)) { throw new IAE( "'%s' cannot be used as an output name for dimensions, aggregators, or post-aggregators.", Column.TIME_COLUMN_NAME ); } }
Source:
<code>public <X> ExtendedQueryResult<T> orderDesc(SingularAttribute<T, X> attribute, boolean appendEntityName) { lastPaginatedQuery = null; <START> if (!context.getRepositoryMethod().isQuery()) { <END> context.addCriteriaBuilderPostProcessor(new OrderByCriteriaBuilderPostProcessor(attribute, OrderDirection.DESC)); } else { context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC, appendEntityName)); } return this; }</code><technical_language>negative logic</technical_language>

Target:
public <X> ExtendedQueryResult<T> orderDesc(SingularAttribute<T, X> attribute, boolean appendEntityName) { lastPaginatedQuery = null; if (context.getRepositoryMethod().isQuery()) { context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC, appendEntityName)); } else { context.addCriteriaBuilderPostProcessor(new OrderByCriteriaBuilderPostProcessor(attribute, OrderDirection.DESC)); } return this; }
Source:
<code>public void deleteAllLinks() { this.args.forEach(OutputAnchor::removeConnections); this.res.removeConnections(); <START> this.attachedBlocks.forEach(block -> block.moveIntoContainer(this.wrapper.getPane().getTopLevel())); <END> }</code><technical_language>blocks move parent container (or wrapper's parent)</technical_language>

Target:
public void deleteAllLinks() { this.args.forEach(OutputAnchor::removeConnections); this.res.removeConnections(); this.attachedBlocks.forEach(block -> block.moveIntoContainer(this.getParentContainer())); }
Source:
<code>public View onCreateActionView() { View view = <START> View.inflate(fragment.getHostActivity(), R.layout.group_find_in_page, <END> null); findInPageNext = view.findViewById(R.id.find_in_page_next); findInPageNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fragment.hideSoftKeyboard(); if (!pageFragmentValid()) { return; } funnel.addFindNext(); fragment.getWebView().findNext(true); } }); findInPagePrev = view.findViewById(R.id.find_in_page_prev); findInPagePrev.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fragment.hideSoftKeyboard(); if (!pageFragmentValid()) { return; } funnel.addFindPrev(); fragment.getWebView().findNext(false); } }); findInPageMatch = (TextView) view.findViewById(R.id.find_in_page_match); SearchView searchView = (SearchView) view.findViewById(R.id.find_in_page_input); searchView.setQueryHint(fragment.getHostActivity().getString(R.string.menu_page_find_in_page)); searchView.setFocusable(true); searchView.requestFocusFromTouch(); searchView.setOnQueryTextListener(searchQueryListener); searchView.setOnCloseListener(searchCloseListener); searchView.setIconified(false); searchView.setMaxWidth(Integer.MAX_VALUE); searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT); searchView.setSubmitButtonEnabled(false); View searchEditPlate = searchView .findViewById(android.support.v7.appcompat.R.id.search_plate); searchEditPlate.setBackgroundColor(Color.TRANSPARENT); return view; }</code><technical_language>fragment.getContext()</technical_language>

Target:
public View onCreateActionView() { View view = View.inflate(fragment.getContext(), R.layout.group_find_in_page, null); findInPageNext = view.findViewById(R.id.find_in_page_next); findInPageNext.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { DeviceUtil.hideSoftKeyboard(view); if (!pageFragmentValid()) { return; } funnel.addFindNext(); fragment.getWebView().findNext(true); } }); findInPagePrev = view.findViewById(R.id.find_in_page_prev); findInPagePrev.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fragment.hideSoftKeyboard(); if (!pageFragmentValid()) { return; } funnel.addFindPrev(); fragment.getWebView().findNext(false); } }); findInPageMatch = (TextView) view.findViewById(R.id.find_in_page_match); SearchView searchView = (SearchView) view.findViewById(R.id.find_in_page_input); searchView.setQueryHint(fragment.getContext().getString(R.string.menu_page_find_in_page)); searchView.setFocusable(true); searchView.requestFocusFromTouch(); searchView.setOnQueryTextListener(searchQueryListener); searchView.setOnCloseListener(searchCloseListener); searchView.setIconified(false); searchView.setMaxWidth(Integer.MAX_VALUE); searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT); searchView.setSubmitButtonEnabled(false); View searchEditPlate = searchView .findViewById(android.support.v7.appcompat.R.id.search_plate); searchEditPlate.setBackgroundColor(Color.TRANSPARENT); return view; }
Source:
<code>public RepositorySearchDialog(Collection<String> existingDirs) { this(existingDirs, false, <START> false); <END> }</code><technical_language>logic switch, this true (former behavior)</technical_language>

Target:
public RepositorySearchDialog(Collection<String> existingDirs) { this(existingDirs, false, true); }
Source:
<code>private void assertThreadIsNotAlive(final Thread thread) throws Exception { <START> thread.join(9_000L); <END> TestUtils.await().atMost(1L, TimeUnit.SECONDS).until(() -> !thread.isAlive()); }</code><technical_language>Curious 9_000L mean? a number</technical_language>

Target:
private void assertThreadIsNotAlive(final Thread thread) throws Exception { thread.join(9000L); TestUtils.await().atMost(1000L, TimeUnit.MILLISECONDS).until(() -> !thread.isAlive()); }
Source:
<code>public ExtensionBootstrapper(final ServletContext context, final Configuration configuration) { this.configuration = configuration; this.context = context; <START> this.context.setAttribute(ExtensionContext.class.getName(), ExtensionController.getInstance()); <END> ExtensionController.getInstance().init(this.context); }</code><technical_language>do need this anylonger</technical_language>

Target:
public ExtensionBootstrapper(final ServletContext context, final Configuration configuration) { this.configuration = configuration; this.context = context; ExtensionController.getInstance().init(this.context); }
Source:
<code>private void doInterpreterActions() { SolutionTimeStep stp = solutionInterpreter.next( CompletionState.RUNNING ); for ( TimeStepAction action: stp.actions ) { if ( action instanceof SelectAction ) { actionTypeSwitch.caseSelectAction( (SelectAction)action ); } else if ( action instanceof PlaceTokenAction ) { actionTypeSwitch.casePlaceTokenAction( (PlaceTokenAction)action ); <START> } <END> } }</code><technical_language>reusing TimeStepActionTypeSwitch is clear? I live if defend I expecting type switch classes implemented inline</technical_language>

Target:
private void doInterpreterActions() { SolutionTimeStep stp = solutionInterpreter.next( CompletionState.RUNNING ); for ( TimeStepAction action: stp.actions ) { if ( action instanceof SelectAction ) { uiPlayback.selectToken( (SelectAction)action ); } else if ( action instanceof PlaceTokenAction ) { uiPlayback.placeToken( (PlaceTokenAction)action ); } } }
Source:
<code>public void setup() throws HandlerRequestException { resourceManagerGateway = new TestingResourceManagerGateway(); MetricFetcher metricFetcher = new TestingMetricFetcher(); <START> initializeMetricStore(metricFetcher.getMetricStore()); <END> testInstance = new TaskManagerDetailsHandler( () -> CompletableFuture.completedFuture(null), TestingUtils.TIMEOUT(), Collections.emptyMap(), TaskManagerDetailsHeaders.getInstance(), () -> CompletableFuture.completedFuture(resourceManagerGateway), metricFetcher ); handlerRequest = createRequest(); }</code><technical_language>called method initializeMetricStore declaration proceeds calling method</technical_language>

Target:
public void setup() throws HandlerRequestException { resourceManagerGateway = new TestingResourceManagerGateway(); metricFetcher = new TestingMetricFetcher(); testInstance = new TaskManagerDetailsHandler( () -> CompletableFuture.completedFuture(null), TestingUtils.TIMEOUT(), Collections.emptyMap(), TaskManagerDetailsHeaders.getInstance(), () -> CompletableFuture.completedFuture(resourceManagerGateway), metricFetcher ); }
Source:
<code>public void applyCodeChanges(JsdiffChange[] changes) { AceEditorNative editor = widget_.getEditor(); EditSession session = editor.getSession(); Selection selection = session.getSelection(); AceCommandManager commandManager = editor.getCommandManager(); Consumer<Integer> advanceSelection = (Integer charsLeft) -> { Position startPos = selection.getCursor(); int row; int col = startPos.getColumn(); for (row = startPos.getRow(); row < session.getLength(); row++) { String line = session.getLine(row); int charsLeftInLine = line.length() - col; if (charsLeft <= charsLeftInLine) { col = col + charsLeft; break; } else { charsLeft -= (charsLeftInLine+1); col = 0; } } selection.moveCursorTo(row, col, false); }; for (int i = 0; i<changes.length; i++) { JsdiffChange change = changes[i]; if (i == 0) <START> selection.moveCursorTo(0, 0, false); <END> if (change.added) { commandManager.exec("insertstring", editor, change.value); } else if (change.removed) { advanceSelection.accept(change.count); for (int ch = 0; ch<change.count; ch++) commandManager.exec("backspace", editor); } else if (i != (changes.length-1)) { advanceSelection.accept(change.count); } } }</code><technical_language>move this for-loop begins</technical_language>

Target:
public void applyCodeChanges(JsdiffChange[] changes) { AceEditorNative editor = widget_.getEditor(); EditSession session = editor.getSession(); Selection selection = session.getSelection(); AceCommandManager commandManager = editor.getCommandManager(); Consumer<Integer> advanceSelection = (Integer charsLeft) -> { Position startPos = selection.getCursor(); int row = startPos.getRow(); int col = startPos.getColumn(); while (row < session.getLength()) { String line = session.getLine(row); int charsLeftInLine = line.length() + 1 - col; if (charsLeft < charsLeftInLine) { col = col + charsLeft; break; } else { charsLeft -= charsLeftInLine; col = 0; row++; } } selection.moveCursorTo(row, col, false); }; if (changes.length > 0) selection.moveCursorTo(0, 0, false); for (int i = 0; i<changes.length; i++) { JsdiffChange change = changes[i]; if (change.added) { commandManager.exec("insertstring", editor, change.value); } else if (change.removed) { advanceSelection.accept(change.count); for (int ch = 0; ch<change.count; ch++) commandManager.exec("backspace", editor); } else if (i != (changes.length-1)) { advanceSelection.accept(change.count); } } }
Source:
<code>public void onPostUploaded(OnPostUploaded event) { if (getLifecycle().getCurrentState().isAtLeast(STARTED)) { <START> int siteLocalId = AppPrefs.getSelectedSite(); <END> SiteModel site = mSiteStore.getSiteByLocalId(siteLocalId); if (site != null && event.post != null && event.post.getLocalSiteId() == site.getId()) { mUploadUtilsWrapper.onPostUploadedSnackbarHandler( this, findViewById(R.id.coordinator), event.isError(), event.post, null, site); } } }</code><technical_language>missing something, fully need this unregister dispatcher in onPause, sense? wdyt</technical_language>

Target:
public void onPostUploaded(OnPostUploaded event) { int siteLocalId = AppPrefs.getSelectedSite(); SiteModel site = mSiteStore.getSiteByLocalId(siteLocalId); if (site != null && event.post != null && event.post.getLocalSiteId() == site.getId()) { mUploadUtilsWrapper.onPostUploadedSnackbarHandler( this, findViewById(R.id.coordinator), event.isError(), event.post, null, site); } }
Source:
<code>public Flux<ServiceInstance> getInstances(String serviceId) { String serviceIdToQuery = serviceIdToQuery(serviceId); return Mono.justOrEmpty(serviceIdToQuery) .flatMapMany(getInstancesFromZookeeper()) <START> .subscribeOn(Schedulers.elastic()) <END> .map(zkInstance -> toZookeeperServiceInstance(serviceIdToQuery, zkInstance)); }</code><technical_language>boundedElastic</technical_language>

Target:
public Flux<ServiceInstance> getInstances(String serviceId) { String serviceIdToQuery = serviceIdToQuery(serviceId); return Mono.justOrEmpty(serviceIdToQuery) .flatMapMany(getInstancesFromZookeeper()) .subscribeOn(Schedulers.boundedElastic()) .map(zkInstance -> toZookeeperServiceInstance(serviceIdToQuery, zkInstance)); }
Source:
<code>private void buildProjectActions() { if (this.projectActions != null) { return; } <START> this.projectActions = Collections.synchronizedList(new ArrayList<SloccountProjectAction>()); <END> this.projectActions.add(new SloccountProjectAction(this.build.getParent(), this.numBuildsInGraph)); }</code><technical_language>CopyOnWriteArrayList list offer a performance for read operations, dominant</technical_language>

Target:
private void buildProjectActions() { if (projectActions != null) { return; } CopyOnWriteArrayList<SloccountProjectAction> actions = new CopyOnWriteArrayList<>(); actions.add(new SloccountProjectAction(build.getParent(), numBuildsInGraph)); projectActions = actions; }
Source:
<code>public AzureAccountInfo jsonToAzureAccountInfo(Map<String, Object> jsonData) { String objectId = ObjectUtils.toString(jsonData.get("objectId")); <START> String objectType = ObjectUtils.toString(jsonData.get("objectType")); <END> String userPrincipalName = ObjectUtils.toString(jsonData.get("userPrincipalName")); String accountName = ObjectUtils.toString(jsonData.get("mailNickname")); if(objectType != null && objectType.equalsIgnoreCase("Group")) { accountName = ObjectUtils.toString(jsonData.get("displayName")); } String name = ObjectUtils.toString(jsonData.get("displayName")); if (StringUtils.isBlank(name)) { name = accountName; } return new AzureAccountInfo(objectId, accountName, null, userPrincipalName, name); }</code><technical_language>ObjectUtils.toString() return empty string if obj is null. Is this want do</technical_language>

Target:
public AzureAccountInfo jsonToAzureAccountInfo(Map<String, Object> jsonData) { String objectId = ObjectUtils.toString(jsonData.get("objectId")); String objectType = ObjectUtils.toString(jsonData.get("objectType")); String userPrincipalName = ObjectUtils.toString(jsonData.get("userPrincipalName")); String accountName = ObjectUtils.toString(jsonData.get("mailNickname")); if("Group".equalsIgnoreCase(objectType)) { accountName = ObjectUtils.toString(jsonData.get("displayName")); } String name = ObjectUtils.toString(jsonData.get("displayName")); if (StringUtils.isBlank(name)) { name = accountName; } return new AzureAccountInfo(objectId, accountName, null, userPrincipalName, name); }
Source:
<code>public CloudInitHandler(VmInit vmInit) { this.vmInit = vmInit; metaData = new HashMap<>(); userData = new HashMap<>(); files = new HashMap<>(); nextFileIndex = 0; <START> this.sourceProtocol = NetConfigSourceProtocol.OPENSTACK_METADATA; <END> }</code><technical_language>do openstack metadata is supported? concerned of a scenario customers templates installed version of cloud init support</technical_language>

Target:
public CloudInitHandler(VmInit vmInit) { this(vmInit, NetConfigSourceProtocol.OPENSTACK_METADATA); }
Source:
<code>@Override public int read(@NonNull byte[] b, int off, int len) throws IOException { <START> checkNotNull(b, "b is null"); <END> if (off < 0 || len < 0 || len > b.length - off) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int count = len; if (!source.request(position + count)) { count = available(); } if (count == 0) return -1; int copied = copyTo(b, off, count); position += copied; if (position > markLimit) { mark = -1; } return copied; }</code><technical_language>"b == null"</technical_language>

Target:
@Override public int read(@NonNull byte[] b, int off, int len) throws IOException { if (off < 0 || len < 0 || len > b.length - off) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } int count = len; if (!source.request(position + count)) { count = available(); } if (count == 0) return -1; int copied = copyTo(b, off, count); position += copied; if (position > markLimit) { markPosition = -1; } return copied; }
Source:
<code>Grid createRow(final HostInterface hostInterface) { Grid row = new Grid(1, 2); row.setHeight("100%"); row.setWidth("100%"); Style gridStyle = row.getElement().getStyle(); gridStyle.setBorderColor("white"); gridStyle.setBorderWidth(1, Unit.PX); gridStyle.setBorderStyle(BorderStyle.SOLID); row.getColumnFormatter().setWidth(0, "30px"); row.getColumnFormatter().setWidth(1, "210px"); <START> row.setWidget(0, 0, new HorizontalPanel() { <END> { if (isSelectionAvailable) { add(getCheckBox()); } add(new InterfaceStatusImage(hostInterface.getStatus())); } }); row.setWidget(0, 1, HostInterfaceForm.createInterfaceLabel(hostInterface.getInterface())); return row; }</code><technical_language>this necessary? changed is addition of label image, screw layout</technical_language>

Target:
Grid createRow(final HostInterface hostInterface) { Grid row = new Grid(1, 2); row.setHeight("100%"); row.setWidth("100%"); Style gridStyle = row.getElement().getStyle(); gridStyle.setBorderColor("white"); gridStyle.setBorderWidth(1, Unit.PX); gridStyle.setBorderStyle(BorderStyle.SOLID); row.getColumnFormatter().setWidth(0, "30px"); row.getColumnFormatter().setWidth(1, "210px"); row.setWidget(0, 0, new HorizontalPanel() { { if (isSelectionAvailable) { add(getCheckBox()); } add(new InterfaceStatusImage(hostInterface.getStatus())); } }); row.setWidget(0, 1, new InterfaceLabelWithToolTip(hostInterface.getInterface()).getLabel()); return row; }
Source:
<code>public boolean isFinished() { <START> try (YarnClient yarnClient = StramClientUtils.createYarnClient(conf)) { <END> ApplicationReport appReport = yarnClient.getApplicationReport(appId); if (appReport != null) { if (appReport.getFinalApplicationStatus() == null || appReport.getFinalApplicationStatus() == FinalApplicationStatus.UNDEFINED) { return false; } } return true; } catch (YarnException | IOException e) { throw Throwables.propagate(e); } }</code><technical_language>cache yarnClient YarnAppHandleImpl instead of creating time? In ApexCli yarnClient is cached</technical_language>

Target:
public boolean isFinished() { try { ApplicationReport appReport = yarnClient.getApplicationReport(appId); if (appReport != null) { if (appReport.getFinalApplicationStatus() == null || appReport.getFinalApplicationStatus() == FinalApplicationStatus.UNDEFINED) { return false; } } return true; } catch (YarnException | IOException e) { throw Throwables.propagate(e); } }
Source:
<code>public Object visit(ASTConstructorDeclaration node, Object data) { <START> int cyclo = (int) Metrics.get(OperationMetricKey.CYCLO, node); <END> if (showMethodsComplexity && cyclo >= reportLevel) { addViolation(data, node, new String[] {"constructor", node.getQualifiedName().getOperation(), "" + cyclo}); } return data; }</code><technical_language>I think, "cycloVersion" here, too</technical_language>

Target:
public Object visit(ASTConstructorDeclaration node, Object data) { int cyclo = (int) Metrics.get(OperationMetricKey.CYCLO, node, cycloVersion); if (showMethodsComplexity && cyclo >= reportLevel) { addViolation(data, node, new String[] {"constructor", node.getQualifiedName().getOperation(), "" + cyclo}); } return data; }
Source:
<code>public boolean hasAnyAcceptedCardType3dsRequired() { return cardTypes.stream() .filter(CardTypeEntity::isRequires3ds) <START> .count() > 0; <END> }</code><technical_language>return cardTypes.stream().anyMatch(CardTypeEntity::isRequires3ds);</technical_language>

Target:
public boolean hasAnyAcceptedCardType3dsRequired() { return cardTypes.stream() .anyMatch(CardTypeEntity::isRequires3ds); }
Source:
<code>public void setKSessions(final List<String> ksessions) { String[] names = ksessions.toArray(new String[ksessions.size()]); ksessionSelect.setup(ksessionSelectContainer, buildOptions(names), names[0], new Consumer<String>() { @Override public void accept(String s) { onSelectionChange(); } <START> }); <END> }</code><technical_language>this consumer simplified lambda leaving decision you. selectedKieSession -> onSelectionChange()</technical_language>

Target:
public void setKSessions(final List<String> ksessions) { String[] names = ksessions.toArray(new String[ksessions.size()]); ksessionSelect.setup(ksessionSelectContainer, buildOptions(names), names[0], s -> onSelectionChange()); }
Source:
<code>public IVariable makeVariable(int valueNumber) { if (doPrimitives) { <START> SymbolTable st = ir.getSymbolTable(); <END> if (st.isConstant(valueNumber)) { if (st.isBooleanConstant(valueNumber)) { return new TypeVariable(language.getPrimitive(language.getConstantType(Boolean.TRUE))); } } } return new TypeVariable(TypeAbstraction.TOP); }</code><technical_language>changes TypeInference part of fix for default methods? If not, pull changes TypeInference a separate PR, clean</technical_language>

Target:
public IVariable makeVariable(int valueNumber) { SymbolTable st = ir.getSymbolTable(); if (doPrimitives) { if (st.isConstant(valueNumber)) { if (st.isBooleanConstant(valueNumber)) { return new TypeVariable(language.getPrimitive(language.getConstantType(Boolean.TRUE))); } } } return new TypeVariable(TypeAbstraction.TOP); }
Source:
<code>public synchronized List<List<Object>> addOrUpdate(DBObject object, DBObject oldObject) { if (oldObject != null) { this.remove(oldObject); } DBObject key = getKeyFor(object); if (unique) { if (mapValues.containsKey(key)) { <START> return extractFields(object, key.toMap().keySet()); <END> } mapValues.put(key, Collections.singletonList(object)); } else { List<DBObject> values = mapValues.get(key); if (values == null) { values = new ArrayList<DBObject>(); mapValues.put(key, values); } values.add(object); } return Collections.emptyList(); }</code><technical_language>need .toMap() here. keySet() is a method DBObject</technical_language>

Target:
public synchronized List<List<Object>> addOrUpdate(DBObject object, DBObject oldObject) { if (oldObject != null) { this.remove(oldObject); } DBObject key = getKeyFor(object); if (unique) { if (mapValues.containsKey(key)) { return extractFields(object, key.keySet()); } mapValues.put(key, Collections.singletonList(object)); } else { List<DBObject> values = mapValues.get(key); if (values == null) { values = new ArrayList<DBObject>(); mapValues.put(key, values); } values.add(object); } return Collections.emptyList(); }
Source:
<code>private void checkDiff() { try { getConfigDao().getConfigDiff() .stream() <START> .forEach(configDiff -> console.writeFormat("Option name: %s, Current value: %s, Default value: %s, version: %s\n", <END> configDiff.getOptionName(), configDiff.getOptionValue(), configDiff.getDefaultValue(), configDiff.getVersion())); } catch (Exception e) { log.debug("Error details: ", e); } }</code><technical_language>Some of engine-config values large, show difference multiple lines? like: Option name: SOME_OPTION Current value: 'A set user' Default value: 'Default of option'</technical_language>

Target:
private void checkDiff() { try { console.writeFormat("%-40s | %-40s | %-40s | %s\n", "Option name", "Default value", "User value", "Version"); console.writeLine(String.format("%s", StringUtils.repeat("-", 136))); getConfigDao().getConfigDiff() .stream() .filter(configKey -> configKey.getKey() != null) .forEach(configDiff -> console.writeFormat("%-40s | %-40s | %-40s | %s\n", configDiff.getKey(), StringUtils.abbreviate(configDiff.getValue(), 40), StringUtils.abbreviate(configDiff.getDefaultValue(), 40), configDiff.getVersion())); } catch (Exception e) { log.error("Error details: ", e); } }
Source:
<code>public void handleUnimprovedDaysSpentInputChange( ChangeEvent event ) { try { Long value = unimprovedDaysSpentInput.getValue().isEmpty() ? null : Long.parseLong( unimprovedDaysSpentInput.getValue() ); presenter.onUnimprovedDaysSpentChange( value ); } catch ( NumberFormatException e ) { <START> <END> } }</code><technical_language>Likewise.</technical_language>

Target:
public void handleUnimprovedDaysSpentInputChange( ChangeEvent event ) { boolean isNumeric = unimprovedDaysSpentInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onUnimprovedDaysSpentChange( Long.parseLong( unimprovedDaysSpentInput.getValue() ) ); } else { presenter.onUnimprovedDaysSpentChange( 0l ); unimprovedDaysSpentInput.setValue( "0" ); } }
Source:
<code>void proceedDownVms() { if (vdsmVm != null && vdsmVm.getVmDynamic().getStatus() == VMStatus.Down) { VMStatus prevStatus = VMStatus.Unassigned; VmDynamic dynamicFromDb = null; if (dbVm != null) { prevStatus = dbVm.getStatus(); proceedVmBeforeDeletion(); if (prevStatus == VMStatus.SavingState) { vmsMonitoring.getResourceManager().InternalSetVmStatus(dbVm, VMStatus.Suspended); } clearVm(vdsmVm.getVmDynamic().getExitStatus(), vdsmVm.getVmDynamic().getExitMessage(), vdsmVm.getVmDynamic().getExitReason()); } else { dynamicFromDb = getDbFacade().getVmDynamicDao().get(vdsmVm.getVmDynamic().getId()); if (dynamicFromDb != null) { prevStatus = dynamicFromDb.getStatus(); } } <START> if (dbVm != null || dynamicFromDb != null) { <END> vmsMonitoring.getResourceManager().runVdsCommand( VDSCommandType.Destroy, new DestroyVmVDSCommandParameters( getVdsManager().getVdsId(), vdsmVm.getVmDynamic().getId(), false, false, 0)); if (dbVm != null && prevStatus == VMStatus.SavingState) { afterSuspendTreatment(vdsmVm.getVmDynamic()); } else if (prevStatus != VMStatus.MigratingFrom) { handleVmOnDown(dbVm, vdsmVm.getVmDynamic()); } } } }</code><technical_language>check prevStatus!=Unassigned declare dynamicFromDb field else block instead</technical_language>

Target:
void proceedDownVms() { if (vdsmVm != null && vdsmVm.getVmDynamic().getStatus() == VMStatus.Down) { VMStatus prevStatus = VMStatus.Unassigned; if (dbVm != null) { prevStatus = dbVm.getStatus(); proceedVmBeforeDeletion(); if (prevStatus == VMStatus.SavingState) { vmsMonitoring.getResourceManager().InternalSetVmStatus(dbVm, VMStatus.Suspended); } clearVm(vdsmVm.getVmDynamic().getExitStatus(), vdsmVm.getVmDynamic().getExitMessage(), vdsmVm.getVmDynamic().getExitReason()); } else { VmDynamic dynamicFromDb = getDbFacade().getVmDynamicDao().get(vdsmVm.getVmDynamic().getId()); if (dynamicFromDb != null) { prevStatus = dynamicFromDb.getStatus(); } } if (prevStatus != VMStatus.Unassigned) { vmsMonitoring.getResourceManager().runVdsCommand( VDSCommandType.Destroy, new DestroyVmVDSCommandParameters( getVdsManager().getVdsId(), vdsmVm.getVmDynamic().getId(), false, false, 0)); if (dbVm != null && prevStatus == VMStatus.SavingState) { afterSuspendTreatment(vdsmVm.getVmDynamic()); } else if (prevStatus != VMStatus.MigratingFrom) { handleVmOnDown(dbVm, vdsmVm.getVmDynamic()); } } } }
Source:
<code>private StreamBlock pollPersistentDeque(boolean actuallyPoll) { BinaryDequeReader.Entry<ExportRowSchema> entry = null; StreamBlock block = null; try { entry = m_reader.pollEntry(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); if (entry != null) { ByteBuffer b = entry.getData(); b.order(ByteOrder.LITTLE_ENDIAN); long seqNo = b.getLong(StreamBlock.SEQUENCE_NUMBER_OFFSET); long committedSeqNo = b.getLong(StreamBlock.COMMIT_SEQUENCE_NUMBER_OFFSET); int tupleCount = b.getInt(StreamBlock.ROW_NUMBER_OFFSET); long uniqueId = b.getLong(StreamBlock.UNIQUE_ID_OFFSET); block = new StreamBlock(entry, seqNo, committedSeqNo, tupleCount, uniqueId, true); if (!actuallyPoll) { assert(entry.getExtraHeader() != null); m_memoryDeque.offer(block); } } } catch (Exception e) { <START> exportLog.error("Failed to poll from persistent binary deque:" + e); <END> } return block; }</code><technical_language>is pass exception argument logger stack trace logged</technical_language>

Target:
private StreamBlock pollPersistentDeque(boolean actuallyPoll) { BinaryDequeReader.Entry<ExportRowSchema> entry = null; StreamBlock block = null; try { entry = m_reader.pollEntry(PersistentBinaryDeque.UNSAFE_CONTAINER_FACTORY); if (entry != null) { ByteBuffer b = entry.getData(); b.order(ByteOrder.LITTLE_ENDIAN); long seqNo = b.getLong(StreamBlock.SEQUENCE_NUMBER_OFFSET); long committedSeqNo = b.getLong(StreamBlock.COMMIT_SEQUENCE_NUMBER_OFFSET); int tupleCount = b.getInt(StreamBlock.ROW_NUMBER_OFFSET); long uniqueId = b.getLong(StreamBlock.UNIQUE_ID_OFFSET); block = new StreamBlock(entry, seqNo, committedSeqNo, tupleCount, uniqueId, true); if (!actuallyPoll) { assert(entry.getExtraHeader() != null); m_memoryDeque.offer(block); } } } catch (Exception e) { exportLog.error("Failed to poll from persistent binary deque", e); } return block; }
Source:
<code>public void run() { try { sendTimerEvents(); Long toNotifyTime = toNotifyQueue.peek(); long currentTime = executionPlanContext.getTimestampGenerator().currentTime(); if (!executionPlanContext.isPlayback()) { if (toNotifyTime != null) { scheduledExecutorService.schedule(eventCaller, toNotifyTime - currentTime, TimeUnit .MILLISECONDS); } else { <START> synchronized (this) { <END> running = false; if (toNotifyQueue.peek() != null) { running = true; scheduledExecutorService.schedule(eventCaller, 0, TimeUnit.MILLISECONDS); } } } } } catch (Throwable t) { log.error(t); } }</code><technical_language>synchronized (this) in class stop outer class. I this is wrong</technical_language>

Target:
public void run() { try { sendTimerEvents(); Long toNotifyTime = toNotifyQueue.peek(); long currentTime = executionPlanContext.getTimestampGenerator().currentTime(); if (!executionPlanContext.isPlayback()) { if (toNotifyTime != null) { scheduledExecutorService.schedule(eventCaller, toNotifyTime - currentTime, TimeUnit .MILLISECONDS); } else { try { mutex.acquire(); running = false; if (toNotifyQueue.peek() != null) { running = true; scheduledExecutorService.schedule(eventCaller, 0, TimeUnit.MILLISECONDS); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); log.error("Error when scheduling System Time Based Scheduler", e); } finally { mutex.release(); } } } } catch (Throwable t) { log.error(t); } }
Source:
<code>public void deleteDependenciesAfterConversion(){ createWithRuntime(); new CheckBox("Delete original references from project").toggle(true); finishConversionDialog(); checkProblemsAndResolve(); PropertyDialog pd = openPropertiesProject(WEB_PROJECT_NAME); new DefaultTreeItem("Java Build Path").select(); new DefaultTabItem("Libraries").activate(); List<TreeItem> itRootDirs = new DefaultTree(1).getItems(); <START> List<TreeItem> it = new ArrayList<TreeItem>(); <END> for (TreeItem i: itRootDirs) { if (getJavaVersion().equals("1.8")) { it.add(i); } else { it.addAll(i.getItems()); } } log.debug("Libraries found after conversion:"); for(TreeItem i: it){ log.debug(" "+i.getText()); } assertTrue("project contains more libraries than expected",it.size()==2); for(TreeItem i: it){ if(!(i.getText().contains("JRE") || i.getText().contains("Maven Dependencies"))){ fail("Some dependencies are missing after conversion"); } } pd.ok(); new WaitWhile(new ShellIsAvailable("Properties for "+WEB_PROJECT_NAME),TimePeriod.DEFAULT); }</code><technical_language>I RedDeer implementation of this dialog: <LINK_0> WDYT</technical_language>

Target:
public void deleteDependenciesAfterConversion(){ createWithRuntime(); new CheckBox("Delete original references from project").toggle(true); finishConversionDialog(); checkProblemsAndResolve(); PropertyDialog pd = openPropertiesProject(WEB_PROJECT_NAME); List<String> libs = getJavaBuildPathLibraries(pd); assertTrue("project contains more libraries than expected", libs.size() == 2); for (String i : libs) { if (!(i.contains("JRE") || i.contains("Maven Dependencies"))) { fail("Some dependencies are missing after conversion"); } } pd.ok(); new WaitWhile(new ShellIsAvailable("Properties for "+WEB_PROJECT_NAME),TimePeriod.DEFAULT); }
Source:
<code>public void compareLists_shouldPassIfMapOfDifferencesIsCorrect() { LinkedList<Integer> origList = new LinkedList<>(Arrays.asList(1,2,3)); LinkedList<Integer> newList = new LinkedList<>(Arrays.asList(2,3,4)); Collection<Collection<Integer>> m = OpenmrsUtil.compareLists(origList, newList); Vector<Collection<Integer>> v = new Vector<Collection<Integer>>(m); LinkedList<Integer> toAdd = (LinkedList<Integer>)v.get(0); LinkedList<Integer> toDel = (LinkedList<Integer>)v.get(1); <START> Assert.assertThat(toAdd.size(), is(1)); <END> Assert.assertThat(toDel.size(), is(1)); Assert.assertThat(toAdd, Matchers.hasItems(4)); Assert.assertThat(toDel, Matchers.hasItems(1)); }</code><technical_language>please statically import assertThat hasItems</technical_language>

Target:
public void compareLists_shouldPassIfMapOfDifferencesIsCorrect() { LinkedList<Integer> origList = new LinkedList<>(Arrays.asList(1,2,3)); LinkedList<Integer> newList = new LinkedList<>(Arrays.asList(2,3,4)); Collection<Collection<Integer>> result = OpenmrsUtil.compareLists(origList, newList); Iterator<Collection<Integer>> it = result.iterator(); assertThat(result.size(), is(2)); assertThat(it.next(), contains(4)); assertThat(it.next(), contains(1)); }
Source:
<code>public String toString() { return toString(" ", " |-> ", ".Map"); <START> } <END></code><technical_language>extract a constant out of string literal</technical_language>

Target:
public String toString() { return toString(" ", " |-> ", DataStructureSort.DEFAULT_MAP_UNIT_LABEL); }
Source:
<code>public void close() { endOut(); if (errorThread != null) { try { errorThread.halt(); <START> } catch (final InterruptedException e) { <END> } finally { errorThread = null; } } super.close(); process.destroy(); }</code><technical_language>Style-nit: Remove added final keyword</technical_language>

Target:
public void close() { endOut(); if (errorThread != null) { try { errorThread.halt(); } catch (InterruptedException e) { } finally { errorThread = null; } } super.close(); process.destroy(); }