auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void initialise() { renderingConfig = config.getRendering(); ssaoShader = worldRenderer.getMaterial("engine:prog.ssao"); ssaoBlurredShader = worldRenderer.getMaterial("engine:prog.ssaoBlur"); requireFBO(DefaultDynamicFBOs.ReadOnlyGBuffer); requireDynamicFBO(new FBOConfig(SSAO_URN, 1.0f, FBO.Type.DEFAULT)); <START> requireDynamicFBO(new FBOConfig(SSAO_BLURRED_URN, 1.0f, FBO.Type.DEFAULT)); <END> }</code><technical_language>magic numbers! =) Set a "float scalingFactor = 1.0;" variable please</technical_language>

Target:
public void initialise() { renderingConfig = config.getRendering(); ssaoShader = worldRenderer.getMaterial("engine:prog.ssao"); ssaoBlurredShader = worldRenderer.getMaterial("engine:prog.ssaoBlur"); requiresFBO(new FBOConfig(SSAO, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); requiresFBO(new FBOConfig(SSAO_BLURRED, FULL_SCALE, FBO.Type.DEFAULT), displayResolutionDependentFBOs); }
Source:
<code>public void testUIElements() { setApplicationPath(); WelcomePageBase welcomePage = initPage(getDriver(), WelcomePageBase.class); LoginPageBase loginPage = welcomePage.clickNextBtn(); CarinaDescriptionPageBase carinaDescriptionPage = loginPage.login(); UIElementsPageBase uiElements = carinaDescriptionPage.navigateToUIElementsPage(); uiElements.typeText("some Text"); uiElements.typeDate("22/10/2018"); uiElements.typeEmail("some@email.com"); uiElements.swipeToFemaleRadioButton(); uiElements.checkCopy(); uiElements.clickOnFemaleRadioButton(); uiElements.clickOnOtherRadioButton(); <START> <END> }</code><technical_language>strange verification. Is expected</technical_language>

Target:
public void testUIElements() { WelcomePageBase welcomePage = initPage(getDriver(), WelcomePageBase.class); LoginPageBase loginPage = welcomePage.clickNextBtn(); CarinaDescriptionPageBase carinaDescriptionPage = loginPage.login(); UIElementsPageBase uiElements = carinaDescriptionPage.navigateToUIElementsPage(); final String text = "some text"; final String date = "22/10/2018"; final String email = "some@email.com"; uiElements.typeText(text); Assert.assertEquals(uiElements.getText(), text, "Text was not typed"); uiElements.typeDate(date); Assert.assertEquals(uiElements.getDate(), date, "Date was not typed"); uiElements.typeEmail(email); Assert.assertEquals(uiElements.getEmail(), email, "Email was not typed"); uiElements.swipeToFemaleRadioButton(); uiElements.checkCopy(); Assert.assertTrue(uiElements.isCopyChecked(), "Copy checkbox was not checked"); uiElements.clickOnFemaleRadioButton(); Assert.assertTrue(uiElements.isFemaleRadioButtonSelected(), "Female radio button was not selected!"); uiElements.clickOnOtherRadioButton(); Assert.assertTrue(uiElements.isOthersRadioButtonSelected(), "Others radio button was not selected!"); }
Source:
<code>public PageSet<? extends StorageMetadata> list() { <START> return null; <END> }</code><technical_language>Throw UnsupportedOperationException instead</technical_language>

Target:
public PageSet<? extends StorageMetadata> list() { throw new UnsupportedOperationException(); }
Source:
<code>private void applyProjectsVolumes(List<PodData> podsData, List<HasMetadata> componentObjects) { PersistentVolumeClaim volumeClaim = newPVC(PROJECTS_VOLUME_NAME, "ReadWriteOnce", defaultProjectPVCSize); <START> componentObjects.add(volumeClaim); <END> for (PodData podData : podsData) { if (podData.getSpec() == null) { continue; } Volume volume = newVolume(PROJECTS_VOLUME_NAME, PROJECTS_VOLUME_NAME); podData.getSpec().getVolumes().add(volume); for (Container container : podData.getSpec().getContainers()) { VolumeMount volumeMount = newVolumeMount(PROJECTS_VOLUME_NAME, projectFolderPath, null); container.getVolumeMounts().add(volumeMount); } } }</code><technical_language>Please componentObjects projects PVC</technical_language>

Target:
private void applyProjectsVolumes(List<PodData> podsData, List<HasMetadata> componentObjects) { if (componentObjects .stream() .noneMatch( hasMeta -> hasMeta instanceof PersistentVolumeClaim && hasMeta.getMetadata().getName().equals(PROJECTS_VOLUME_NAME))) { PersistentVolumeClaim volumeClaim = newPVC( PROJECTS_VOLUME_NAME, defaultPVCAccessMode, defaultProjectPVCSize, pvcStorageClassName); componentObjects.add(volumeClaim); } for (PodData podData : podsData) { if (podData .getSpec() .getVolumes() .stream() .noneMatch(volume -> volume.getName().equals(PROJECTS_VOLUME_NAME))) { Volume volume = newVolume(PROJECTS_VOLUME_NAME, PROJECTS_VOLUME_NAME); podData.getSpec().getVolumes().add(volume); } for (Container container : podData.getSpec().getContainers()) { if (container .getVolumeMounts() .stream() .noneMatch(mount -> mount.getName().equals(PROJECTS_VOLUME_NAME))) { VolumeMount volumeMount = newVolumeMount(PROJECTS_VOLUME_NAME, projectFolderPath, null); container.getVolumeMounts().add(volumeMount); } } } }
Source:
<code>public void disableButton(HTMLAnchorElement anchorElement, boolean disabled) { String buttonCssClass = "btn btn-default"; if (disabled) { buttonCssClass += " disabled"; } <START> anchorElement.setAttribute("class", buttonCssClass); <END> }</code><technical_language>manipulate class list using: anchorElement.classList.add(); anchorElement.classList.remove();</technical_language>

Target:
public void disableButton(HTMLAnchorElement anchorElement, boolean disabled) { if (disabled) { anchorElement.classList.add("disabled"); } else { anchorElement.classList.remove("disabled"); } }
Source:
<code>public WorkQueue.Executor get() { CurrentUser user = userProvider.get(); <START> WorkQueue.Executor executor = queues.getInteractiveQueue(); <END> if (user.isBatchUser()) { executor = queues.getBatchQueue(); } return executor; }</code><technical_language>Style-nit: assign replace. Instead a proper if-else: if (user.isBatchUser) { return queues.getBatchQueue(); } else { return queues.getInteractiveQueue(); }</technical_language>

Target:
public WorkQueue.Executor get() { WorkQueue.Executor executor; if (user.isBatchUser()) { executor = queues.getBatchQueue(); } else { executor = queues.getInteractiveQueue(); } return executor; }
Source:
<code>public static void toJSON(OutputWriter outputWriter, List<PipelineConfigs> listOfPipelineConfigs) { <START> List<PipelineConfig> pipelines = listOfPipelineConfigs.stream().flatMap(pipelineConfigs -> pipelineConfigs.getPipelines().stream()).collect(Collectors.toList()); <END> outputWriter.addLinks(linksWriter -> { linksWriter.addLink("self", Routes.Pipeline.INTERNAL_BASE); }).addChild("_embedded", childWriter -> { childWriter.addChildList("pipelines", pipelineConfigWriter -> { pipelines.forEach(pipeline -> { pipelineConfigWriter.addChild(innerChildWriter -> { PipelineConfigWithMinimalAttributesRepresenter.toJSON(innerChildWriter, pipeline); }); }); }); }); }</code><technical_language>Do need stream in pipelineConfigs -> pipelineConfigs.getPipelines().stream()</technical_language>

Target:
public static void toJSON(OutputWriter outputWriter, List<PipelineConfigs> listOfPipelineConfigs) { List<PipelineConfig> pipelines = listOfPipelineConfigs .stream() .map(PipelineConfigs::getPipelines) .flatMap(Collection::stream) .collect(Collectors.toList()); outputWriter.addLinks(linksWriter -> { linksWriter.addLink("self", Routes.Pipeline.INTERNAL_BASE); }).addChild("_embedded", childWriter -> { childWriter.addChildList("pipelines", pipelineConfigWriter -> { pipelines.forEach(pipeline -> { pipelineConfigWriter.addChild(innerChildWriter -> { PipelineConfigWithMinimalAttributesRepresenter.toJSON(innerChildWriter, pipeline); }); }); }); }); }
Source:
<code>public boolean equals(Object obj) { <START> if (!(obj instanceof TypeAndTime)) { <END> return false; } final TypeAndTime obj2 = (TypeAndTime) obj; return (obj2.event.equals(event) && obj2.time.equals(time) ); }</code><technical_language>Please Guava's equal helpers <LINK_0></technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof TypeAndTime)) { return false; } final TypeAndTime obj2 = (TypeAndTime) obj; return Objects.equal(event,obj2.event) && Objects.equal(time,obj2.time); }
Source:
<code>public void canLoadFeedWithErrors () { PersistenceExpectation[] expectations = PersistenceExpectation.list(); ErrorExpectation[] errorExpectations = ErrorExpectation.list( new ErrorExpectation(NewGTFSErrorType.FARE_TRANSFER_MISMATCH, "fare-02"), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, "freq-01_09:00:00_to_10:00:00_every_10m00s"), <START> new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, "freq-01_09:30:00_to_10:30:00_every_15m00s"), <END> new ErrorExpectation(NewGTFSErrorType.TRIP_OVERLAP_IN_BLOCK, "1A00000") ); assertThat( "Integration test passes", runIntegrationTestOnFolder("fake-agency-overlapping-trips", nullValue(), expectations, errorExpectations), equalTo(true) ); }</code><technical_language>I good add 2 more error expectations cover overlaps: Key: |: start end of frequency -: active time of frequency _: frequency active A covers B: A: |---------| B: ___|--|____ B covers A A: ___|--|____ B: |---------| A starts B starts, A ends B starts A ends B ends: A: _|----|____ B: ____|-----| A starts B starts, A starts B ends A: ____|-----| B: _|----|____</technical_language>

Target:
public void canLoadFeedWithErrors () { PersistenceExpectation[] expectations = PersistenceExpectation.list(); ErrorExpectation[] errorExpectations = ErrorExpectation.list( new ErrorExpectation(NewGTFSErrorType.FARE_TRANSFER_MISMATCH, equalTo("fare-02")), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, equalTo("freq-01_08:30:00_to_10:15:00_every_15m00s")), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP, equalTo("freq-01_08:30:00_to_10:15:00_every_15m00s")), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.FREQUENCY_PERIOD_OVERLAP), new ErrorExpectation(NewGTFSErrorType.TRIP_OVERLAP_IN_BLOCK, equalTo("1A00000")) ); assertThat( "Integration test passes", runIntegrationTestOnFolder("fake-agency-overlapping-trips", nullValue(), expectations, errorExpectations), equalTo(true) ); }
Source:
<code><START> public static <END> String getLineIndentation(IDocument document, int offset) throws BadLocationException { int adjustedOffset= (offset == document.getLength() ? offset - 1 : offset); IRegion line= document.getLineInformationOfOffset(adjustedOffset); int start= line.getOffset(); int end= findEndOfWhiteSpace(document, start, offset + line.getLength()); return document.get(start, end - start); }</code><technical_language>class. private</technical_language>

Target:
private static String getLineIndentation(IDocument document, int offset) throws BadLocationException { int adjustedOffset= (offset == document.getLength() ? offset - 1 : offset); IRegion line= document.getLineInformationOfOffset(adjustedOffset); int start= line.getOffset(); int end= findEndOfWhiteSpace(document, start, offset + line.getLength()); return document.get(start, end - start); }
Source:
<code>public Pair<List<? extends UsageVO>, Integer> getUsageRecordsPendingQuotaAggregation(final long accountId, final long domainId) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); TransactionLegacy.open(TransactionLegacy.USAGE_DB).close(); <START> s_logger.debug("getting usage records for account: " + accountId + ", domainId: " + domainId); <END> Filter usageFilter = new Filter(UsageVO.class, "startDate", true, 0L, 10000L); SearchCriteria<UsageVO> sc = createSearchCriteria(); if (accountId != -1) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); } if (domainId != -1) { sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); } sc.addAnd("quotaCalculated", SearchCriteria.Op.NULL); sc.addOr("quotaCalculated", SearchCriteria.Op.EQ, 0); s_logger.debug("Getting usage records" + usageFilter.getOrderBy()); Pair<List<UsageVO>, Integer> usageRecords = searchAndCountAllRecords(sc, usageFilter); TransactionLegacy.open(opendb).close(); return new Pair<List<? extends UsageVO>, Integer>(usageRecords.first(), usageRecords.second()); }</code><technical_language>Debug logging statements wrapped in a if (s_logger.isDebugEnabled()) check avoid overhead of string concatenation debug logging is enabled</technical_language>

Target:
public Pair<List<? extends UsageVO>, Integer> getUsageRecordsPendingQuotaAggregation(final long accountId, final long domainId) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); TransactionLegacy.open(TransactionLegacy.USAGE_DB).close(); if (s_logger.isDebugEnabled()){ s_logger.debug("getting usage records for account: " + accountId + ", domainId: " + domainId); } Filter usageFilter = new Filter(UsageVO.class, "startDate", true, 0L, 10000L); SearchCriteria<UsageVO> sc = createSearchCriteria(); if (accountId != -1) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); } if (domainId != -1) { sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); } sc.addAnd("quotaCalculated", SearchCriteria.Op.NULL); sc.addOr("quotaCalculated", SearchCriteria.Op.EQ, 0); if (s_logger.isDebugEnabled()){ s_logger.debug("Getting usage records" + usageFilter.getOrderBy()); } Pair<List<UsageVO>, Integer> usageRecords = searchAndCountAllRecords(sc, usageFilter); TransactionLegacy.open(opendb).close(); return new Pair<List<? extends UsageVO>, Integer>(usageRecords.first(), usageRecords.second()); }
Source:
<code>private StackV4Request getStackRequest(SdxClusterRequest sdxClusterRequest, StackV4Request internalStackV4Request, CloudPlatform cloudPlatform, String runtimeVersion) { if (internalStackV4Request == null) { StackV4Request stackRequest = cdpConfigService.getConfigForKey( new CDPConfigKey(cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion)); if (stackRequest == null) { LOGGER.error("Can't find template for cloudplatform: {}, shape {}, cdp version: {}", cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion); throw new BadRequestException("Can't find template for cloudplatform: " + cloudPlatform + ", shape: " + sdxClusterRequest.getClusterShape() + ", runtime version: " + runtimeVersion); } updateStackV4RequestWithIDBrokerVolume(stackRequest); stackRequest.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return stackRequest; } else { <START> updateStackV4RequestWithIDBrokerVolume(internalStackV4Request); <END> internalStackV4Request.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return internalStackV4Request; } }</code><technical_language>I if relying custom DL templates pissed this change if expected volume present (for reason). I committing a change overwriting RAZ flag a lines below</technical_language>

Target:
private StackV4Request getStackRequest(SdxClusterRequest sdxClusterRequest, StackV4Request internalStackV4Request, CloudPlatform cloudPlatform, String runtimeVersion) { if (internalStackV4Request == null) { StackV4Request stackRequest = cdpConfigService.getConfigForKey( new CDPConfigKey(cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion)); if (stackRequest == null) { LOGGER.error("Can't find template for cloudplatform: {}, shape {}, cdp version: {}", cloudPlatform, sdxClusterRequest.getClusterShape(), runtimeVersion); throw new BadRequestException("Can't find template for cloudplatform: " + cloudPlatform + ", shape: " + sdxClusterRequest.getClusterShape() + ", runtime version: " + runtimeVersion); } stackRequest.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return stackRequest; } else { internalStackV4Request.getCluster().setRangerRazEnabled(sdxClusterRequest.isEnableRangerRaz()); return internalStackV4Request; } }
Source:
<code>public void run() { ResourceTransfer resTransfer = ResourceTransfer.getInstance(); IResource[] resourceData = (IResource[]) clipboard.getContents(resTransfer); if (resourceData != null && resourceData.length > 0) { if (resourceData[0].getType() == IResource.PROJECT) { for (IResource <START> element : <END> resourceData) { CopyProjectOperation operation = new CopyProjectOperation(shell); operation.copyProject((IProject) element); } } else { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyResources(resourceData, container); } return; } FileTransfer fileTransfer = FileTransfer.getInstance(); String[] fileData = (String[]) clipboard.getContents(fileTransfer); if (fileData != null) { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyFiles(fileData, container); } }</code><technical_language>rename 'resource'</technical_language>

Target:
public void run() { ResourceTransfer resTransfer = ResourceTransfer.getInstance(); IResource[] resourceData = (IResource[]) clipboard.getContents(resTransfer); if (resourceData != null && resourceData.length > 0) { if (resourceData[0].getType() == IResource.PROJECT) { for (IResource resource : resourceData) { CopyProjectOperation operation = new CopyProjectOperation(shell); operation.copyProject((IProject) resource); } } else { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyResources(resourceData, container); } return; } FileTransfer fileTransfer = FileTransfer.getInstance(); String[] fileData = (String[]) clipboard.getContents(fileTransfer); if (fileData != null) { IContainer container = getContainer(); CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); operation.copyFiles(fileData, container); } }
Source:
<code>private void triggerMatchingPipelines(T event) { try { List<Pipeline> allPipelines = pipelineCache.getPipelinesSync(); List<Pipeline> matchingPipelines = eventHandler.getMatchingPipelines(event, allPipelines); matchingPipelines.stream() .map(pipelineCache::refresh) <START> .map(p -> eventHandler.withMatchingTrigger(event, p)) END> .filter(Optional::isPresent) .map(Optional::get) .map(pipelinePostProcessorHandler::process) .forEach(p -> { recordMatchingPipeline(p); pipelineInitiator.startPipeline(p); }); } catch (TimeoutException e) { log.error("Failed to get pipeline configs", e); } }</code><technical_language>this is re-do trigger matching logic pipeline start. In a lot of cases, is a reasonable amount of logic in withMatchingTrigger. For example, Jenkins triggers call igor get information build completed; asking igor for information completed build pipeline. Is extra traffic/duplicated computation a concern</technical_language>

Target:
private void triggerMatchingPipelines(T event) { try { List<Pipeline> allPipelines = pipelineCache.getPipelinesSync(); List<Pipeline> matchingPipelines = eventHandler.getMatchingPipelines(event, allPipelines); matchingPipelines.stream() .map(pipelinePostProcessorHandler::process) .forEach(p -> { recordMatchingPipeline(p); pipelineInitiator.startPipeline(p); }); } catch (TimeoutException e) { log.error("Failed to get pipeline configs", e); } }
Source:
<code>protected CronWorkflow(String type, WorkflowSettings settings) { super(type, schedule, handleFailure, settings); permit(schedule, doWork); <START> permit(doWork, schedule, handleFailure); <END> permit(handleFailure, schedule); }</code><technical_language>handleFailure needed here, is set defaul error state</technical_language>

Target:
protected CronWorkflow(String type, WorkflowSettings settings) { super(type, schedule, handleFailure, settings); permit(schedule, doWork); permit(doWork, schedule); permit(handleFailure, schedule, failed); }
Source:
<code>private void createStudentAccount(StudentAttributes student) throws InvalidParametersException { AccountAttributes account = AccountAttributes.builder() .withGoogleId(student.googleId) .withEmail(student.email) .withName(student.name) .withIsInstructor(false) .withInstitute(getCourseInstitute(student.course)) .build(); StudentProfileAttributes spa = StudentProfileAttributes.builder().build(); spa.googleId = student.googleId; spa.institute = account.institute; <START> account.studentProfile = spa; <END> accountsDb.createAccount(account); }</code><technical_language>do here. P.S. guys migrations StudentProfileAttributes missed out something</technical_language>

Target:
private void createStudentAccount(StudentAttributes student) throws InvalidParametersException { AccountAttributes account = AccountAttributes.builder() .withGoogleId(student.googleId) .withEmail(student.email) .withName(student.name) .withIsInstructor(false) .withInstitute(getCourseInstitute(student.course)) .withStudentProfileAttributes(StudentProfileAttributes.builder() .withGoogleId(student.googleId) .withInstitute(getCourseInstitute(student.course)) .build()) .build(); accountsDb.createAccount(account); }
Source:
<code>private void findMeta(Class<?> cls, Object instance) { try { Method getMetaMethod = cls.getMethod("getMeta"); Map<String, String> metaInfo = (Map<String, String>) getMetaMethod.invoke(instance); this.meta.putAll(metaInfo); <START> } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { <END> } }</code><technical_language>of exception logged ? I bet contribute debugging</technical_language>

Target:
private void findMeta(Class<?> cls, Object instance) { try { Method getMetaMethod = cls.getMethod("getMeta"); Map<String, String> metaInfo = (Map<String, String>) getMetaMethod.invoke(instance); this.meta.putAll(metaInfo); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { logger.debug("Could not load `getMeta`.", e); } }
Source:
<code>public void filter(DocumentIndexingPackage dip) throws IndexingException { <START> BinaryObject binObj = getFileObject(dip).getOriginalFile(); <END> String filepath = binObj.getFilename(); String mimetype = binObj.getMimetype(); log.debug("The binary has filepath " + filepath + " and mimetype " + mimetype); List<String> contentTypes = new ArrayList<String>(); extractContentType(filepath, mimetype, contentTypes); dip.getDocument().setContentType(contentTypes); }</code><technical_language>I need check indexed is a work a fileObject, if return immediately. a good chance this throw exception. good a unit test bit functions correctly too</technical_language>

Target:
public void filter(DocumentIndexingPackage dip) throws IndexingException { ContentObject contentObj = dip.getContentObject(); if (!(contentObj instanceof WorkObject) && !(contentObj instanceof FileObject)) { return; } FileObject fileObj = getFileObject(dip); BinaryObject binObj; if (fileObj == null) { return; } binObj = fileObj.getOriginalFile(); String filepath = binObj.getFilename(); String mimetype = binObj.getMimetype(); log.debug("The binary has filepath and mimetype {}", filepath, mimetype); ArrayList<String> contentTypes = new ArrayList<String>(); extractContentType(filepath, mimetype, contentTypes); dip.getDocument().setContentType(contentTypes); }
Source:
<code>public void should_show_console_link_in_folder() { Folder folder = jenkins.jobs.create(Folder.class, createRandomName()); folder.save(); folder.open(); FreeStyleJob job = folder.getJobs().create(); job.startBuild().waitUntilFinished().shouldSucceed(); ListView.createWithColumn(folder, LastConsoleColumn.class); List<WebElement> links = all(by.link("Last/current build console output")); <START> assertThat(links.size(), is(1)); <END> links.get(0).click(); assertThat(driver, hasContent("Console Output")); }</code><technical_language>assertThat(links, iterableWithSize(1)); provides defect localization</technical_language>

Target:
public void should_show_console_link_in_folder() { Folder folder = jenkins.jobs.create(Folder.class, createRandomName()); folder.save(); folder.open(); FreeStyleJob job = folder.getJobs().create(); job.startBuild().waitUntilFinished().shouldSucceed(); ListView.createWithColumn(folder, LastConsoleColumn.class); List<WebElement> links = all(by.link("Last/current build console output")); assertThat(links, iterableWithSize(1)); links.get(0).click(); assertThat(driver, hasContent("Console Output")); }
Source:
<code>public List<DBSDocumentState> getChildrenStates(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) { if(!excludeSpecialChildren && !excludeRegularChildren) { return getAllChildrenStates(parentId); } List<DBSDocumentState> docStates = new LinkedList<>(); Set<String> seen = new HashSet<>(); Set<String> specialChildrenTypesNamesSet = getSpecialChildrenTypesNamesSet(); for (DBSDocumentState docState : transientStates.values()) { if (!parentId.equals(docState.getParentId())) { continue; } if (specialChildrenTypesNamesSet.contains(docState.getPrimaryType()) && excludeSpecialChildren) { continue; } <START> if (!specialChildrenTypesNamesSet.contains(docState.getPrimaryType()) && excludeRegularChildren) { <END> continue; } docStates.add(docState); seen.add(docState.getId()); } DBSQueryOperator operator = excludeSpecialChildren == true ? DBSQueryOperator.NOT_IN : DBSQueryOperator.IN; List<State> states = repository.queryKeyValueWithOperator(KEY_PARENT_ID, parentId, KEY_PRIMARY_TYPE, operator, getSpecialChildrenTypesNamesSet(), seen); return getDocumentStates(docStates, states); }</code><technical_language>More efficient repetition: if (excludeSpecialChildren || excludeRegularChildren) { boolean specialChild = specialChildrenTypesNamesSet.contains(docState.getPrimaryType()); if (excludeSpecialChildren && specialChild || excludeRegularChildren && !specialChild) { continue; } }</technical_language>

Target:
public List<DBSDocumentState> getChildrenStates(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) { List<DBSDocumentState> docStates = new LinkedList<>(); Set<String> seen = new HashSet<>(); Set<String> specialChildrenTypes = Framework.getService(SchemaManager.class).getSpecialDocumentTypes(); boolean excludeChildren = excludeSpecialChildren || excludeRegularChildren; for (DBSDocumentState docState : transientStates.values()) { if (!parentId.equals(docState.getParentId())) { continue; } if (excludeChildren) { boolean specialChild = specialChildrenTypes.contains(docState.getPrimaryType()); if (excludeSpecialChildren && specialChild || excludeRegularChildren && !specialChild) { continue; } } docStates.add(docState); seen.add(docState.getId()); } List<State> states; if (!excludeChildren) { states = repository.queryKeyValue(KEY_PARENT_ID, parentId, seen); } else { DBSQueryOperator operator = excludeSpecialChildren ? DBSQueryOperator.NOT_IN : DBSQueryOperator.IN; states = repository.queryKeyValueWithOperator(KEY_PARENT_ID, parentId, KEY_PRIMARY_TYPE, operator, specialChildrenTypes, seen); } for (State state : states) { String id = (String) state.get(KEY_ID); if (transientStates.containsKey(id)) { continue; } docStates.add(newTransientState(state)); } return docStates; }
Source:
<code>public int getMaxIntermediateSize() { <START> return card.sizeof(); <END> }</code><technical_language>If missing something, building card field respond this method. building a constant, I _think_ able figure out constant is instead</technical_language>

Target:
public int getMaxIntermediateSize() { return 65536; }
Source:
<code>public StatusCheckerResult preExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { mSystemServerProcess = device.getProcessByName("system_server"); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.SUCCESS); if (mSystemServerProcess == null) { String message = <START> "The system_server process has not started."; <END> CLog.w(message); result.setStatus(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); mModuleStartTime = null; return result; } mModuleStartTime = getCurrentTime(); return result; }</code><technical_language>I accurate message. of situation "it's started"</technical_language>

Target:
public StatusCheckerResult preExecutionCheck(ITestDevice device) throws DeviceNotAvailableException { mSystemServerProcess = device.getProcessByName("system_server"); StatusCheckerResult result = new StatusCheckerResult(CheckStatus.SUCCESS); if (mSystemServerProcess == null) { String message = "No valid system_server process is found."; CLog.w(message); result.setStatus(CheckStatus.FAILED); result.setBugreportNeeded(true); result.setErrorMessage(message); mModuleStartTime = null; return result; } mModuleStartTime = getCurrentTime(); return result; }
Source:
<code>public CompletableFuture<List<RedisNodeDescription>> getNodesAsync() { List<StatefulRedisConnection<String, String>> connections = new CopyOnWriteArrayList<>(); Flux<RedisURI> uris = Flux.fromIterable(redisURIs); Mono<List<RedisNodeDescription>> nodes = uris.flatMap(uri -> getNodeDescription(connections, uri)) .collectList() .map((nodeDescriptions) -> { if (nodeDescriptions.isEmpty()) { <START> throw new RedisConnectionException(String.format("Failed to connect to any nodes in %s", redisURIs)); <END> } else { return nodeDescriptions; } }) .doFinally(it -> { for (StatefulRedisConnection<String, String> connection : connections) { connection.closeAsync(); } }); return nodes.toFuture(); }</code><technical_language>Thanks for raising this issue. I argue in ways, hard fail failure vs. fail if connection established all. this safeguard in place is beneficial. Please do .map( ) flatMap( ) return Mono.error( ). Throwing exceptions in reactive operators a proper communicate failures. However, this question raises another obvious is SSL support for Master/Slave right now: Redis SSL (which require a tunnel/proxy), Redis topology discovery reports actual hosts ports. For SSL Sentinel Master/Slave auto-discovery need some sort of mapper function work. reported addresses mapped URI points actual SSL endpoint. For now, mapper introduce a Mapper API in a new ticket</technical_language>

Target:
public CompletableFuture<List<RedisNodeDescription>> getNodesAsync() { List<StatefulRedisConnection<String, String>> connections = new CopyOnWriteArrayList<>(); Flux<RedisURI> uris = Flux.fromIterable(redisURIs); Mono<List<RedisNodeDescription>> nodes = uris.flatMap(uri -> getNodeDescription(connections, uri)) .collectList() .flatMap((nodeDescriptions) -> { if (nodeDescriptions.isEmpty()) { return Mono.error(new RedisConnectionException(String.format("Failed to connect to any nodes in %s", redisURIs))); } else { return Mono.just(nodeDescriptions); } }) .doFinally(it -> { for (StatefulRedisConnection<String, String> connection : connections) { connection.closeAsync(); } }); return nodes.toFuture(); }
Source:
<code>public void setActive(boolean active) { <START> getImage().setActive(true == active); <END> }</code><technical_language>need... getImage().setActive(active)</technical_language>

Target:
public void setActive(boolean active) { getImage().setActive(active); }
Source:
<code>public void removeRepositories() { try { configLock.writeLock().lock(); <START> configuration.repositories = null; <END> } finally { configLock.writeLock().unlock(); } }</code><technical_language>setRepositories</technical_language>

Target:
public void removeRepositories() { try { configLock.writeLock().lock(); configuration.setRepositories(null); } finally { configLock.writeLock().unlock(); } }
Source:
<code>public List<TaskStatusEvent> getJobHistory(final JobId jobId, final String host) throws JobDoesNotExistException { final Job descriptor = getJob(jobId); if (descriptor == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("getJobHistory"); List<String> hosts; try { hosts = client.getChildren(Paths.historyJobHosts(jobId)); <START> if (!isNullOrEmpty(host)) { <END> if (!hosts.contains(host)) { return emptyList(); } else { hosts = singletonList(host); } } } catch (NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw Throwables.propagate(e); } final List<TaskStatusEvent> jsEvents = Lists.newArrayList(); for (String h : hosts) { final List<String> events; try { events = client.getChildren(Paths.historyJobHostEvents(jobId, h)); } catch (NoNodeException e) { continue; } catch (KeeperException e) { throw Throwables.propagate(e); } for (String event : events) { try { byte[] data = client.getData(Paths.historyJobHostEventsTimestamp( jobId, h, Long.valueOf(event))); final TaskStatus status = Json.read(data, TaskStatus.class); jsEvents.add(new TaskStatusEvent(status, Long.valueOf(event), h)); } catch (NoNodeException e) { } catch (KeeperException | IOException e) { throw Throwables.propagate(e); } } } return Ordering.from(EVENT_COMPARATOR).sortedCopy(jsEvents); }</code><technical_language>Instead of this conditional, like: java hosts = (!isNullOrEmpty(host)) ? singletonList(host) : client.getChildren(...); is say, need do ZK operation if a host is provided. trust actual host for job. If isn't, get filtered out loop hosts list</technical_language>

Target:
public List<TaskStatusEvent> getJobHistory(final JobId jobId, final String host) throws JobDoesNotExistException { final Job descriptor = getJob(jobId); if (descriptor == null) { throw new JobDoesNotExistException(jobId); } final ZooKeeperClient client = provider.get("getJobHistory"); final List<String> hosts; try { hosts = (!isNullOrEmpty(host)) ? singletonList(host) : client.getChildren(Paths.historyJobHosts(jobId)); } catch (NoNodeException e) { return emptyList(); } catch (KeeperException e) { throw Throwables.propagate(e); } final List<TaskStatusEvent> jsEvents = Lists.newArrayList(); for (String h : hosts) { final List<String> events; try { events = client.getChildren(Paths.historyJobHostEvents(jobId, h)); } catch (NoNodeException e) { continue; } catch (KeeperException e) { throw Throwables.propagate(e); } for (String event : events) { try { byte[] data = client.getData(Paths.historyJobHostEventsTimestamp( jobId, h, Long.valueOf(event))); final TaskStatus status = Json.read(data, TaskStatus.class); jsEvents.add(new TaskStatusEvent(status, Long.valueOf(event), h)); } catch (NoNodeException e) { } catch (KeeperException | IOException e) { throw Throwables.propagate(e); } } } return Ordering.from(EVENT_COMPARATOR).sortedCopy(jsEvents); }
Source:
<code>private List<ChannelGroup<?>> resolveChannelGroups(List<String> idParams) { List<ChannelGroup<?>> channelGroups = new ArrayList<>(); for (String idParam : idParams) { Id id = Id.valueOf(codec.decode(idParam)); Optional<ChannelGroup<?>> channelGroupOptional; try { channelGroupOptional = Futures.getChecked( <START> channelGroupResolver.resolveIds(ImmutableList.of(id)), <END> IOException.class, 1, TimeUnit.MINUTES ).getResources().first(); } catch (IOException e) { throw new RuntimeException(new NotFoundException(id)); } if (channelGroupOptional.isPresent()) { channelGroups.add(channelGroupOptional.get()); } else { throw new RuntimeException(new NotFoundException(id)); } } return channelGroups; }</code><technical_language>querying method allows pass in multiple? This a significant bottleneck if wants a large number of channel groups</technical_language>

Target:
private List<ChannelGroup<?>> resolveChannelGroups(List<String> idParams) { List<Id> ids = idParams.stream() .map(codec::decode) .map(Id::valueOf) .collect(Collectors.toList()); return Promise.wrap(channelGroupResolver.resolveIds(ids)) .then(Resolved::getResources) .get(1, TimeUnit.MINUTES) .toList(); }
Source:
<code>public List<File> getWritableLedgerDirsForNewLog() throws NoWritableLedgerDirException { if (!writableLedgerDirectories.isEmpty()) { return writableLedgerDirectories; } <START> if (forceGCAllowWhenNoSpace == false) { <END> String errMsg = "All ledger directories are non writable and force GC is not enabled."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; } List<File> fullLedgerDirsToAccomodateNewEntryLog = new ArrayList<File>(); for (File dir: this.ledgerDirectories) { if (dir.getUsableSpace() > (this.entryLogSize * 1.2) ) { fullLedgerDirsToAccomodateNewEntryLog.add(dir); } } if (!fullLedgerDirsToAccomodateNewEntryLog.isEmpty()) { LOG.info("No writable ledger dirs. Trying to go beyond to accomodate compaction." + "Dirs that can accomodate new entryLog are: {}", fullLedgerDirsToAccomodateNewEntryLog); return fullLedgerDirsToAccomodateNewEntryLog; } String errMsg = "All ledger directories are non writable and no reserved space left for creating entry log file."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; }</code><technical_language>if this is boolean, do need "=="</technical_language>

Target:
public List<File> getWritableLedgerDirsForNewLog() throws NoWritableLedgerDirException { if (!writableLedgerDirectories.isEmpty()) { return writableLedgerDirectories; } if (!forceGCAllowWhenNoSpace) { String errMsg = "All ledger directories are non writable and force GC is not enabled."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; } List<File> fullLedgerDirsToAccomodateNewEntryLog = new ArrayList<File>(); for (File dir: this.ledgerDirectories) { if (dir.getUsableSpace() > (this.entryLogSize * 1.2) ) { fullLedgerDirsToAccomodateNewEntryLog.add(dir); } } if (!fullLedgerDirsToAccomodateNewEntryLog.isEmpty()) { LOG.info("No writable ledger dirs. Trying to go beyond to accomodate compaction." + "Dirs that can accomodate new entryLog are: {}", fullLedgerDirsToAccomodateNewEntryLog); return fullLedgerDirsToAccomodateNewEntryLog; } String errMsg = "All ledger directories are non writable and no reserved space left for creating entry log file."; NoWritableLedgerDirException e = new NoWritableLedgerDirException(errMsg); LOG.error(errMsg, e); throw e; }
Source:
<code>public void replaceLock(String taskid, TaskLock oldLock, TaskLock newLock) { Preconditions.checkNotNull(taskid, "taskid"); Preconditions.checkNotNull(oldLock, "oldLock"); Preconditions.checkNotNull(newLock, "newLock"); log.info( "Replacing lock on interval[%s] version[%s] for task: %s", oldLock.getInterval(), oldLock.getVersion(), taskid ); removeLock(taskid, oldLock); <START> addLock(taskid, newLock); <END> }</code><technical_language>do this in a metadata store transaction? advantage of transactions for other operations atomic, segment publishing kafka offset committing. IndexerSQLMetadataStorageConnector.announceHistoricalSegments for example connector.retryTransaction</technical_language>

Target:
public void replaceLock(String taskid, TaskLock oldLock, TaskLock newLock) { Preconditions.checkNotNull(taskid, "taskid"); Preconditions.checkNotNull(oldLock, "oldLock"); Preconditions.checkNotNull(newLock, "newLock"); log.info( "Replacing lock on interval[%s] version[%s] for task: %s", oldLock.getInterval(), oldLock.getVersion(), taskid ); final Long oldLockId = handler.getLockId(taskid, oldLock); if (oldLockId == null) { throw new ISE("Cannot find lock[%s]", oldLock); } handler.replaceLock(taskid, oldLockId, newLock); }
Source:
<code>private static IBundleGroup getBundleGroup(String id, String versionId) { if (id == null || versionId == null) { return null; } for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) { <START> IBundleGroup[] groups = provider.getBundleGroups(); <END> for (IBundleGroup group : groups) { if (id.equals(group.getIdentifier()) && versionId.equals(group.getVersion())) { return group; } } } return null; }</code><technical_language>inline</technical_language>

Target:
private static IBundleGroup getBundleGroup(String id, String versionId) { if (id == null || versionId == null) { return null; } for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) { for (IBundleGroup group : provider.getBundleGroups()) { if (id.equals(group.getIdentifier()) && versionId.equals(group.getVersion())) { return group; } } } return null; }
Source:
<code>public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint) { if (programPoint instanceof MemberProgramPoint) { final Optional<ProgramState> result = programPoint.execute(currentState); if (!result.isPresent()) { final ExpressionTree memberOwner = ((MemberExpressionTree) element).object(); Symbol symbol = getSymbol(memberOwner); <START> addUniqueIssueForSymbol(memberOwner, String.format(MESSAGE, memberOwner.toString()), symbol); <END> } } else if (isForOfExpression(element)) { Symbol symbol = getSymbol((ExpressionTree) element); Constraint constraint = currentState.getConstraint(symbol); if (symbol != null && constraint != null && constraint.isStricterOrEqualTo(NULL_OR_UNDEFINED)) { addUniqueIssueForSymbol(element, String.format(MESSAGE, symbol.name()), symbol); } } }</code><technical_language>@inverno Do toString, put this expression in message</technical_language>

Target:
public void beforeBlockElement(ProgramState currentState, Tree element, ProgramPoint programPoint) { if (programPoint instanceof MemberProgramPoint) { final Optional<ProgramState> result = programPoint.execute(currentState); if (!result.isPresent()) { final ExpressionTree memberOwner = ((MemberExpressionTree) element).object(); Symbol symbol = getSymbol(memberOwner); addUniqueIssue(memberOwner, symbol); } } else if (isForOfExpression(element)) { Symbol symbol = getSymbol((ExpressionTree) element); if (currentState.getConstraint(symbol).isStricterOrEqualTo(NULL_OR_UNDEFINED)) { addUniqueIssue(element, symbol); } } }
Source:
<code>public void VETemplateTests_003_AddTemplates() { articleName = PageContent.articleNamePrefix + base.getTimeStamp(); VisualEditorPageObject ve = base.launchVisualEditorWithMainEdit(articleName, wikiURL); VisualEditorInsertTemplateDialog templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); <START> VisualEditorEditTemplateDialog editTemplateDialog = templateDialog.selectResultTemplate("per", 0); <END> ve = editTemplateDialog.clickDone(); templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); editTemplateDialog = templateDialog.selectResultTemplate("per", 1); ve = editTemplateDialog.closeDialog(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); ArticlePageObject article = saveDialog.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }</code><technical_language>creating a VisualEditorContents class in ContentPatterns for constants for VE</technical_language>

Target:
public void VETemplateTests_003_AddTemplates() { articleName = PageContent.articleNamePrefix + base.getTimeStamp(); VisualEditorPageObject ve = base.launchVisualEditorWithMainEdit(articleName, wikiURL); VisualEditorInsertTemplateDialog templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); VisualEditorEditTemplateDialog editTemplateDialog = templateDialog.selectResultTemplate(VEContent.templateSearchStr3, 0); ve = editTemplateDialog.clickDone(); templateDialog = (VisualEditorInsertTemplateDialog) ve.openDialogFromMenu(InsertDialog.TEMPLATE); editTemplateDialog = templateDialog.selectResultTemplate(VEContent.templateSearchStr3, 1); ve = editTemplateDialog.closeDialog(); VisualEditorSaveChangesDialog saveDialog = ve.clickPublishButton(); ArticlePageObject article = saveDialog.savePage(); article.verifyVEPublishComplete(); article.logOut(wikiURL); }
Source:
<code>boolean meetRequirement(Long value) throws NullPointerException { Objects.requireNonNull(value, "Input value is empty which cannot be applied to threshold check."); <START> return boundType == BoundType.UpperBound ? value < threshold : value > threshold; <END> }</code><technical_language>I <= (allow equal case meet requirement). Is a specific reason strict it</technical_language>

Target:
boolean meetRequirement(Long value) throws NullPointerException { Objects.requireNonNull(value, "Input value is empty which cannot be applied to threshold check."); return boundType == BoundType.UpperBound ? value <= threshold : value >= threshold; }
Source:
<code>private String getCreateTableProperties() { if (acidTableKindToUse != null) { <START> if (acidTableKindToUse.equals("orc")) { <END> return " stored as orc TBLPROPERTIES('transactional'='true')"; } else if (acidTableKindToUse.equals("mm")) { return " TBLPROPERTIES('transactional'='true', 'transactional_properties'='insert_only')"; } } return ""; }</code><technical_language>clear, name "full_acid" "mm_acid". In fact. MM table created Orc data</technical_language>

Target:
private String getCreateTableProperties() { if (acidTableKindToUse == AcidTableKind.FULL_ACID) { return " stored as orc TBLPROPERTIES('transactional'='true')"; } if (acidTableKindToUse == AcidTableKind.INSERT_ONLY) { return " TBLPROPERTIES('transactional'='true', 'transactional_properties'='insert_only')"; } return ""; }
Source:
<code>public void testDefaultNumberofParallelWorkers() throws Exception { handler = new GerritHandler(); listener = new SlowEventListener(); handler.addListener(listener); postEventsToQueue(5); waitForEventsProcessed(); <START> assertThat(handler.getLargestPoolSize(), equalTo(3)); <END> }</code><technical_language>constant here, onlooker understands tests default number</technical_language>

Target:
public void testDefaultNumberofParallelWorkers() throws Exception { handler = new GerritHandler(); listener = new SlowEventListener(); handler.addListener(listener); postEventsToQueue(5); waitForEventsProcessed(); assertThat(handler.getLargestPoolSize(), equalTo(DEFAULT_NR_OF_RECEIVING_WORKER_THREADS)); }
Source:
<code>public void visitNode(Tree tree) { ClassTree node = (ClassTree) tree; Symbol.TypeSymbol symbol = node.symbol(); Symbol owner = symbol.owner(); Type ownerType = owner.type(); <START> if (ownerType != null && ownerType.isClass() && owner.owner().type() == null) { <END> int first = FirstSyntaxTokenFinder.firstSyntaxToken(node).line(); int last = LastSyntaxTokenFinder.lastSyntaxToken(node).line(); int length = last - first + 1; if (length > max) { addIssue(node, "Reduce this class from " + length + " to the maximum allowed " + max + " or externalize it in a public class."); } } }</code><technical_language>I easily get bit of condition is required for</technical_language>

Target:
public void visitNode(Tree tree) { ClassTree node = (ClassTree) tree; Symbol.TypeSymbol symbol = node.symbol(); Symbol owner = symbol.owner(); Type ownerType = owner.type(); if (ownerType != null && ownerType.isClass() && owner.owner().isPackageSymbol()) { int first = FirstSyntaxTokenFinder.firstSyntaxToken(node).line(); int last = LastSyntaxTokenFinder.lastSyntaxToken(node).line(); int length = last - first + 1; if (length > max) { addIssue(node, "Reduce this class from " + length + " to the maximum allowed " + max + " or externalize it in a public class."); } } }
Source:
<code>public void checkParityFor(long currentId) { final Optional<ChargeEntity> maybeCharge = chargeDao.findById(currentId); try { maybeCharge.ifPresent(c -> MDC.put("chargeId", c.getExternalId())); if (maybeCharge.isPresent()) { final ChargeEntity charge = maybeCharge.get(); Optional<LedgerTransaction> transaction = ledgerService.getTransaction(charge.getExternalId()); if (existsInLedger(charge, transaction)) { logger.info("transaction exists in ledger [id={}]", currentId); charge.updateParityCheck(ParityCheckStatus.EXISTS_IN_LEDGER); } else { logger.info("transaction does not exist in ledger [id={}] -", currentId); <START> charge.updateParityCheck(ParityCheckStatus.MISSING_IN_LEDGER); <END> emitHistoricalEvents(charge); } } else { logger.info("[{}/{}] - not found", currentId, maxId); } } finally { MDC.remove("chargeId"); } }</code><technical_language>I this service class. ChargeEntity ideally get/set</technical_language>

Target:
public void checkParityFor(long currentId) { final Optional<ChargeEntity> maybeCharge = chargeDao.findById(currentId); try { maybeCharge.ifPresent(c -> MDC.put("chargeId", c.getExternalId())); if (maybeCharge.isPresent()) { final ChargeEntity charge = maybeCharge.get(); Optional<LedgerTransaction> transaction = ledgerService.getTransaction(charge.getExternalId()); if (existsInLedger(transaction)) { logger.info("transaction exists in ledger [id={}]", currentId); chargeService.updateChargeParityStatus(charge.getExternalId(), ParityCheckStatus.EXISTS_IN_LEDGER); } else { logger.info("transaction does not exist in ledger [id={}] -", currentId); chargeService.updateChargeParityStatus(charge.getExternalId(), ParityCheckStatus.MISSING_IN_LEDGER); emitHistoricalEvents(charge); } } else { logger.info("[{}/{}] - not found", currentId, maxId); } } finally { MDC.remove("chargeId"); } }