auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void convertSpecific(SupremeCourtJudgment judgment, SourceScJudgment sourceJudgment) { judgment.setPersonnelType(extractPersonnelType(sourceJudgment)); judgment.setScJudgmentForm(extractSupremeCourtJudgmentForm(sourceJudgment)); <START> extractSupremeCourtChambers(sourceJudgment).stream().forEach(scChamber->addScChamber(judgment, scChamber)); <END> judgment.setScChamberDivision(extractSupremeCourtChamberDivision(sourceJudgment)); }</code><technical_language>J) suggestion filter concept</technical_language>

Target:
public void convertSpecific(SupremeCourtJudgment judgment, SourceScJudgment sourceJudgment) { judgment.setPersonnelType(extractPersonnelType(sourceJudgment)); judgment.setScJudgmentForm(extractSupremeCourtJudgmentForm(sourceJudgment)); extractSupremeCourtChambers(sourceJudgment).stream().filter(scChamber->!judgment.containsScChamber(scChamber)).forEach(scChamber->judgment.addScChamber(scChamber)); judgment.setScChamberDivision(extractSupremeCourtChamberDivision(sourceJudgment)); }
Source:
<code>private void getKeyClient(HttpClient httpClient, KeyServiceVersion serviceVersion) { client = clientSetup(pipeline -> new KeyClientBuilder() .vaultUrl(getEndpoint()) <START> .pipeline(pipeline) .httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient) <END> .serviceVersion(serviceVersion) .buildClient()); }</code><technical_language>Set httpclient in pipeline instead</technical_language>

Target:
private void getKeyClient(HttpClient httpClient, KeyServiceVersion serviceVersion) { HttpPipeline httpPipeline = getHttpPipeline(httpClient, serviceVersion); client = new KeyClientBuilder() .vaultUrl(getEndpoint()) .pipeline(httpPipeline) .serviceVersion(serviceVersion) .buildClient(); }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) return true; <END> if (!(o instanceof CaseInsensitiveMultiMap)) return false; if (!super.equals(o)) return false; CaseInsensitiveMultiMap that = (CaseInsensitiveMultiMap) o; return optimized == that.optimized; }</code><technical_language>braces for line blocks</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CaseInsensitiveMultiMap)) { return false; } if (!super.equals(o)) { return false; } CaseInsensitiveMultiMap that = (CaseInsensitiveMultiMap) o; return optimized == that.optimized; }
Source:
<code>public SessionEntity getSession(String sessionId) { <START> return getSessions(Arrays.asList(sessionId)).iterator().next(); <END> }</code><technical_language>if getSessions(Arrays.asList(sessionId)) returns empty list NoSuchElement exception here. return null in this case</technical_language>

Target:
public SessionEntity getSession(String sessionId) { List<SessionEntity> sessions = getSessions(Arrays.asList(sessionId)); if (!sessions.isEmpty()){ return sessions.iterator().next(); } return null; }
Source:
<code>T build(ServiceLocator serviceLocator) { Store.Provider storeProvider = serviceLocator.findService(Store.Provider.class); <START> return (T) new Ehcache(storeProvider.createStore(new StoreConfigurationImpl(keyType, valueType, capacityConstraint, evictionVeto, evictionPrioritizer)), cacheLoader); <END> }</code><technical_language>This be: return (T) new Ehcache<K, V>(storeProvider.createStore(new StoreConfigurationImpl<K, V>(keyType, valueType, capacityConstraint, evictionVeto, evictionPrioritizer)), cacheLoader); remove compilation warnings</technical_language>

Target:
T build(ServiceLocator serviceLocator) { Store.Provider storeProvider = serviceLocator.findService(Store.Provider.class); final StoreConfigurationImpl<K, V> storeConfig = new StoreConfigurationImpl<K, V>(keyType, valueType, capacityConstraint, evictionVeto, evictionPrioritizer); final Store<K, V> store = storeProvider.createStore(storeConfig); final Ehcache<K, V> ehcache = new Ehcache<K, V>(store, cacheLoader, (ServiceConfiguration<?>[]) null); return (T) ehcache; }
Source:
<code>public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException { synchronized (lock) { if (!isCompleted()) { lock.wait(timeUnit.toMillis(duration)); } <START> return complete; <END> } }</code><technical_language>reuse isCompleted()</technical_language>

Target:
public boolean waitForCompletion(long duration, TimeUnit timeUnit) throws InterruptedException { synchronized (lock) { if (!isCompleted()) { lock.wait(timeUnit.toMillis(duration)); } return isCompleted(); } }
Source:
<code>public void purgeDeletedKeyWithResponseSnippets() { KeyClient keyClient = createClient(); Response<Void> purgedResponse = keyClient.purgeDeletedKeyWithResponse("deletedKeyName", new Context(key2, value2)); <START> System.out.printf("Purge Status Code: %rsaPrivateExponent", purgedResponse.getStatusCode()); <END> END: com.azure.keyvault.keys.keyclient.purgeDeletedKeyWithResponse#string-Context }</code><technical_language>Mind fixing copy paste error, %d%n</technical_language>

Target:
public void purgeDeletedKeyWithResponseSnippets() { KeyClient keyClient = createClient(); Response<Void> purgedResponse = keyClient.purgeDeletedKeyWithResponse("deletedKeyName", new Context(key2, value2)); System.out.printf("Purge Status Code: %d %n", purgedResponse.getStatusCode()); END: com.azure.keyvault.keys.keyclient.purgeDeletedKeyWithResponse#string-Context }
Source:
<code>private boolean isDomainXmlEnabledForVds() { return (boolean) Config.getValue( ConfigValues.DomainXML, <START> vmDao.get(getParameters().getVmId()).getCompatibilityVersion().toString()); <END> }</code><technical_language>note cluster's compatibility version in case, if vm is set custom cluster's compatibility version is cached in VmManager instead of this costly query</technical_language>

Target:
private boolean isDomainXmlEnabledForVds() { return FeatureSupported.isDomainXMLSupported( resourceManager.getVdsManager(getParameters().getVdsId()).getCompatibilityVersion()); }
Source:
<code>public void close() { checkIfValidThread(); <START> if (openInProgress) { <END> if (managementRealmOpenTask != null) { managementRealmOpenTask.cancel(); managementRealmOpenTask = null; } if (permissionRealmOpenTask != null) { permissionRealmOpenTask.cancel(); permissionRealmOpenTask = null; } } else { if (managementRealm != null) { managementRealm.close(); } if (permissionRealm != null) { permissionRealm.close(); } } closed = true; }</code><technical_language>remove this check else. managementRealmOpenTask permissionRealmOpenTask finished time, managementRealm != null permissionRealm == null</technical_language>

Target:
public void close() { checkIfValidThread(); Integer instanceCount = permissionManagerInstanceCounter.get(); if (instanceCount > 1) { permissionManagerInstanceCounter.set(instanceCount - 1); return; } permissionManagerInstanceCounter.set(0); permissionManager.set(null); delayedTasks.clear(); if (managementRealmOpenTask != null) { managementRealmOpenTask.cancel(); managementRealmOpenTask = null; } if (permissionRealmOpenTask != null) { permissionRealmOpenTask.cancel(); permissionRealmOpenTask = null; } if (managementRealm != null) { managementRealm.close(); } if (permissionRealm != null) { permissionRealm.close(); } closed = true; }
Source:
<code>} catch (Exception e) { <START> e.printStackTrace(); <END> }</code><technical_language>log instead of e.printStackTrace</technical_language>

Target:
} catch (Exception e) { logger.error("Unable to set up SSLContext with TLS. Https activity will likely fail.", e); }
Source:
<code>public void subtest1Select(Client client) throws IOException, ProcCallException { System.out.println("subtest1Select..."); String sql; m_receivedResponse = false; sql = "SELECT * FROM R1;"; executeLRR(client,sql); while (!m_receivedResponse) { doRandomTableManipulation(client, "R1"); } VoltTable vt = client.callProcedure("@AdHoc",sql).getResults()[0]; <START> assertEquals(initTableSize + m_insertCount - m_deleteCount,vt.getRowCount()); <END> }</code><technical_language>assert m_insertCount, greater zero, ensuring table modified</technical_language>

Target:
public void subtest1Select(Client client) throws IOException, ProcCallException { System.out.println("subtest1Select..."); String sql; m_receivedResponse = false; sql = "SELECT * FROM R1;"; executeLRR(client,sql); while (!m_receivedResponse) { doRandomTableManipulation(client, "R1"); } VoltTable vt = client.callProcedure("@AdHoc",sql).getResults()[0]; assertEquals(initTableSize + m_insertCount - m_deleteCount,vt.getRowCount()); assertTrue(m_insertCount > 0 || m_deleteCount > 0 || m_updateCount > 0); }
Source:
<code>private ProgressCallbackImpl getProgressCallback(ThingUID thingUID) { <START> if (!progessCallbackMap.containsKey(thingUID)) { <END> throw new IllegalStateException( String.format("No ProgressCallback available for thing with UID %s.", thingUID)); } return progessCallbackMap.get(thingUID); }</code><technical_language>clean this map if a firmware update handler removed</technical_language>

Target:
private ProgressCallbackImpl getProgressCallback(ThingUID thingUID) { if (!progressCallbackMap.containsKey(thingUID)) { throw new IllegalStateException( String.format("No ProgressCallback available for thing with UID %s.", thingUID)); } return progressCallbackMap.get(thingUID); }
Source:
<code>private ICPPEvaluation createPointerValue(ActivationRecord record, ConstexprEvaluationContext context, ICPPEvaluation computedInitializerEval) { <START> ICPPEvaluation initValue = initializerEval.getValue(null).get(0); <END> if (isPointerToArray(initValue)) { EvalCompositeAccess arrayPointer = new EvalCompositeAccess(computedInitializerEval, 0); return createPointerFromCompositeAccess(record, context, arrayPointer); } else if (computedInitializerEval instanceof EvalPointer) { EvalPointer pointer = (EvalPointer)computedInitializerEval; return pointer.copy(); } return EvalFixed.INCOMPLETE; }</code><technical_language>null -> context.getPoint()</technical_language>

Target:
private ICPPEvaluation createPointerValue(ActivationRecord record, ConstexprEvaluationContext context, ICPPEvaluation computedInitializerEval) { ICPPEvaluation initValue = initializerEval.getValue(context.getPoint()).get(0); if (isPointerToArray(initValue, context)) { EvalCompositeAccess arrayPointer = new EvalCompositeAccess(computedInitializerEval, 0); return createPointerFromCompositeAccess(record, context, arrayPointer); } else if (computedInitializerEval instanceof EvalPointer) { EvalPointer pointer = (EvalPointer)computedInitializerEval; return pointer.copy(); } return EvalFixed.INCOMPLETE; }
Source:
<code>public void testHeadHandler() throws IOException { final int lines = 5; final int headLines = 3; int totalCount = 8192; RandomInputStream rndStream = new RandomInputStream(totalCount, lines); HeadHandler handler = new HeadHandler(headLines); assertTrue(totalCount > handler.getBufferedReaderSize()); handler.processStream(rndStream); assertEquals(headLines, handler.size()); assertEquals(totalCount + 1, rndStream.getCount()); int linesLen = 0; for (int i = 0; i < headLines; i++) { <START> linesLen += handler.get(i).length(); <END> } assertTrue(linesLen < totalCount / 2); }</code><technical_language>this approach randomness, I if informative compare line content generated</technical_language>

Target:
public void testHeadHandler() throws IOException { LOGGER.log(Level.INFO, "testing HeadHandler with: {0}/{1}/{2}", new Object[]{lineCnt, headLineCnt, totalCharCount}); RandomInputStream rndStream = new RandomInputStream(totalCharCount, lineCnt); HeadHandler handler = new HeadHandler(headLineCnt); assertTrue(totalCharCount >= HeadHandler.getBufferedReaderSize(), "number of characters to generate must be bigger than " + "HeadHandler internal buffer size"); handler.processStream(rndStream); assertTrue(handler.count() <= headLineCnt, "HeadHandler should not get more lines than was asked to"); assertEquals(totalCharCount, rndStream.getCharCount(), "HeadHandler should read all the characters from input stream"); String[] headLines = new String[handler.count()]; for (int i = 0; i < handler.count(); i++) { String line = handler.get(i); LOGGER.log(Level.INFO, "line [{0}]: {1}", new Object[]{i, line}); headLines[i] = line; } assertArrayEquals(headLines, Arrays.copyOfRange(rndStream.getResult().split("\n"), 0, handler.count()), "the lines retrieved by HeadHandler needs to match the input"); }
Source:
<code>public void unvoidCondition_shouldUnvoidConditionSuccessfully(){ Condition condition = new Condition(); int patientId = 2; condition.setCondition(new CodedOrFreeText()); condition.setAdditionalDetail("unvoiding a condition"); condition.setVerificationStatus(ConditionVerificationStatus.PROVISIONAL); condition.setClinicalStatus(ConditionClinicalStatus.INACTIVE); condition.setUuid(UUID); condition.setPatient(patientService.getPatient(patientId)); <START> expectedException = ExpectedException.none(); <END> conditionService.unvoidCondition(condition); Condition unVoidedCondition = conditionService.getConditionByUuid(UUID); Assert.assertEquals(ConditionVerificationStatus.PROVISIONAL, unVoidedCondition.getVerificationStatus()); Assert.assertEquals(ConditionClinicalStatus.INACTIVE, unVoidedCondition.getClinicalStatus()); Assert.assertEquals(UUID, unVoidedCondition.getUuid()); }</code><technical_language>is of expectedException in this test</technical_language>

Target:
public void unvoidCondition_shouldUnvoidConditionSuccessfully(){ Condition voidedCondition = conditionService.voidCondition(conditionService.getCondition(4), "Test Reason"); Assert.assertTrue(voidedCondition.getVoided()); Assert.assertNotNull(voidedCondition.getVoidReason()); Assert.assertNotNull(voidedCondition.getDateVoided()); Assert.assertEquals(new Integer(1), voidedCondition.getVoidedBy().getUserId()); Condition unVoidedCondition = conditionService.unvoidCondition(voidedCondition); Assert.assertEquals(ConditionVerificationStatus.CONFIRMED, unVoidedCondition.getVerificationStatus()); Assert.assertEquals(ConditionClinicalStatus.ACTIVE, unVoidedCondition.getClinicalStatus()); Assert.assertEquals("2cb6880e-2cd6-11e4-9138-a6c5e4d20fb7", unVoidedCondition.getUuid()); Assert.assertFalse(unVoidedCondition.getVoided()); Assert.assertNull(unVoidedCondition.getVoidReason()); Assert.assertNull(unVoidedCondition.getDateVoided()); Assert.assertNull(unVoidedCondition.getVoidedBy()); }
Source:
<code>private void sealVmTemplate() { <START> SealVmTemplateParameters parameters = new SealVmTemplateParameters(); parameters.setVmTemplateId(getVmTemplateId()); parameters.setParentCommand(getActionType()); parameters.setParentParameters(getParameters()); parameters.setEndProcedure(VdcActionParametersBase.EndProcedure.COMMAND_MANAGED); <END> getBackend().runInternalAction(VdcActionType.SealVmTemplate, parameters, cloneContextAndDetachFromParent()); }</code><technical_language>please extract a separate method</technical_language>

Target:
private void sealVmTemplate() { VdcReturnValueBase returnValue = runInternalAction(VdcActionType.SealVmTemplate, buildSealVmTemplateParameters(), ExecutionHandler.createDefaultContextForTasks(getContext())); if (!returnValue.getSucceeded()) { throw new EngineException(returnValue.getFault().getError(), returnValue.getFault().getMessage()); } }
Source:
<code>public void testFixedMeanFixedVariance() { Double[] params = new Double[2]; params[0] = MEAN; <START> params[1] = VARIANCE; <END> UnivarGaussian gaussian = new UnivarGaussian(); gaussian.setParams(params); testGaussian(gaussian); }</code><technical_language>Simpler: Double[] params = { MEAN, VARIANCE }</technical_language>

Target:
public void testFixedMeanFixedVariance() { Double[] params = { MEAN, VARIANCE }; UnivarGaussian gaussian = new UnivarGaussian(); gaussian.setParams(params); testGaussian(gaussian); }
Source:
<code>public Block getBlockForPlacement(BlockPlacementData data) { Side mainSide = Side.TOP; boolean upsideDownPlacement = data.attachmentSide == Side.BOTTOM || data.attachmentSide != Side.TOP && data.relativeAttachmentPosition.y() > 0.5; <START> if (upsideDownPlacement) { mainSide = Side.BOTTOM; } <END> Side blockDirection = Side.inDirection(-data.viewingDirection.x(), 0, -data.viewingDirection.z()); return blocks.get(ExtendedSide.getExtendedSideFor(mainSide, blockDirection)); }</code><technical_language>Instead of declaring mainSide mutating do check do a single-time assignment: suggestion final Side mainSide = upsideDownPlacement ? Side.BOTTOM : Side.TOP;</technical_language>

Target:
public Block getBlockForPlacement(BlockPlacementData data) { boolean upsideDownPlacement = data.attachmentSide == Side.BOTTOM || data.attachmentSide != Side.TOP && data.relativeAttachmentPosition.y() > 0.5; final Side mainSide = upsideDownPlacement ? Side.BOTTOM : Side.TOP; Side blockDirection = Side.inDirection(-data.viewingDirection.x(), 0, -data.viewingDirection.z()); return blocks.get(ExtendedSide.getExtendedSideFor(mainSide, blockDirection)); }
Source:
<code>public void handleOutgoingProjectNegotiation( final AbstractOutgoingProjectNegotiation negotiation) { projectExecutor.execute(new Runnable() { @Override public void run() { ProjectNegotiation.Status status = negotiation .run(new ConsoleProgressIndicator(System.out)); <START> switch (status) { <END> case ERROR: log.error("ERROR running project negotiation: "+negotiation.getErrorMessage()); break; case REMOTE_ERROR: log.error("REMOTE_ERROR running project negotiation: "+negotiation.getErrorMessage()); break; case CANCEL: log.info("Project negotiation was cancelled locally"); break; case REMOTE_CANCEL: log.info("Project negotiation was cancelled by remote"); break; } } }); }</code><technical_language>I this is debug stuff, add a flag if. this called a null progress monitor some logging progress monitor logs beginTask done calls</technical_language>

Target:
public void handleOutgoingProjectNegotiation( final AbstractOutgoingProjectNegotiation negotiation) { projectExecutor.execute(new Runnable() { @Override public void run() { ProjectNegotiation.Status status; if (ServerConfig.isInteractive()) { status = negotiation .run(new ConsoleProgressIndicator(System.out)); } else { status = negotiation .run(new NullProgressMonitor()); } switch (status) { case ERROR: log.error("ERROR running project negotiation: "+ negotiation.getErrorMessage()); break; case REMOTE_ERROR: log.error("REMOTE_ERROR running project negotiation: "+ negotiation.getErrorMessage()+" at remote: "+ negotiation.getPeer().toString()); break; case CANCEL: log.info("Project negotiation was cancelled locally"); break; case REMOTE_CANCEL: log.info("Project negotiation was cancelled by remote: "+ negotiation.getPeer().toString()); break; } } }); }
Source:
<code>public void fetchLocationUri() throws Exception { Venue venue = new Venue(new VenueGroup("group"), new VenueType("type"), Lists.newArrayList(new VenueName("info", new Language("en")))); CivicLocation civic = new CivicLocation("country", "city", "street", "number", "postCode"); GeoLocation geo = new GeoLocation(65.65656565, 75.75757575); <START> final AccessPoint ap = new AccessPoint(new ID("id1"), "ip", new MacAddress("aa:bb"), "sn", "model", venue, geo, civic, new CapabilityList(Lists.newArrayList(new Capability(256, "a")))); <END> context.checking(new Expectations() {{ oneOf(repository).findById("id1"); will(returnValue(Optional.of(ap))); oneOf(request).header("Host"); will(returnValue("localhost:8080")); }}); Reply<?> reply = service.fetchLocationURI("id1", request); String locationURI = "localhost:8080/r/aps/id1/location"; assertThat(reply, containsValue(locationURI)); assertThat(reply, isOk()); }</code><technical_language>I understand builder here</technical_language>

Target:
public void fetchLocationUri() throws Exception { final AccessPoint ap = newAp().build(); context.checking(new Expectations() {{ oneOf(repository).findById("id1"); will(returnValue(Optional.of(ap))); oneOf(request).header("Host"); will(returnValue("localhost:8080")); }}); Reply<?> reply = service.fetchLocationURI("id1", request); String locationURI = "localhost:8080/r/aps/id1/location"; assertThat(reply, containsValue(locationURI)); assertThat(reply, isOk()); }
Source:
<code>private PlugwiseDevice createPlugwiseDevice(String deviceType, String MAC, String deviceName) { PlugwiseDevice device = null; if ("circleplus".equals(deviceType) || "circleplus".equals(deviceName)) { device = new CirclePlus(MAC, stick, deviceName); logger.info("Plugwise created Circle+ with name: and MAC address: {}", deviceName, MAC); } else if ("circle".equals(deviceType) || deviceType == null) { device = new Circle(MAC, stick, deviceName); logger.info("Plugwise created Circle with name: and MAC address: {}", deviceName, MAC); } else if ("scan".equals(deviceType)) { device = new Scan(MAC, stick, deviceName); logger.info("Plugwise created Scan with name: and MAC address: {}", deviceName, MAC); } else if ("sense".equals(deviceType)) { device = new Sense(MAC, stick, deviceName); logger.info("Plugwise created Sense with name: and MAC address: {}", deviceName, MAC); } else if ("stealth".equals(deviceType)) { device = new Stealth(MAC, stick, deviceName); logger.info("Plugwise created Stealth with name: and MAC address: {}", deviceName, MAC); } else if ("switch".equals(deviceType)) { device = new Switch(MAC, stick, deviceName); logger.info("Plugwise created Switch with name: and MAC address: {}", deviceName, MAC); } else { logger.error( "Plugwise can not create device with name: '{}' because it has an unknown device type: '{}'. " + "Known device types are: circle|circleplus|scan|sense|stealth|switch", deviceName, deviceType); } return device; <START> } <END></code><technical_language>logger.info -> logger.debug logger.trace logger.error -> logger.warn system stability is affected</technical_language>

Target:
private PlugwiseDevice createPlugwiseDevice(String deviceType, String MAC, String deviceName) { PlugwiseDevice device = null; if ("circleplus".equals(deviceType) || "circleplus".equals(deviceName)) { device = new CirclePlus(MAC, stick, deviceName); logger.debug("Plugwise created Circle+ with name: and MAC address: {}", deviceName, MAC); } else if ("circle".equals(deviceType) || deviceType == null) { device = new Circle(MAC, stick, deviceName); logger.debug("Plugwise created Circle with name: and MAC address: {}", deviceName, MAC); } else if ("scan".equals(deviceType)) { device = new Scan(MAC, stick, deviceName); logger.debug("Plugwise created Scan with name: and MAC address: {}", deviceName, MAC); } else if ("sense".equals(deviceType)) { device = new Sense(MAC, stick, deviceName); logger.debug("Plugwise created Sense with name: and MAC address: {}", deviceName, MAC); } else if ("stealth".equals(deviceType)) { device = new Stealth(MAC, stick, deviceName); logger.debug("Plugwise created Stealth with name: and MAC address: {}", deviceName, MAC); } else if ("switch".equals(deviceType)) { device = new Switch(MAC, stick, deviceName); logger.debug("Plugwise created Switch with name: and MAC address: {}", deviceName, MAC); } else { logger.warn( "Plugwise can not create device with name: '{}' because it has an unknown device type: '{}'. " + "Known device types are: circle|circleplus|scan|sense|stealth|switch", deviceName, deviceType); } return device; }
Source:
<code>public boolean shouldUpdateFragmentOnErrorEvent(StatsEvents.SectionUpdateError errorEvent) { if (!shouldUpdateFragmentOnUpdateEvent(errorEvent)) { return false; } StatsService.StatsEndpointsEnum sectionToUpdate = errorEvent.mEndPointName; StatsService.StatsEndpointsEnum[] sectionsToUpdate = getSectionsToUpdate(); int indexOfDatamodelMatch = -1; <START> for (int i = 0; i < getSectionsToUpdate().length; i++) { <END> if (sectionToUpdate == sectionsToUpdate[i]) { indexOfDatamodelMatch = i; break; } } if (-1 == indexOfDatamodelMatch) { return false; } return true; }</code><technical_language>Replace getSectionsToUpdate() sectionsToUpdate avoid potential object creation</technical_language>

Target:
public boolean shouldUpdateFragmentOnErrorEvent(StatsEvents.SectionUpdateError errorEvent) { if (!shouldUpdateFragmentOnUpdateEvent(errorEvent)) { return false; } StatsService.StatsEndpointsEnum sectionToUpdate = errorEvent.mEndPointName; StatsService.StatsEndpointsEnum[] sectionsToUpdate = sectionsToUpdate(); for (int i = 0; i < sectionsToUpdate().length; i++) { if (sectionToUpdate == sectionsToUpdate[i]) { return true; } } return false; }
Source:
<code>public void setText(final String text) { <START> getElement().setInnerText(text); <END> }</code><technical_language>a TextMixin for this? I a lot more for other widgets. this approach, get rid of HeaderPanels created, right</technical_language>

Target:
public void setText(final String text) { textMixin.setText(text); }
Source:
<code>private Shape getSkyBackgroundCurve(Function<Long, WorldCoords> coords, long start, long end, String obsId) { synchronized (cacheLock) { Map<String, CachedShapeId> cache = skyBackgroundCurveCache; CachedShapeId cs = cache.get(obsId); <START> if (cs != null && cs.matches(obsId)) <END> return cs.shape; ImprovedSkyCalc calc = new ImprovedSkyCalc(model.getSchedule().getSite()); GeneralPath path = new GeneralPath(); boolean hop = true; for (long t = start; t < end; t += INTEGRATION_STEP) { calc.calculate(coords.apply(t), new Date(t), true); if (calc.getAltitude() > 0) { if (hop) { path.moveTo(t, calc.getTotalSkyBrightness().floatValue()); hop = false; } else { path.lineTo(t, calc.getTotalSkyBrightness().floatValue()); } } else { hop = true; continue; } } calc.calculate(coords.apply(end), new Date(end), true); if (!hop) path.lineTo(end, calc.getTotalSkyBrightness().floatValue()); cs = new CachedShapeId(timeSB2XY.createTransformedShape(path), obsId); cache.put(obsId, cs); return cs.shape; } }</code><technical_language>I this set start end times. fact obtained CachedShape obsId key is enough corresponds observation id. However, if shape match start/end time period used. I is need for a CachedShapeId object. this update good</technical_language>

Target:
private Shape getSkyBackgroundCurve(Function<Long, WorldCoords> coords, long start, long end, String obsId) { synchronized (cacheLock) { Map<String, CachedShape> cache = skyBackgroundCurveCache; CachedShape cs = cache.get(obsId); if (cs != null && cs.matches(start, end)) return cs.shape; ImprovedSkyCalc calc = new ImprovedSkyCalc(model.getSchedule().getSite()); GeneralPath path = new GeneralPath(); boolean hop = true; for (long t = start; t < end; t += INTEGRATION_STEP) { calc.calculate(coords.apply(t), new Date(t), true); if (calc.getAltitude() > 0) { if (hop) { path.moveTo(t, calc.getTotalSkyBrightness().floatValue()); hop = false; } else { path.lineTo(t, calc.getTotalSkyBrightness().floatValue()); } } else { hop = true; continue; } } calc.calculate(coords.apply(end), new Date(end), true); if (!hop) path.lineTo(end, calc.getTotalSkyBrightness().floatValue()); cs = new CachedShape(timeSB2XY.createTransformedShape(path), start, end); cache.put(obsId, cs); return cs.shape; } }
Source:
<code>public Flux<ByteBuffer> getBody() { return bodyIntern().doFinally(s -> { if (!reactorNettyConnection.isDisposed()) { reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); } <START> }).map(byteBuf -> { <END> if (this.disableBufferCopy) { return byteBuf.nioBuffer(); } return deepCopyBuffer(byteBuf); }); }</code><technical_language>this in bodyIntern method instead</technical_language>

Target:
public Flux<ByteBuffer> getBody() { return bodyIntern().doFinally(s -> { if (!reactorNettyConnection.isDisposed()) { reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); } }).map(byteBuf -> this.disableBufferCopy ? byteBuf.nioBuffer() : deepCopyBuffer(byteBuf)); }
Source:
<code>protected void checkpointIfNecessary() { if (context.requireCheckpoint()) { boolean completed = false; try { checkpoint(); completed = true; inCheckpointRecords = inRecords; } catch (Exception e) { <START> log.error(e, e); <END> } finally { if (!completed) { log.error(metadata.name() + ": CHECKPOINT FAILURE: Resume may create duplicates."); } } } }</code><technical_language>Is this intended ? hide problems current runner stopped</technical_language>

Target:
protected void checkpointIfNecessary() { if (context.requireCheckpoint()) { boolean completed = false; try { checkpoint(); completed = true; inCheckpointRecords = inRecords; } finally { if (!completed) { log.error(metadata.name() + ": CHECKPOINT FAILURE: Resume may create duplicates."); } } } }
Source:
<code>private boolean getMapAdditionalInfo() { mTitle = mTitleEditText.getText().toString(); mDescription = mDescEditText.getText().toString(); String[] tags = (mTagsEditText.getText().toString()).split(","); for (String tag : tags) { mTagsList.add(tag); <START> } <END> if (TextUtils.isEmpty(mTitle)) { mTitleEditText.setError(getString(R.string.title_error)); return false; } if (TextUtils.isEmpty(mTagsEditText.getText().toString())) { mTagsEditText.setError(getString(R.string.tags_error)); return false; } return true; }</code><technical_language>replace manual copy collection copy Collections.addAll(mTagsList, tags);</technical_language>

Target:
private boolean getMapAdditionalInfo() { mTitle = mTitleEditText.getText().toString(); mDescription = mDescEditText.getText().toString(); String[] tags = (mTagsEditText.getText().toString()).split(","); Collections.addAll(mTagsList, tags); if (TextUtils.isEmpty(mTitle)) { mTitleEditText.setError(getString(R.string.title_error)); return false; } if (TextUtils.isEmpty(mTagsEditText.getText().toString())) { mTagsEditText.setError(getString(R.string.tags_error)); return false; } return true; }
Source:
<code><START> public boolean isCertExpired(X509Certificate cert) { <END> if (cert != null) { if (cert.getNotAfter().before(new Date())) { return true; } } return false; }</code><technical_language>Do want/need this method public? check is pretty straightforward</technical_language>

Target:
private boolean isCertExpired(X509Certificate cert) { if (cert != null && cert.getNotAfter().before(new Date())) { return true; } return false; }
Source:
<code>public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { return builder .add( attr(CONSTRAINT_VALUES_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(ConstraintValueInfo.PROVIDER.id())) .add(attr(REMOTE_EXECUTION_PROPS_ATTR, Type.STRING)) .add( attr(PARENTS_PLATFORM_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(PlatformInfo.PROVIDER.id())) .add( attr(HOST_PLATFORM_ATTR, Type.BOOLEAN) .value(false) .undocumented("Should only be used by internal packages.")) .add( attr(TARGET_PLATFORM_ATTR, Type.BOOLEAN) .value(false) .undocumented("Should only be used by internal packages.")) .add( attr(CPU_CONSTRAINTS_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(ImmutableList.of(ConstraintValueInfo.PROVIDER.id())) .undocumented("Should only be used by internal packages.")) .add( attr(OS_CONSTRAINTS_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(ImmutableList.of(ConstraintValueInfo.PROVIDER.id())) .undocumented("Should only be used by internal packages.")) .build(); }</code><technical_language>API reference precise semantics? (what if platforms define constraint_setting, {PARENT_REMOTE_EXECUTION_PROPERTIES}, etc)</technical_language>

Target:
public RuleClass build(RuleClass.Builder builder, RuleDefinitionEnvironment env) { return builder .add( attr(CONSTRAINT_VALUES_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(ConstraintValueInfo.PROVIDER.id())) .add( attr(PARENTS_PLATFORM_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(PlatformInfo.PROVIDER.id())) .add(attr(REMOTE_EXECUTION_PROPS_ATTR, Type.STRING)) .add( attr(HOST_PLATFORM_ATTR, Type.BOOLEAN) .value(false) .undocumented("Should only be used by internal packages.")) .add( attr(TARGET_PLATFORM_ATTR, Type.BOOLEAN) .value(false) .undocumented("Should only be used by internal packages.")) .add( attr(CPU_CONSTRAINTS_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(ImmutableList.of(ConstraintValueInfo.PROVIDER.id())) .undocumented("Should only be used by internal packages.")) .add( attr(OS_CONSTRAINTS_ATTR, BuildType.LABEL_LIST) .allowedFileTypes(FileTypeSet.NO_FILE) .mandatoryProviders(ImmutableList.of(ConstraintValueInfo.PROVIDER.id())) .undocumented("Should only be used by internal packages.")) .build(); }
Source:
<code>public void setup() throws IOException { checkState(this.bufferPool == null, "Bug in input gate setup logic: Already registered buffer pool."); setupChannels(); <START> if (consumedPartitionType.isBlocking()) { <END> Collection<MemorySegment> segments = memorySegmentProvider.requestMemorySegments(1); memorySegmentForLocalChannel = Iterables.getOnlyElement(segments); } BufferPool bufferPool = bufferPoolFactory.get(); setBufferPool(bufferPool); }</code><technical_language>I simply this a simple lazy-created MemorySegement, logic determine shuffle type is. If this is fetched if needed (see Supplier<MemorySegment> above) good enough. I fine if this unpooled segment, obtained memorySegmentProvider created access. simpler, worry recycling, races creation early disposal, etc</technical_language>

Target:
public void setup() throws IOException { checkState(this.bufferPool == null, "Bug in input gate setup logic: Already registered buffer pool."); setupChannels(); BufferPool bufferPool = bufferPoolFactory.get(); setBufferPool(bufferPool); }
Source:
<code>public static File createBundle(File workDir, String actual, String basis) throws IllegalArgumentException, IOException { Git git; try { git = Git.open(workDir); } catch (IOException e) { throw new IllegalArgumentException("workDir can't be resolved", e); } Repository repo = git.getRepository(); BundleWriter bundlewriter = new BundleWriter(repo); Ref actualRef; try { actualRef = repo.exactRef(actual); } catch (IOException e) { throw new IllegalArgumentException("actual can't be resolved", e); } if (actualRef == null) throw new IllegalArgumentException("actual can't be resolved"); bundlewriter.include("refs/heads/bundle", actualRef.getObjectId()); if (basis != "") { try { RevWalk walk = new RevWalk(repo); RevCommit basisCommit = walk.parseCommit(repo.resolve(basis)); bundlewriter.assume(basisCommit); } catch (Exception e) { throw new IllegalArgumentException("basis can't be resolved", e); } } File bundle; try { bundle = File.createTempFile("file", ".bundle"); OutputStream fos = new FileOutputStream(bundle); NullProgressMonitor monitor = NullProgressMonitor.INSTANCE; bundlewriter.writeBundle(monitor, fos); <START> } catch (Exception e) { <END> throw new IOException("failed to write bundle", e); } return bundle; }</code><technical_language>do catch exception in production code. logic closes outputstream (either success error)</technical_language>

Target:
public static byte[] createBundle(File workDir, String actual, String basis) throws IllegalArgumentException, IOException { Git git; try { if (workDir == null) throw new IllegalArgumentException("workDir is null and can't be resolved"); git = Git.open(workDir); } catch (IOException e) { throw new IOException("failed while read from workDir", e); } Repository repo = git.getRepository(); BundleWriter bundlewriter = new BundleWriter(repo); Ref actualRef; try { actualRef = repo.exactRef(actual); } catch (IOException e) { throw new IOException("failed while resolved second parameter", e); } if (actualRef == null) throw new IllegalArgumentException( "failed to resolve the second parameter: not existing ref"); bundlewriter.include("refs/heads/bundle", actualRef.getObjectId()); if (basis != "") { try { RevWalk walk = new RevWalk(repo); RevCommit basisCommit = walk.parseCommit(repo.resolve(basis)); walk.close(); bundlewriter.assume(basisCommit); } catch (NullPointerException | IOException e) { throw new IOException("failed while resolved third parameter", e); } } NullProgressMonitor monitor = NullProgressMonitor.INSTANCE; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); bundlewriter.writeBundle(monitor, byteArrayOutputStream); return byteArrayOutputStream.toByteArray(); }
Source:
<code>public static ValidationResultState valueOf(int wellFormed, int valid) { switch (wellFormed) { case RepInfo.UNDETERMINED: return UNKNOWN; case RepInfo.FALSE: return NOT_WELL_FORMED; case RepInfo.TRUE: switch (valid) { case RepInfo.UNDETERMINED: return WELL_FORMED; case RepInfo.FALSE: return WELL_FORMED_BUT_NOT_VALID; case RepInfo.TRUE: return VALID; default: <START> throw new IllegalStateException("Complete switch"); <END> } default: throw new IllegalStateException("Complete switch"); } }</code><technical_language>Please adjust this exception a defined case is happend. a more meaningful hint / message thrown</technical_language>

Target:
public static ValidationResultState valueOf(int wellFormed, int valid) { switch (wellFormed) { case RepInfo.UNDETERMINED: return UNKNOWN; case RepInfo.FALSE: return NOT_WELL_FORMED; case RepInfo.TRUE: switch (valid) { case RepInfo.UNDETERMINED: return WELL_FORMED; case RepInfo.FALSE: return WELL_FORMED_BUT_NOT_VALID; case RepInfo.TRUE: return VALID; default: throw new IllegalArgumentException("No enum constant"); } default: throw new IllegalArgumentException("No enum constant"); } }
Source:
<code>private void processModuleOutputTuple(String tuple) { try { JSONObject jo = new JSONObject(tuple); String tb = jo.getJSONObject("groupByKey").getString("timeBucket"); switch (tb) { case "1m": addFinalizedStringToWindowIdBucket(jo, minFinalizedData); if (printFinalizedData) { <START> System.out.println("FinalizedData (min bucket): " + tuple); <END> } break; case "1h": addFinalizedStringToWindowIdBucket(jo, hourFinalizedData); if (printFinalizedData) { System.out.println("FinalizedData (hour bucket): " + tuple); } break; case "1d": addFinalizedStringToWindowIdBucket(jo, dayFinalizedData); if (printFinalizedData) { System.out.println("FinalizedData (day bucket): " + tuple); } break; default: throw new RuntimeException("Something went wrong."); } } catch (JSONException e) { throw new RuntimeException(e); } }</code><technical_language>Log instead of sysout</technical_language>

Target:
private void processModuleOutputTuple(String tuple) { try { JSONObject jo = new JSONObject(tuple); String tb = jo.getJSONObject("groupByKey").getString("timeBucket"); switch (tb) { case "1m": addFinalizedStringToWindowIdBucket(jo, minFinalizedData); if (printFinalizedData) { logger.info("FinalizedData (min bucket): {}", tuple); } break; case "1h": addFinalizedStringToWindowIdBucket(jo, hourFinalizedData); if (printFinalizedData) { logger.info("FinalizedData (hour bucket): {}", tuple); } break; case "1d": addFinalizedStringToWindowIdBucket(jo, dayFinalizedData); if (printFinalizedData) { logger.info("FinalizedData (day bucket): {}", tuple); } break; default: throw new RuntimeException("Something went wrong."); } } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
<code>public void saveGridPreferences() { if (gridPreferencesStore != null && preferencesService != null) { <START> gridPreferencesStore.setPreferenceKey(gridPreferencesStore.getPreferenceKey()); <END> gridPreferencesStore.setType(UserPreferencesType.GRIDPREFERENCES); preferencesService.call(response -> { }).saveUserPreferences(gridPreferencesStore); } }</code><technical_language>concern this is potentially breaking compatibility this component is in places. do this jbpm-wb only? more control</technical_language>

Target:
public void saveGridPreferences() { if (gridPreferencesStore != null) { gridPreferencesStore.setPreferenceKey(gridPreferencesStore.getGlobalPreferences().getKey()); saveGridToUserPreferences(); } }
Source:
<code>public RsWithoutHeader(final Response res, final CharSequence name) { super( new Response() { @Override @SuppressWarnings("unchecked") public Iterable<String> head() throws IOException { final String prefix = String.format( "%s:", name.toString().toLowerCase(Locale.ENGLISH) ); return new Concat<String>( res.head(), <START> Collections.EMPTY_LIST, <END> new Condition.LowerCase(prefix) ); } @Override public InputStream body() throws IOException { return res.body(); } } ); }</code><technical_language>@super132 please Collections.emptyList()</technical_language>

Target:
public RsWithoutHeader(final Response res, final CharSequence name) { super( new Response() { @Override public Iterable<String> head() throws IOException { final String prefix = String.format( "%s:", name.toString().toLowerCase(Locale.ENGLISH) ); return new Select<String>( res.head(), new Condition<String>() { @Override public boolean fits(final String header) { return !header.toLowerCase(Locale.ENGLISH) .startsWith(prefix); } } ); } @Override public InputStream body() throws IOException { return res.body(); } } ); }
Source:
<code>public void testThumbSmallRouteForceFileExists() throws Exception { String derivativePath = idToPath(fileID, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); File existingFile = new File("target/" + derivativePath + "/" + fileID + ".png"); FileUtils.writeStringToFile(existingFile, "extracted text", "utf-8"); createContext(smallThumbRoute); getMockEndpoint("mock:exec:/bin/sh").expectedMessageCount(1); Map<String, Object> headers = createEvent(fileID, eventTypes, "true"); template.sendBodyAndHeaders("", headers); verify(addSmallThumbnailProcessor).process(any(Exchange.class)); assertMockEndpointsSatisfied(); <START> existingFile.delete(); <END> }</code><technical_language>remove in this class</technical_language>

Target:
public void testThumbSmallRouteForceFileExists() throws Exception { String derivativePath = idToPath(fileID, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); File existingFile = new File("target/" + derivativePath + "/" + fileID + ".png"); FileUtils.writeStringToFile(existingFile, "extracted text", "utf-8"); createContext(smallThumbRoute); getMockEndpoint("mock:exec:/bin/sh").expectedMessageCount(1); Map<String, Object> headers = createEvent(fileID, eventTypes, "true"); template.sendBodyAndHeaders("", headers); verify(addSmallThumbnailProcessor).process(any(Exchange.class)); assertMockEndpointsSatisfied(); }
Source:
<code><START> public void testSpatialPartitions() <END> throws Exception { String kdbTreeJson = makeKDBTreeJson(); assertSpatialPartitions(kdbTreeJson, "POINT EMPTY", null); assertSpatialPartitions(kdbTreeJson, "POINT (0 0)", ImmutableList.of(0)); assertSpatialPartitions(kdbTreeJson, "POINT (3 1)", ImmutableList.of(2)); assertSpatialPartitions(kdbTreeJson, "POINT (1 2.5)", ImmutableList.of(1)); assertSpatialPartitions(kdbTreeJson, "POINT (4.5 2.5)", ImmutableList.of(4)); assertSpatialPartitions(kdbTreeJson, "POINT (2 6)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "POINT (3 -1)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "POINT (10 3)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 6 2)", ImmutableList.of(3)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 5.5 3, 6 2)", ImmutableList.of(3, 4)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (3 2, 8 3)", ImmutableList.of(2, 3, 4, 5)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (2 6, 3 7)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "POINT EMPTY", 1.2, null); assertSpatialPartitions(kdbTreeJson, "POINT (1 1)", 1.2, ImmutableList.of(0)); assertSpatialPartitions(kdbTreeJson, "POINT (1 1)", 2.3, ImmutableList.of(0, 1, 2)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 6 2)", 0.2, ImmutableList.of(3)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 6 2)", 1.2, ImmutableList.of(2, 3, 4)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (2 6, 3 7)", 1.2, ImmutableList.of()); }</code><technical_language>assertSpatialPartitioning</technical_language>

Target:
public void testSpatialPartitions() { String kdbTreeJson = makeKdbTreeJson(); assertSpatialPartitions(kdbTreeJson, "POINT EMPTY", null); assertSpatialPartitions(kdbTreeJson, "POINT (0 0)", ImmutableList.of(0)); assertSpatialPartitions(kdbTreeJson, "POINT (3 1)", ImmutableList.of(2)); assertSpatialPartitions(kdbTreeJson, "POINT (1 2.5)", ImmutableList.of(1)); assertSpatialPartitions(kdbTreeJson, "POINT (4.5 2.5)", ImmutableList.of(4)); assertSpatialPartitions(kdbTreeJson, "POINT (2 6)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "POINT (3 -1)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "POINT (10 3)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 6 2)", ImmutableList.of(3)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 5.5 3, 6 2)", ImmutableList.of(3, 4)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (3 2, 8 3)", ImmutableList.of(2, 3, 4, 5)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (2 6, 3 7)", ImmutableList.of()); assertSpatialPartitions(kdbTreeJson, "POINT EMPTY", 1.2, null); assertSpatialPartitions(kdbTreeJson, "POINT (1 1)", 1.2, ImmutableList.of(0)); assertSpatialPartitions(kdbTreeJson, "POINT (1 1)", 2.3, ImmutableList.of(0, 1, 2)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 6 2)", 0.2, ImmutableList.of(3)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (5 0.1, 6 2)", 1.2, ImmutableList.of(2, 3, 4)); assertSpatialPartitions(kdbTreeJson, "MULTIPOINT (2 6, 3 7)", 1.2, ImmutableList.of()); }
Source:
<code>public Response restore(Action action) { action.setAsync(false); TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(parentId, guid); if (action.isSetRestoreMemory()) { tryBackParams.setRestoreMemory(action.isRestoreMemory()); } if (action.isSetDisks()) { Set<Guid> <START> disksGuid = <END> new HashSet<>(); List<DiskImage> disks = collection.mapDisks(action.getDisks()); if (disks != null) { disksGuid = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); } tryBackParams.setDisks(disksGuid); } tryBackParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response = doAction(ActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action, PollingType.JOB); if (response.getStatus()==Response.Status.OK.getStatusCode()) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, SnapshotActionEnum.COMMIT); restoreParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response2 = doAction(ActionType.RestoreAllSnapshots, restoreParams, action); if (response2.getStatus()!=Response.Status.OK.getStatusCode()) { return response2; } } return response; }</code><technical_language>'disksGuids' clearer? :)</technical_language>

Target:
public Response restore(Action action) { action.setAsync(false); TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(parentId, guid); if (action.isSetRestoreMemory()) { tryBackParams.setRestoreMemory(action.isRestoreMemory()); } if (action.isSetDisks()) { Set<Guid> disksGuids = new HashSet<>(); List<DiskImage> disks = collection.mapDisks(action.getDisks()); if (disks != null) { disksGuids = getDisksGuidSet(disks); } tryBackParams.setDisks(disksGuids); } tryBackParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response = doAction(ActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action, PollingType.JOB); if (response.getStatus()==Response.Status.OK.getStatusCode()) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, SnapshotActionEnum.COMMIT); restoreParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response2 = doAction(ActionType.RestoreAllSnapshots, restoreParams, action); if (response2.getStatus()!=Response.Status.OK.getStatusCode()) { return response2; } } return response; }
Source:
<code>public BatchingLeaderElectionService(LeaderElectionService delegate) { this.delegate = delegate; this.batcher = Autobatchers.independent(this::processBatch) <START> .safeLoggablePurpose(BatchingLeaderElectionService.class.getSimpleName()) <END> .build(); }</code><technical_language>other of safeLoggablePurpose a kebab-cased string - I if want change name threads consistent, a strong preference</technical_language>

Target:
public BatchingLeaderElectionService(LeaderElectionService delegate) { this.delegate = delegate; this.batcher = Autobatchers.independent(this::processBatch) .safeLoggablePurpose("leader-election-service") .build(); }