auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void commandRun() { if (!isZKServerRunning()) { pw.println(ZK_NOT_SERVING); } else { pw.print("Zookeeper version: "); pw.println(Version.getFullVersion()); if (zkServer instanceof ReadOnlyZooKeeperServer) { pw.println("READ-ONLY mode; serving only read-only clients"); } if (len == FourLetterCommands.statCmd) { LOG.info("Stat command output"); pw.println("Clients:"); for(ServerCnxn c : factory.getConnections()){ c.dumpConnectionInfo(pw, true); pw.println(); } pw.println(); } ServerStats serverStats = zkServer.serverStats(); pw.print(serverStats.toString()); pw.print("Node count: "); pw.println(zkServer.getZKDatabase().getNodeCount()); if (serverStats.getServerState().equals("leader")) { Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader(); <START> BufferStats bufferStats = leader.getBufferStats(); <END> pw.printf("Proposal sizes last/min/max: %s%n", bufferStats.toString()); } } }</code><technical_language>above. Please var name "proposalStats" instead of "bufferStats"</technical_language>

Target:
public void commandRun() { if (!isZKServerRunning()) { pw.println(ZK_NOT_SERVING); } else { pw.print("Zookeeper version: "); pw.println(Version.getFullVersion()); if (zkServer instanceof ReadOnlyZooKeeperServer) { pw.println("READ-ONLY mode; serving only read-only clients"); } if (len == FourLetterCommands.statCmd) { LOG.info("Stat command output"); pw.println("Clients:"); for(ServerCnxn c : factory.getConnections()){ c.dumpConnectionInfo(pw, true); pw.println(); } pw.println(); } ServerStats serverStats = zkServer.serverStats(); pw.print(serverStats.toString()); pw.print("Node count: "); pw.println(zkServer.getZKDatabase().getNodeCount()); if (serverStats.getServerState().equals("leader")) { Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader(); BufferStats proposalStats = leader.getProposalStats(); pw.printf("Proposal sizes last/min/max: %s%n", proposalStats.toString()); } } }
Source:
<code>public DistanceComparator() { this.coords = null; <START> this.list = null; <END> }</code><technical_language>list set null? soon compareCaches() called, calculateAllDistances called well, a NullPointerException in for loop. compareCaches() called singleton? If this is case, null instead of this singleton? I follow logic here</technical_language>

Target:
public DistanceComparator() { coords = null; list = new ArrayList<>(); }
Source:
<code>public void setImageServerContent(Map<String, String> serverContent) { this.imageServerContent = <START> serverContent; <END> }</code><technical_language>ImmutableMap.copyOf</technical_language>

Target:
public void setImageServerContent(Map<String, String> serverContent) { this.imageServerContent = ImmutableMap.copyOf(serverContent); }
Source:
<code><START> protected Map<String, Object> parseResponse(HttpResponse response) <END> throws HttpResponseException, IOException { final StatusLine statusLine = response.getStatusLine(); if (statusLine.getStatusCode() >= 300) { logger.error(String.format("unable to parse response as the response status is %s", statusLine.getStatusCode())); throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); } final HttpEntity entity = response.getEntity(); if (null != entity){ Object returnVal = JSONUtils.parseJSONFromString(EntityUtils.toString(entity)); if (null!= returnVal){ return (Map<String, Object>) returnVal; } } return null; }</code><technical_language>good describe behavior this method return null empty map. simpler return empty map? caller behavior differently based nulll empty map</technical_language>

Target:
protected Map<String, Object> parseResponse(HttpResponse response) throws HttpResponseException, IOException { final StatusLine statusLine = response.getStatusLine(); String responseBody = response.getEntity() != null ? EntityUtils.toString(response.getEntity()) : ""; if (statusLine.getStatusCode() >= 300) { logger.error(String.format("unable to parse response as the response status is %s", statusLine.getStatusCode())); throw new HttpResponseException(statusLine.getStatusCode(),responseBody); } final HttpEntity entity = response.getEntity(); if (null != entity){ Object returnVal = JSONUtils.parseJSONFromString(EntityUtils.toString(entity)); if (null!= returnVal){ return (Map<String, Object>) returnVal; } } return new HashMap<String, Object>() ; }
Source:
<code>public void checkLanguageServerInitialized() { <START> projectExplorer.waitAndSelectItem(PROJECT_NAME); <END> projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openItemByPath(PATH_TO_GO_FILE); editor.waitTabIsPresent(GO_FILE_NAME); consoles.selectProcessByTabName("dev-machine"); consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); }</code><technical_language>projectExplorer.waitAndSelectItem(PROJECT_NAME); projectExplorer.openItemByPath(PROJECT_NAME); projectExplorer.openItemByPath(PATH_TO_GO_FILE); changed "ProjectExplorer#expandPathInProjectExplorerAndOpenFile(String path, String fileName)"</technical_language>

Target:
public void checkLanguageServerInitialized() { projectExplorer.expandPathInProjectExplorerAndOpenFile(PROJECT_NAME, GO_FILE_NAME); editor.waitTabIsPresent(GO_FILE_NAME); consoles.selectProcessByTabName("dev-machine"); consoles.waitExpectedTextIntoConsole(LS_INIT_MESSAGE); }
Source:
<code>public boolean containsApplication(String applicationName) { return getDriver().findElementsWithoutWaiting(By.xpath( <START> " END> }</code><technical_language>hasElementWithoutWaiting use</technical_language>

Target:
public boolean containsApplication(String applicationName) { return getDriver().hasElementWithoutWaiting(applicationElement(applicationName)); }
Source:
<code>public void updateView() { <START> mLocalMapList = mOffline.getAllUpdateInfo(); <END> if (mLocalMapList == null) { mLocalMapList = new ArrayList<MKOLUpdateElement>(); } mLAdapter.notifyDataSetChanged(); }</code><technical_language>@droneboost empty mLocalMapList is filled, override result mOffline.getAllUpdateInfo(). In case, Collections.emptyList() result is null</technical_language>

Target:
public void updateView() { mLocalMapList = mOffline.getAllUpdateInfo(); if (mLocalMapList == null) { mLocalMapList = Collections.emptyList();; } mLAdapter.notifyDataSetChanged(); }
Source:
<code>public Sequence<T> run(final Query<T> query) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof UnionDataSource) { <START> return new MergeSequence<T>( <END> toolChest.getOrdering(), Sequences.simple( Lists.transform( ((UnionDataSource) dataSource).getDataSources(), new Function<DataSource, Sequence<T>>() { @Override public Sequence<T> apply(DataSource singleSource) { return baseRunner.run( query.withDataSource(singleSource) ); } } ) ) ); } else { return baseRunner.run(query); } }</code><technical_language>I toolchest stay in control of merge operation, odd some merge operations defined toolchest, others of it</technical_language>

Target:
public Sequence<T> run(final Query<T> query) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof UnionDataSource) { return toolChest.mergeSequencesUnordered( Sequences.simple( Lists.transform( ((UnionDataSource) dataSource).getDataSources(), new Function<DataSource, Sequence<T>>() { @Override public Sequence<T> apply(DataSource singleSource) { return baseRunner.run( query.withDataSource(singleSource) ); } } ) ) ); } else { return baseRunner.run(query); } }
Source:
<code>public String toString() { if (isValid()) { <START> String longitude = ("" + coordinates.get(0)).contains(".") <END> ? "" + coordinates.get(0) : "" + coordinates.get(0) + ".0"; String latitude = ("" + coordinates.get(1)).contains(".") ? "" + coordinates.get(1) : "" + coordinates.get(1) + ".0"; return String.format( Locale.US, "{type=Point, coordinates=[%s, %s], crs={%s}}", "" + longitude, latitude, coordinateSystem.toString()); } return ""; }</code><technical_language>a confused decimal String conversion, is reason %+02f anymore in String.format call? get additional units of precision in decimal part</technical_language>

Target:
public String toString() { if (isValid()) { String longitude = Double.toString(coordinates.get(0)); String latitude = Double.toString(coordinates.get(1)); return String.format( Locale.ROOT, "{type=Point, coordinates=[%s, %s], crs={%s}}", "" + longitude, latitude, coordinateSystem); } return ""; }
Source:
<code>public void onApplicationEvent(ContextRefreshedEvent event) { <START> ConfigurableApplicationContext source = (ConfigurableApplicationContext) event.getSource(); <END> if (!source.isRunning()) { source.start(); } }</code><technical_language>Strictly speaking, this ApplicationContextAware check context in event matches. want react events other contexts in hierarchy - relevant here, practice</technical_language>

Target:
public void onApplicationEvent(ContextRefreshedEvent event) { ConfigurableApplicationContext source = (ConfigurableApplicationContext) event.getSource(); if (source == this.applicationContext && !source.isRunning()) { source.start(); } }
Source:
<code>public Media(final String filename) { <START> pageId = UUID.randomUUID().toString(); <END> this.filename = filename; }</code><technical_language>replace this line this()</technical_language>

Target:
public Media(final String filename) { this(); this.filename = filename; }
Source:
<code>public void earlyStartup() { if (Boolean.getBoolean(SYSPROP_DISABLE_AERI)) { return; } new Job(Messages.JOB_NAME_INITIALIZING_AERI) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(Messages.TASK_NAME_INITIALIZING_AERI, IProgressMonitor.UNKNOWN); IEclipseContext aeriContext = initializeIdeContext(); IDEWorkflow dispatcher = aeriContext.get(IDEWorkflow.class); LogListener listener = aeriContext.get(LogListener.class); Platform.addLogListener(listener); <START> if (!SystemControl.getSystemSettings().isConfigured() <END> || !SystemControl.getSystemSettings().isDisableEclipseCrashDetection()) { scheduleHsErrCheck(listener); } monitor.done(); return Status.OK_STATUS; } }.schedule(); }</code><technical_language>configured? Why</technical_language>

Target:
public void earlyStartup() { if (Boolean.getBoolean(SYSPROP_DISABLE_AERI)) { return; } new Job(Messages.JOB_NAME_INITIALIZING_AERI) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(Messages.TASK_NAME_INITIALIZING_AERI, IProgressMonitor.UNKNOWN); IEclipseContext aeriContext = initializeIdeContext(); IDEWorkflow dispatcher = aeriContext.get(IDEWorkflow.class); LogListener listener = aeriContext.get(LogListener.class); Platform.addLogListener(listener); if (!SystemControl.getSystemSettings().isConfigured() || !SystemControl.getSystemSettings().isDisableJvmCrashDetection()) { scheduleHsErrCheck(listener); } monitor.done(); return Status.OK_STATUS; } }.schedule(); }
Source:
<code>private void snapshotAndWait(final String snapShotName, final TableName tableName) throws Exception{ admin.snapshot(snapShotName, tableName); LOG.info("Sleep for one second, waiting for HDFS Acl setup"); <START> Threads.sleep(1000); <END> }</code><technical_language>this 3 seconds? Yeah, this ugly (smile)</technical_language>

Target:
private void snapshotAndWait(final String snapShotName, final TableName tableName) throws Exception{ admin.snapshot(snapShotName, tableName); LOG.info("Sleep for three seconds, waiting for HDFS Acl setup"); Threads.sleep(3000); }
Source:
<code>public void checkThatTypeDeclarationRetrievedFromDataTypeFragmentImplementsMostSpecializedTypeDeclarationInterface() throws IOException { File input = new File("src/test/resources/org/raml/v2/api/v10/xml-external/input.raml"); assertTrue(input.isFile()); RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(input); assertFalse(ramlModelResult.hasErrors()); Api apiV10 = ramlModelResult.getApiV10(); <START> Assert.assertTrue(((XMLTypeDeclaration) apiV10.resources().get(0).methods().get(0).body().get(0)).schemaPath().endsWith("person-schema.xsd")); <END> }</code><technical_language>A approach checking if schema path is right compared raml path src/test/resources/org/raml/v2/api/v10/xml-external/input.raml</technical_language>

Target:
public void checkThatTypeDeclarationRetrievedFromDataTypeFragmentImplementsMostSpecializedTypeDeclarationInterface() throws IOException { File input = new File("src/test/resources/org/raml/v2/api/v10/xml-external/input.raml"); Assert.assertTrue(input.isFile()); RamlModelResult ramlModelResult = new RamlModelBuilder().buildApi(input); Assert.assertTrue(ramlModelResult.hasErrors()); Api apiV10 = ramlModelResult.getApiV10(); Assert.assertTrue(((XMLTypeDeclaration) apiV10.resources().get(0).methods().get(0).body().get(0)).schemaPath().endsWith("person-schema.xsd")); }
Source:
<code>public static DateTime fromServerFormatted(String date) { StringBuilder builder = new StringBuilder(); <START> builder.append(date); <END> int periodIndex = date.lastIndexOf("."); int zIndex = date.lastIndexOf("Z"); if (zIndex < 0) { builder.append("Z"); zIndex = date.length(); } if (periodIndex < 0) { builder.insert(zIndex, "."); periodIndex = zIndex; zIndex++; } date = builder.toString(); String millis = date.substring(periodIndex + 1, zIndex); millis = getPaddedMilliseconds(millis); builder.replace(periodIndex + 1, zIndex, millis); date = builder.toString(); DateTime dateTime = null; try { dateTime = DateTime.parse(date, FORMATTER_FROM_SERVER); } catch (IllegalArgumentException e) { Log.e(TAG, "Server sent an invalid date format: " + date, e); } return dateTime; }</code><technical_language>I StringBuilder constructor takes in a String</technical_language>

Target:
public static DateTime fromServerFormatted(String date) { StringBuilder builder = new StringBuilder(date); int periodIndex = date.lastIndexOf("."); int zIndex = date.lastIndexOf("Z"); if (zIndex < 0) { builder.append("Z"); zIndex = date.length(); } if (periodIndex < 0) { builder.insert(zIndex, "."); periodIndex = zIndex; zIndex++; } date = builder.toString(); String millis = date.substring(periodIndex + 1, zIndex); millis = getPaddedMilliseconds(millis); builder.replace(periodIndex + 1, zIndex, millis); date = builder.toString(); DateTime dateTime = null; try { dateTime = DateTime.parse(date, FORMATTER_FROM_SERVER); } catch (IllegalArgumentException e) { Log.e(TAG, "Server sent an invalid date format: " + date, e); } return dateTime; }
Source:
<code>public void whenSchemaHasRefToOtherSchemaRootItShouldLoadTheTypes() throws Exception { URL jsonSchemaResource = getClass().getClassLoader().getResource("jsonSchema/jsonSchemaWithRefToRoot.json"); MetaDataModel metaDataModel = modelFactory.buildModel(jsonSchemaResource); Assert.assertThat(metaDataModel, CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); DefaultStructuredMetadataModel model = (DefaultStructuredMetadataModel) metaDataModel; <START> Assert.assertThat(model.getFields().size(), CoreMatchers.is(1)); <END> Assert.assertThat(model.getFields().get(0).getName(), CoreMatchers.is("position")); Assert.assertThat(model.getFields().get(0).getMetaDataModel().getDataType(), CoreMatchers.is(DataType.JSON)); Assert.assertThat(model.getFields().get(0).getMetaDataModel(), CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); assertWarehouseLocationModel((DefaultStructuredMetadataModel) model.getFields().get(0).getMetaDataModel()); }</code><technical_language>IsCollectionWithSize matcher</technical_language>

Target:
public void whenSchemaHasRefToOtherSchemaRootItShouldLoadTheTypes() throws Exception { URL jsonSchemaResource = getClass().getClassLoader().getResource("jsonSchema/jsonSchemaWithRefToRoot.json"); MetaDataModel metaDataModel = modelFactory.buildModel(jsonSchemaResource); Assert.assertThat(metaDataModel, CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); DefaultStructuredMetadataModel model = (DefaultStructuredMetadataModel) metaDataModel; Assert.assertThat(model.getFields(), IsCollectionWithSize.hasSize(1)); Assert.assertThat(model.getFields().get(0).getName(), CoreMatchers.is("position")); Assert.assertThat(model.getFields().get(0).getMetaDataModel().getDataType(), CoreMatchers.is(DataType.JSON)); Assert.assertThat(model.getFields().get(0).getMetaDataModel(), CoreMatchers.instanceOf(DefaultStructuredMetadataModel.class)); assertWarehouseLocationModel((DefaultStructuredMetadataModel) model.getFields().get(0).getMetaDataModel()); }
Source:
<code>public void renderHead(final IHeaderResponse response) { super.renderHead(response); final List<HeaderItem> depItemList = new ArrayList<>(); final JavaScriptContentHeaderItem chartScriptItem = new JavaScriptContentHeaderItem(toJavaScript(), getScriptId(), null) { @Override public List<HeaderItem> getDependencies() { return depItemList; } }; if (loader == null) { <START> response.render(JavaScriptHeaderItem.forUrl(LOADER_URL)); <END> } else { depItemList.add(loader.getHeaderItem()); } response.render(chartScriptItem); if (responsive) { final JavaScriptReferenceHeaderItem jQueryHeaderItem = JavaScriptHeaderItem.forReference( getApplication().getJavaScriptLibrarySettings().getJQueryReference()); response.render(new JavaScriptContentHeaderItem(createRedrawJavaScript(), getRedrawScriptId(), null) { @Override public List<HeaderItem> getDependencies() { final List<HeaderItem> dependencies = super.getDependencies(); dependencies.add(jQueryHeaderItem); return dependencies; } }); } }</code><technical_language>cerateLoaderItem()</technical_language>

Target:
public void renderHead(final IHeaderResponse response) { super.renderHead(response); final List<HeaderItem> depItemList = new ArrayList<>(); final JavaScriptContentHeaderItem chartScriptItem = new JavaScriptContentHeaderItem(toJavaScript(), getScriptId(), null) { private static final long serialVersionUID = 1L; @Override public List<HeaderItem> getDependencies() { return depItemList; } }; if (loader == null) { response.render(createLoaderItem()); } else { depItemList.add(loader.getHeaderItem()); } response.render(chartScriptItem); if (responsive) { final JavaScriptReferenceHeaderItem jQueryHeaderItem = JavaScriptHeaderItem.forReference( getApplication().getJavaScriptLibrarySettings().getJQueryReference()); response.render(new JavaScriptContentHeaderItem(createRedrawJavaScript(), getRedrawScriptId(), null) { private static final long serialVersionUID = 1L; @Override public List<HeaderItem> getDependencies() { final List<HeaderItem> dependencies = super.getDependencies(); dependencies.add(jQueryHeaderItem); return dependencies; } }); } }
Source:
<code>public void VisualEditorEditing_002_delete() { String removeText = "Lorem"; ArticlePageObject article = base.openArticleByName(wikiURL, articleName); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); ve.removeText(removeText); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges(); reviewDialog.verifyDeletedDiffs(wikiTexts); saveDialog = reviewDialog.clickReturnToSaveFormButton(); article = saveDialog.savePage(); article.verifyVEPublishComplete(); <START> article.logOut(wikiURL); <END> }</code><technical_language>do need logout end</technical_language>

Target:
public void VisualEditorEditing_002_delete() { String removeText = "Lorem"; ArticlePageObject article = base.openArticleByName(wikiURL, articleName); VisualEditorPageObject ve = article.openVEModeWithMainEditButton(); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); ve.removeText(removeText); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); VisualEditorReviewChangesDialog reviewDialog = saveDialog.clickReviewYourChanges(); reviewDialog.verifyDeletedDiffs(wikiTexts); saveDialog = reviewDialog.clickReturnToSaveFormButton(); article = saveDialog.savePage(); article.verifyVEPublishComplete(); }
Source:
<code>public BitArray encode() { State initialState = State.INITIAL_STATE; <START> if (null != charset) { <END> CharacterSetECI eci = CharacterSetECI.getCharacterSetECI(charset); if (null == eci) { throw new IllegalArgumentException("No ECI code for character set " + charset.toString()); } initialState = initialState.appendFLGn(eci.getValue()); } Collection<State> states = Collections.singletonList(initialState); for (int index = 0; index < text.length; index++) { int pairCode; int nextChar = index + 1 < text.length ? text[index + 1] : 0; switch (text[index]) { case '\r': pairCode = nextChar == '\n' ? 2 : 0; break; case '.' : pairCode = nextChar == ' ' ? 3 : 0; break; case ',' : pairCode = nextChar == ' ' ? 4 : 0; break; case ':' : pairCode = nextChar == ' ' ? 5 : 0; break; default: pairCode = 0; } if (pairCode > 0) { states = updateStateListForPair(states, index, pairCode); index++; } else { states = updateStateListForChar(states, index); } } State minState = Collections.min(states, new Comparator<State>() { @Override public int compare(State a, State b) { return a.getBitCount() - b.getBitCount(); } }); return minState.toBitArray(text); }</code><technical_language>Nit: I write foo != null in this code base 2-space indent 4</technical_language>

Target:
public BitArray encode() { State initialState = State.INITIAL_STATE; if (charset != null) { CharacterSetECI eci = CharacterSetECI.getCharacterSetECI(charset); if (null == eci) { throw new IllegalArgumentException("No ECI code for character set " + charset.toString()); } initialState = initialState.appendFLGn(eci.getValue()); } Collection<State> states = Collections.singletonList(initialState); for (int index = 0; index < text.length; index++) { int pairCode; int nextChar = index + 1 < text.length ? text[index + 1] : 0; switch (text[index]) { case '\r': pairCode = nextChar == '\n' ? 2 : 0; break; case '.' : pairCode = nextChar == ' ' ? 3 : 0; break; case ',' : pairCode = nextChar == ' ' ? 4 : 0; break; case ':' : pairCode = nextChar == ' ' ? 5 : 0; break; default: pairCode = 0; } if (pairCode > 0) { states = updateStateListForPair(states, index, pairCode); index++; } else { states = updateStateListForChar(states, index); } } State minState = Collections.min(states, new Comparator<State>() { @Override public int compare(State a, State b) { return a.getBitCount() - b.getBitCount(); } }); return minState.toBitArray(text); }
Source:
<code>private void updateBranches(Sender sender, BranchEvent branchEvent) { BranchEventType eventType = branchEvent.getEventType(); Branch branch = null; try { switch (eventType) { case Committing: case CommitFailed: case Deleting: case Purging: return; case Committed: branch = BranchManager.getBranchByGuid(branchEvent.getBranchGuid()); Artifact artifact = BranchManager.getAssociatedArtifact(branch); TransactionManager.clearCommitArtifactCacheForAssociatedArtifact(artifact); break; case Purged: branch = BranchManager.getBranchByGuid(branchEvent.getBranchGuid()); branch.setBranchState(BranchState.PURGED); branch.setArchived(true); BranchManager.decache(branch); <START> BranchManager.refreshBranches(); <END> break; case Deleted: branch = BranchManager.getBranchByGuid(branchEvent.getBranchGuid()); branch.setBranchState(BranchState.DELETED); branch.setArchived(true); BranchManager.decache(branch); BranchManager.refreshBranches(); break; default: break; } BranchManager.refreshBranches(); } catch (Exception ex) { EventUtil.eventLog("REM: updateBranches", ex); } }</code><technical_language>do need refresh branches in addition setting of branch State ? I need call branch.clearDirty setting purged too</technical_language>

Target:
private void updateBranches(Sender sender, BranchEvent branchEvent) { BranchEventType eventType = branchEvent.getEventType(); Branch branch = null; try { switch (eventType) { case Committing: case CommitFailed: case Deleting: case Purging: return; case Committed: branch = BranchManager.getBranchByGuid(branchEvent.getBranchGuid()); Artifact artifact = BranchManager.getAssociatedArtifact(branch); TransactionManager.clearCommitArtifactCacheForAssociatedArtifact(artifact); break; case Purged: branch = BranchManager.getBranchByGuid(branchEvent.getBranchGuid()); branch.setBranchState(BranchState.PURGED); branch.setArchived(true); branch.clearDirty(); BranchManager.decache(branch); break; case Deleted: branch = BranchManager.getBranchByGuid(branchEvent.getBranchGuid()); branch.setBranchState(BranchState.DELETED); branch.setArchived(true); branch.clearDirty(); BranchManager.decache(branch); break; default: break; } BranchManager.refreshBranches(); } catch (Exception ex) { EventUtil.eventLog("REM: updateBranches", ex); } }
Source:
<code>private boolean inSameLogicalSlotSharingGroup( final ExecutionVertexID executionVertexId1, final ExecutionVertexID executionVertexId2) { final SlotSharingGroupId slotSharingGroupId1 = slotSharingGroupMap.get(executionVertexId1.getJobVertexId()); final SlotSharingGroupId slotSharingGroupId2 = slotSharingGroupMap.get(executionVertexId2.getJobVertexId()); <START> return slotSharingGroupId1 != null && slotSharingGroupId1.equals(slotSharingGroupId2); <END> }</code><technical_language>suggestion return Objects.equals(slotSharingGroupId1, slotSharingGroupId2);</technical_language>

Target:
private boolean inSameLogicalSlotSharingGroup( final ExecutionVertexID executionVertexId1, final ExecutionVertexID executionVertexId2) { return Objects.equals(getSlotSharingGroupId(executionVertexId1), getSlotSharingGroupId(executionVertexId2)); }
Source:
<code><START> public RepositoryCommitRequestBuilder(String repositoryId) { <END> this.repositoryId = repositoryId; }</code><technical_language>Please change API visibility. Thanks</technical_language>

Target:
protected RepositoryCommitRequestBuilder(String repositoryId) { this.repositoryId = repositoryId; }
Source:
<code>public void testProcessScheduledMessageFailed() { final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK; final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); final Date scheduledRetryTime = calendar.getTime(); final RetryHeader retryHeader = new RetryHeader(this.getMaxRetryCount, this.getMaxRetryCount, scheduledRetryTime); final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(DEVICE_MESSAGE_DATA).domain(DOMAIN).domainVersion(DOMAIN_VERSION).result(result) .dataObject(DATA_OBJECT).scheduled(true).retryHeader(retryHeader).build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); <START> when(this.scheduledTaskRepository.findByCorrelationUid(anyString())).thenReturn(scheduledTask); <END> this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender, times(1)).send(message); verify(this.scheduledTaskRepository, times(1)).delete(scheduledTask); }</code><technical_language>for findByCorrelationUid specific possible. string, exact string "correlationId" is meant here</technical_language>

Target:
public void testProcessScheduledMessageFailed() { final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK; final Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 1); final Date scheduledRetryTime = calendar.getTime(); final RetryHeader retryHeader = new RetryHeader(1, 1, scheduledRetryTime); final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(DEVICE_MESSAGE_DATA).domain(DOMAIN).domainVersion(DOMAIN_VERSION).result(result) .dataObject(DATA_OBJECT).scheduled(true).retryHeader(retryHeader).build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); when(this.scheduledTaskRepository.findByCorrelationUid(anyString())).thenReturn(scheduledTask); this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender).send(message); verify(this.scheduledTaskRepository).delete(scheduledTask); }
Source:
<code>public void channelRead0(ChannelHandlerContext ctx, Batch batch) throws Exception { logger.debug("Received a new payload"); processing.compareAndSet(false, true); for(Message message : batch.getMessages()) { <START> if(logger.isDebugEnabled()) <END> logger.debug("Sending a new message for the listener, sequence: " + message.getSequence()); messageListener.onNewMessage(ctx, message); if(needAck(message)) { ack(ctx, message); } } ctx.flush(); processing.compareAndSet(true, false); }</code><technical_language>add { } this</technical_language>

Target:
public void channelRead0(ChannelHandlerContext ctx, Batch batch) throws Exception { logger.debug("Received a new payload"); processing.compareAndSet(false, true); for(Message message : batch.getMessages()) { if(logger.isDebugEnabled()) { logger.debug("Sending a new message for the listener, sequence: " + message.getSequence()); } messageListener.onNewMessage(ctx, message); if(needAck(message)) { ack(ctx, message); } } ctx.flush(); processing.compareAndSet(true, false); }
Source:
<code>private void initEditors() { daysEditor = new ListModelCheckBoxGroupEditor<>(new AbstractRenderer<StorageSyncSchedule.Day>() { @Override public String render(StorageSyncSchedule.Day object) { return object.toString().substring(0, 3); } }); frequencyEditor = new ListModelListBoxEditor<>(new AbstractRenderer<StorageSyncSchedule.Frequency>() { @Override public String render(StorageSyncSchedule.Frequency object) { return EnumTranslator.getInstance().translate(object); } }); geoRepSessionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<GlusterGeoRepSession>() { @Override protected String renderNullSafe(GlusterGeoRepSession geoRepSession) { if (geoRepSession == null) { return <START> ""; END> } else { return geoRepSession.getSlaveHostName() + "::" + geoRepSession.getSlaveVolumeName(); } } }); hoursEditor = new ListModelListBoxEditor<>(); minsEditor = new ListModelListBoxEditor<>(); }</code><technical_language>plz StringUtils.EMPTY</technical_language>

Target:
private void initEditors() { daysEditor = new ListModelCheckBoxGroupEditor<>(new AbstractRenderer<StorageSyncSchedule.Day>() { @Override public String render(StorageSyncSchedule.Day object) { return object.toString().substring(0, 3); } }); frequencyEditor = new ListModelListBoxEditor<>(new AbstractRenderer<StorageSyncSchedule.Frequency>() { @Override public String render(StorageSyncSchedule.Frequency object) { return EnumTranslator.getInstance().translate(object); } }); geoRepSessionEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<GlusterGeoRepSession>() { @Override protected String renderNullSafe(GlusterGeoRepSession geoRepSession) { if (geoRepSession == null) { return StringUtils.EMPTY; } else { return messages.geoRepRemoteSessionName(geoRepSession.getSlaveHostName(), geoRepSession.getSlaveVolumeName()); } } }); hoursEditor = new ListModelListBoxEditor<>(); minsEditor = new ListModelListBoxEditor<>(); }
Source:
<code>public MethodNode getMain() { for (MethodNode m : methods) { if (m.getSelector().equals("main")) { return m; } } <START> return null; <END> }</code><technical_language>return null - throw exception if main is defined? pretend a no-op main method</technical_language>

Target:
public MethodNode getMain() { for (MethodNode m : methods) { if (m.getSelector().equals("main")) { return m; } } throw new MainMethodNotFoundException(); }
Source:
<code>public void <START> publishCommand(@NonNull <END> byte[] data) { for (CommandSubscriber subscriber : mSubscribers) { subscriber.receiveCommand(data); } }</code><technical_language>protected + final is for subclasses</technical_language>

Target:
public final void publishCommand(@NonNull byte[] data) { if (mListener != null) { mListener.receiveCommand(data); } }
Source:
<code>public ClockSkewEvents(MetricRegistry metricRegistry) { <START> this.metricRegistry = metricRegistry; <END> this.clockSkew = metricRegistry.histogram("clock.skew"); this.clockWentBackwards = metricRegistry.counter("clock.went-backwards"); this.exception = metricRegistry.counter("clock.monitor-exception"); }</code><technical_language>remove this this point. anymore</technical_language>

Target:
public ClockSkewEvents(MetricRegistry metricRegistry) { this.clockSkew = metricRegistry.histogram("clock.skew"); this.clockWentBackwards = metricRegistry.counter("clock.went-backwards"); this.exception = metricRegistry.counter("clock.monitor-exception"); }
Source:
<code>public void fetchAvailableEngineSettings(RepositoryDTO repositoryDTO, Consumer<Map<String, List<EngineSetting>>> callback, Consumer<Exception> errorCallback) { Map<String, List<EngineSetting>> settings = new HashMap<>(); List<CategoryDTO> categoryDTOS = new ArrayList<>(); for (TypeDTO typeDTO : repositoryDTO.getTypes()) { if (typeDTO.getId().equals("engines")) { categoryDTOS = typeDTO.getCategories(); } } for (CategoryDTO engine : categoryDTOS) { final String engineId = engine.getId(); settings.put(engineId, new ArrayList<>()); for (ApplicationDTO applicationDTO : engine.getApplications()) { <START> if (applicationDTO.getId().equals("settings")) { <END> for (ScriptDTO scriptDTO : applicationDTO.getScripts()) { this.getSetting(engineId, scriptDTO.getId(), setting -> settings.get(engineId).add(setting), errorCallback); } } } } callback.accept(settings); }</code><technical_language>This id insider knowledge me. Is another identify settings applications</technical_language>

Target:
public void fetchAvailableEngineSettings(RepositoryDTO repositoryDTO, Consumer<Map<String, List<EngineSetting>>> callback, Consumer<Exception> errorCallback) { final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession(); interactiveScriptSession.eval(this.getFetchScript(repositoryDTO), output -> callback.accept((Map<String, List<EngineSetting>>) output), errorCallback); }
Source:
<code>protected ModuleRuntimeContainers retrieveModuleRuntimeContainers(String streamName) { ModuleRuntimeContainers containers = new ModuleRuntimeContainers(); for (ModuleMetadataResource module : distributedTestSupport.ensureTemplate() .runtimeOperations().listRuntimeModules()) { String moduleId = module.getModuleId(); if (moduleId.contains(streamName)) { if (moduleId.contains("source")) { containers.addSourceContainer(module.getContainerId()); } <START> else if (moduleId.contains("sink")) { <END> containers.addSinkContainer(module.getContainerId()); } } } assertTrue(containers.toString(), containers.isComplete()); return containers; }</code><technical_language>some point, need add awareness of "processor containers" well, in case more deployed instance processor module, multiple processor modules stream</technical_language>

Target:
protected ModuleRuntimeContainers retrieveModuleRuntimeContainers(String streamName) { ModuleRuntimeContainers containers = new ModuleRuntimeContainers(); for (ModuleMetadataResource module : distributedTestSupport.ensureTemplate() .runtimeOperations().listRuntimeModules()) { String moduleId = module.getModuleId(); if (moduleId.contains(streamName)) { if (moduleId.contains("source")) { containers.addSourceContainer(module.getContainerId()); } else if (moduleId.contains("sink")) { containers.addSinkContainer(module.getContainerId()); } } } assertTrue(String.format("A source and/or sink module is missing from %s", containers), containers.isComplete()); return containers; }
Source:
<code>public CryptoInputStream( Input input, Cipher cipher, int bufferSize, byte[] key, byte[] iv) throws IOException { this.input = input; this.cipher = cipher; this.bufferSize = Utils.checkBufferSize(cipher, bufferSize); this.key = key.clone(); this.initIV = iv.clone(); this.iv = iv.clone(); inBuffer = ByteBuffer.allocateDirect(this.bufferSize); outBuffer = ByteBuffer.allocateDirect(this.bufferSize + cipher.getTransformation().getAlgorithmBlockSize()); inBuffer.clear(); outBuffer.clear(); outBuffer.limit(0); <START> initCipher(); <END> }</code><technical_language>questions changes: need clear inBuffer outBuffer? allocated in L111-L112. If need clear them, do need do this in CryptoOutputStream well</technical_language>

Target:
public CryptoInputStream( Input input, Cipher cipher, int bufferSize, byte[] key, byte[] iv) throws IOException { this.input = input; this.cipher = cipher; this.bufferSize = Utils.checkBufferSize(cipher, bufferSize); this.key = key.clone(); this.initIV = iv.clone(); this.iv = iv.clone(); inBuffer = ByteBuffer.allocateDirect(this.bufferSize); outBuffer = ByteBuffer.allocateDirect(this.bufferSize + cipher.getTransformation().getAlgorithmBlockSize()); outBuffer.limit(0); initCipher(); }
Source:
<code>private <T> void createDeleteContainerWithSameName(Consumer<CosmosAsyncContainer> validateFunc) throws InterruptedException { CosmosAsyncContainer container = null; try { String testContainerId = UUID.randomUUID().toString(); CosmosContainerProperties containerProperties = getCollectionDefinition(testContainerId); container = createCollection(this.createdDatabase, containerProperties, new CosmosContainerRequestOptions()); validateFunc.accept(container); safeDeleteCollection(container); <START> Thread.sleep(2000); <END> container = createCollection(this.createdDatabase, containerProperties, new CosmosContainerRequestOptions()); validateFunc.accept(container); } finally { safeDeleteCollection(container); } }</code><technical_language>worth this a constant a quick explanation for is needed (emulator's deletes instantaneous)</technical_language>

Target:
private <T> void createDeleteContainerWithSameName(Consumer<CosmosAsyncContainer> validateFunc) throws InterruptedException { CosmosAsyncContainer container = null; try { String testContainerId = UUID.randomUUID().toString(); CosmosContainerProperties containerProperties = getCollectionDefinition(testContainerId); container = createCollection(this.createdDatabase, containerProperties, new CosmosContainerRequestOptions()); validateFunc.accept(container); safeDeleteCollection(container); Thread.sleep(COLLECTION_RECREATION_TIME_DELAY); container = createCollection(this.createdDatabase, containerProperties, new CosmosContainerRequestOptions()); validateFunc.accept(container); } finally { safeDeleteCollection(container); } }
Source:
<code>private static String getEmailChangeConfirmationLink(String email, String password) { String mailSubject = "Confirm your email address change on Fandom"; <START> String url = MailFunctions.getActivationLinkFromEmailContent( <END> MailFunctions.getFirstEmailContent(email, password, mailSubject)); PageObjectLogging.log("getActivationLinkFromMail", "activation link is visible in email content: " + url, true); return url; }</code><technical_language>MailUtils slightly better, much. split this class smaller names</technical_language>

Target:
private static String getEmailChangeConfirmationLink(String email, String password) { String mailSubject = "Confirm your email address change on Fandom"; String url = EmailUtils.getActivationLinkFromEmailContent( EmailUtils.getFirstEmailContent(email, password, mailSubject)); PageObjectLogging.log("getActivationLinkFromMail", "activation link is visible in email content: " + url, true); return url; }
Source:
<code>public String createString(final String key, final int value) { <START> return createString(key, "" + value); <END> }</code><technical_language>I prefer String.valueOf(value)</technical_language>

Target:
public String createString(final String key, final int value) { return createString(key, String.valueOf(value)); }
Source:
<code><START> public String buildSqlSelect(DbMapComponent component, String outputTableName) { <END> boolean checkUseUpdateStatement = checkUseUpdateStatement(component, outputTableName); if (checkUseUpdateStatement) { return buildSqlSelect(component, outputTableName, DEFAULT_TAB_SPACE_STRING, checkUseUpdateStatement); } else { return buildSqlSelect(component, outputTableName, DEFAULT_TAB_SPACE_STRING); } }</code><technical_language>need this function in this class</technical_language>

Target:
public String buildSqlSelect(DbMapComponent component, String outputTableName) { boolean checkUseUpdateStatement = checkUseUpdateStatement(component, outputTableName); if (checkUseUpdateStatement) { return buildSqlUpdate(component, outputTableName, DEFAULT_TAB_SPACE_STRING); } else { return super.buildSqlSelect(component, outputTableName, DEFAULT_TAB_SPACE_STRING); } }
Source:
<code>public void filter() { Assert.assertNull("null list must result in null", ListUtils.filter(null, null)); Assert.assertNull("null list must result in null, even if the filter is not null", ListUtils.filter(null, null)); Assert.assertTrue("empty list must be an empty list", ListUtils.filter(new ArrayList<String>(), null).isEmpty()); Assert.assertTrue("empty list must be an empty list", ListUtils.filter(new ArrayList<String>(), new ListUtils.Filter<String>() { @Override public List<String> filter(List<String> data) { return data; } }).isEmpty()); List<String> testList = new ArrayList<>(); testList.add("bla"); testList.add("bli"); testList.add("blu"); testList.add("blo"); testList.add("foo"); testList.add("bar"); List<String> filtered = ListUtils.filter(testList, new ListUtils.PredicateFilter<>(new ListUtils.Predicate<String>() { @Override public boolean evaluate(String obj) { return obj.endsWith("a"); } })); Assert.assertEquals("only one <START> elem#ent should <END> match the criteria", 1, filtered.size()); Assert.assertEquals("and it should be 'bla'", "bla", filtered.get(0)); }</code><technical_language>Redundant, please remove</technical_language>

Target:
public void filter() { Assert.assertNull("null list must result in null", ListUtils.filter(null, null)); Assert.assertNull("null list must result in null, even if the filter is not null", ListUtils.filter(null, null)); Assert.assertTrue("empty list must be an empty list", ListUtils.filter(new ArrayList<String>(), null).isEmpty()); Assert.assertTrue("empty list must be an empty list", ListUtils.filter(new ArrayList<String>(), new ListUtils.Filter<String>() { @Override public List<String> filter(List<String> data) { return data; } }).isEmpty()); List<String> testList = new ArrayList<>(); testList.add("bla"); testList.add("bli"); testList.add("blu"); testList.add("blo"); testList.add("foo"); testList.add("bar"); List<String> filtered = ListUtils.filter(testList, new ListUtils.PredicateFilter<>(new ListUtils.Predicate<String>() { @Override public boolean evaluate(String obj) { return obj.endsWith("a"); } })); Assert.assertEquals("only one element should match the criteria", 1, filtered.size()); Assert.assertEquals("and it should be 'bla'", "bla", filtered.get(0)); }
Source:
<code>public void handleMessageLog(TelemetryMessageLog messageLog) { LOG.debug("Received telemetry messages", messageLog.getMessageList().size()); final List<P> flowPackets = new LinkedList<>(); final List<Flow> flows = new LinkedList<>(); try (Timer.Context ctx = logParsingTimer.time()) { for (TelemetryMessageLogEntry eachMessage : messageLog.getMessageList()) { LOG.trace("Parsing packet: {}", eachMessage); final P flowPacket = parse(eachMessage); if (flowPacket != null) { flowPackets.add(flowPacket); flows.addAll(converter.convert(flowPacket)); } } packetsPerLogHistogram.update(flowPackets.size()); } try { LOG.debug("Persisting packets, flows.", flowPackets.size(), flows.size()); final FlowSource source = new FlowSource(messageLog.getLocation(), messageLog.getSourceAddress(), <START> Strings.isNullOrEmpty(metaDataNodeLookup) ? null : new ContextKey(metaDataNodeLookup)); <END> flowRepository.persist(flows, source); } catch (DetailedFlowException ex) { LOG.error("Error while persisting flows: {}", ex.getMessage(), ex); for (final String logMessage: ex.getDetailedLogMessages()) { LOG.error(logMessage); } } catch(UnrecoverableFlowException ex) { LOG.error("Error while persisting flows. Cannot recover: {}. messages are lost.", ex.getMessage(), messageLog.getMessageList().size(), ex); return; } catch (FlowException ex) { LOG.error("Error while persisting flows: {}", ex.getMessage(), ex); } LOG.debug("Completed processing telemetry messages.", messageLog.getMessageList().size()); }</code><technical_language>store ContextKey object in a local variable rebuilding for log processed</technical_language>

Target:
public void handleMessageLog(TelemetryMessageLog messageLog) { LOG.debug("Received telemetry messages", messageLog.getMessageList().size()); final List<P> flowPackets = new LinkedList<>(); final List<Flow> flows = new LinkedList<>(); try (Timer.Context ctx = logParsingTimer.time()) { for (TelemetryMessageLogEntry eachMessage : messageLog.getMessageList()) { LOG.trace("Parsing packet: {}", eachMessage); final P flowPacket = parse(eachMessage); if (flowPacket != null) { flowPackets.add(flowPacket); flows.addAll(converter.convert(flowPacket)); } } packetsPerLogHistogram.update(flowPackets.size()); } try { LOG.debug("Persisting packets, flows.", flowPackets.size(), flows.size()); final FlowSource source = new FlowSource(messageLog.getLocation(), messageLog.getSourceAddress(), contextKey); flowRepository.persist(flows, source); } catch (DetailedFlowException ex) { LOG.error("Error while persisting flows: {}", ex.getMessage(), ex); for (final String logMessage: ex.getDetailedLogMessages()) { LOG.error(logMessage); } } catch(UnrecoverableFlowException ex) { LOG.error("Error while persisting flows. Cannot recover: {}. messages are lost.", ex.getMessage(), messageLog.getMessageList().size(), ex); return; } catch (FlowException ex) { LOG.error("Error while persisting flows: {}", ex.getMessage(), ex); } LOG.debug("Completed processing telemetry messages.", messageLog.getMessageList().size()); }
Source:
<code>private boolean entitySupportRetry(HttpRequest request) { <START> boolean entitySupportRetry = true; <END> if (request.getEntity() != null) { if (request.getEntity() instanceof InputStreamHttpEntity) { entitySupportRetry = ((InputStreamHttpEntity) request.getEntity()).getInputStream().markSupported(); } } return entitySupportRetry; }</code><technical_language>unify conditions this method clearer. Return true false that</technical_language>

Target:
private boolean entitySupportRetry(HttpRequest request) { boolean entitySupportRetry = true; if (request.getEntity() != null && request.getEntity() instanceof InputStreamHttpEntity) { entitySupportRetry = ((InputStreamHttpEntity) request.getEntity()).getInputStream().markSupported(); } return entitySupportRetry; }
Source:
<code>private static TypedInput createResponseBody(final ResponseBody body) { <START> if (body == null) { <END> return null; } return new TypedInput() { @Override public String mimeType() { return body.contentType().toString(); } @Override public long length() { return body.contentLength(); } @Override public InputStream in() throws IOException { return body.byteStream(); } }; }</code><technical_language>I this is reachable</technical_language>

Target:
private static TypedInput createResponseBody(final ResponseBody body) { if (body.contentLength() == 0) { return null; } return new TypedInput() { @Override public String mimeType() { return body.contentType().toString(); } @Override public long length() { return body.contentLength(); } @Override public InputStream in() throws IOException { return body.byteStream(); } }; }