auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean check(final VDS host) { HostSetupNetworkPoller poller = new HostSetupNetworkPoller(); final long absoluteTimeoutTime = System.currentTimeMillis() + VDSM_RESPONSIVENESS_PERIOD_IN_SECONDS * M; while <START> (System.currentTimeMillis() <END> < absoluteTimeoutTime) { try { if (poller.poll(host.getId())) { log.info("Engine managed to communicate with VDSM agent on host '{}' with address '{}' ('{}')", host.getName(), host.getHostName(), host.getId()); return true; } } catch (VDSRecoveringException e) { final String msg = MessageFormatter .format("Failed to poll host - it's in recovery mode.", host) .getMessage(); log.debug(msg, e); } } return false; }</code><technical_language>I suggest monotonic time is exposed <LINK_0> code resilient system clock changes</technical_language>

Target:
public boolean check(final VDS host) { HostSetupNetworkPoller poller = new HostSetupNetworkPoller(); final long startTime = System.nanoTime(); while (System.nanoTime() - startTime < VDSM_RESPONSIVENESS_PERIOD_IN_NANOS) { try { if (poller.poll(host.getId())) { log.info("Engine managed to communicate with VDSM agent on host '{}' with address '{}' ('{}')", host.getName(), host.getHostName(), host.getId()); return true; } } catch (VDSRecoveringException e) { final String msg = MessageFormatter .format("Failed to poll host - it's in recovery mode.", host) .getMessage(); log.debug(msg, e); } } return false; }
Source:
<code><START> protected JaxbListWrapper<OnmsIpInterface> createListWrapper(Collection<OnmsIpInterface> list) { <END> return new OnmsIpInterfaceList(list); }</code><technical_language>final</technical_language>

Target:
protected final JaxbListWrapper<OnmsIpInterface> createListWrapper(Collection<OnmsIpInterface> list) { return new OnmsIpInterfaceList(list); }
Source:
<code>public EnvironmentTestDto action(TestContext testContext, EnvironmentTestDto testDto, EnvironmentClient client) throws Exception { int retries = 0; while (retries <= testDto.getWaitUtil().getMaxRetry()) { try { return environmentAction(testContext, testDto, client); } catch (Exception e) { LOGGER.info("Exception during executing Environment action: ", e); if (e.getMessage().contains("flow under operation")) { waitTillFlowInOperation(testDto.getWaitUtil()); retries++; } else { throw e; } } } <START> throw new Exception("Exception during executing Environment action: exceeding maxrety during waiting for flow"); <END> }</code><technical_language>typo in maxrety</technical_language>

Target:
public EnvironmentTestDto action(TestContext testContext, EnvironmentTestDto testDto, EnvironmentClient client) throws Exception { int retries = 0; while (retries <= testDto.getWaitUtil().getMaxRetry()) { try { return environmentAction(testContext, testDto, client); } catch (Exception e) { LOGGER.info("Exception during executing Environment action: ", e); if (e.getMessage().contains("flow under operation")) { waitTillFlowInOperation(testDto.getWaitUtil()); retries++; } else { throw e; } } } throw new Exception("Exception during executing Environment action: exceeding maxretry during waiting for flow"); }
Source:
<code>public void restoreToCurrentVersion(boolean withComments) { if (withComments) restorePopUpPresenter.show(getCurrentPath(), getCurrentVersionRecordUri(), <START> getCurrentBranch()); <END> else { restorePopUpPresenter.restoreCommand(getCurrentPath(), getCurrentVersionRecordUri(), getCurrentBranch()) .execute(""); } }</code><technical_language>suggestion this.currentBranch.getName());</technical_language>

Target:
public void restoreToCurrentVersion(boolean withComments) { if (withComments) restorePopUpPresenter.show(getCurrentPath(), getCurrentVersionRecordUri(), this.currentBranch.getName()); else { restorePopUpPresenter.restoreCommand(getCurrentPath(), getCurrentVersionRecordUri(), this.currentBranch.getName()) .execute(""); } }
Source:
<code>@Override public void close() throws IOException { if (!reported) { LOG.debug(String.format( "***** PHOENIX-TTL-SCAN-STATS-CLOSE: " + "request-id:[%d] = [%d, %d, %d]", <START> this.requestId, this.numRowsScanned, this.numRowsExpired, <END> this.numRowsDeleted)); reported = true; } scanner.close(); }</code><technical_language>basically, requestId is current count of masked expired rows? please rename variable log line well</technical_language>

Target:
@Override public void close() throws IOException { if (!reported) { LOG.debug(String.format( "PHOENIX-TTL-SCAN-STATS-ON-CLOSE: " + "request-id:[%s,%s] = [%d, %d, %d]", this.requestId, Bytes.toString(scanTableName), this.numRowsScanned, this.numRowsExpired, this.numRowsDeleted)); reported = true; } scanner.close(); }
Source:
<code>public void testMapCountWithAtleastOneIndex() { Map<String, String> parameters; parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "0"); Map<String, String> map1 = node.hazelcastInstance.getMap("hazelcast"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "0"); map1.put("1", "hazelcast"); parameters = phoneHome.phoneHome(true); <START> assertEquals(parameters.get("mpaoict"), "1"); <END> map1.put("2", "phonehome"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "1"); }</code><technical_language>I is index added</technical_language>

Target:
public void testMapCountWithAtleastOneIndex() { Map<String, String> parameters; parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "0"); Map<String, String> map1 = node.hazelcastInstance.getMap("hazelcast"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "0"); IndexConfig config = new IndexConfig(IndexType.SORTED, "hazelcast"); node.getConfig().getMapConfig("hazelcast").getIndexConfigs().add(config); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "1"); config = new IndexConfig(IndexType.HASH, "phonehome"); node.getConfig().getMapConfig("hazelcast").getIndexConfigs().add(config); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpaoict"), "1"); }
Source:
<code>protected String generateVmConfiguration(VM vm, List<DiskImage> disks, Map<Guid, VmDevice> vmDevices) { if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) { vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId())); } if (StringUtils.isEmpty(vm.getVmtName())) { VmTemplate t = getVmTemplateDao().get(vm.getVmtGuid()); vm.setVmtName(t.getName()); } if (vmDevices == null) { VmDeviceUtils.setVmDevices(vm.getStaticData()); } else { vm.getStaticData().setManagedDeviceMap(vmDevices); } if (disks == null) { disks = ImagesHandler.filterImageDisks(getDiskDao().getAllForVm(vm.getId()), false, true, true); List<CinderDisk> cinderDisks = ImagesHandler.filterDisksBasedOnCinder(getDiskDao().getAllForVm(vm.getId()), true); <START> for (CinderDisk cinder : cinderDisks) { <END> disks.add(ImagesHandler.getSnapshotLeaf(cinder.getId())); } } for (DiskImage image : disks) { image.setStorageIds(null); } return new OvfManager().ExportVm(vm, new ArrayList<>(disks), ClusterUtils.getCompatibilityVersion(vm)); }</code><technical_language>please extract ImagesHandler -> e.g. getLeafImages</technical_language>

Target:
protected String generateVmConfiguration(VM vm, List<DiskImage> disks, Map<Guid, VmDevice> vmDevices) { if (vm.getInterfaces() == null || vm.getInterfaces().isEmpty()) { vm.setInterfaces(getVmNetworkInterfaceDao().getAllForVm(vm.getId())); } if (StringUtils.isEmpty(vm.getVmtName())) { VmTemplate t = getVmTemplateDao().get(vm.getVmtGuid()); vm.setVmtName(t.getName()); } if (vmDevices == null) { VmDeviceUtils.setVmDevices(vm.getStaticData()); } else { vm.getStaticData().setManagedDeviceMap(vmDevices); } if (disks == null) { disks = ImagesHandler.filterImageDisks(getDiskDao().getAllForVm(vm.getId()), false, true, true); getDiskDao().getAllForVm(vm.getId()); disks.addAll(ImagesHandler.getCinderLeafImages(getDiskDao().getAllForVm(vm.getId()), true)); } for (DiskImage image : disks) { image.setStorageIds(null); } return new OvfManager().ExportVm(vm, new ArrayList<>(disks), ClusterUtils.getCompatibilityVersion(vm)); }
Source:
<code>private VDSReturnValue extendVmDiskSize(VM vm, Long newSize) { Guid vdsId, vmId; if (vm.getStatus().isUpOrPaused()) { vdsId = vm.getRunOnVds().getValue(); vmId = vm.getId(); } else if (vm.getStatus().isDownOrSuspended()) { vdsId = getStoragePool().getspm_vds_id().getValue(); vmId = Guid.Empty; } else { <START> throw new RuntimeException("The VM '" + vm.getName() + "' status is illegal!"); <END> } ExtendVmDiskSizeVDSCommandParameters params = new ExtendVmDiskSizeVDSCommandParameters(vdsId, vmId, getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageId(), getParameters().getImageGroupID(), newSize); return runVdsCommand(VDSCommandType.ExtendVmDiskSize, params); }</code><technical_language>this is a race.. is status immediately changes</technical_language>

Target:
private VDSReturnValue extendVmDiskSize(VM vm, Long newSize) { Guid vdsId, vmId; if (vm.getStatus().isUpOrPaused()) { vdsId = vm.getRunOnVds().getValue(); vmId = vm.getId(); } else { vdsId = getStoragePool().getspm_vds_id().getValue(); vmId = Guid.Empty; } ExtendVmDiskSizeVDSCommandParameters params = new ExtendVmDiskSizeVDSCommandParameters(vdsId, vmId, getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageId(), getParameters().getImageGroupID(), newSize); return runVdsCommand(VDSCommandType.ExtendVmDiskSize, params); }
Source:
<code>private boolean handleSyntaxErrorOnNewTokens( int id, int start, int end, int currentKind, char[] errorTokenSource, String errorTokenName, String expectedToken) { boolean val= false; if (isIdentifier(currentKind)) { String eTokenName = new String(errorTokenSource); String origExpectedToken = expectedToken; expectedToken = replaceIfSynthetic(expectedToken); if (isIdentifier(currentKind)) { if (RestrictedIdentifierRecord.equals(origExpectedToken) && Record.equals(eTokenName)) { if (this.options.sourceLevel < ClassFileConstants.JDK14) { previewFeatureNotSupported(start, end, Record, CompilerOptions.VERSION_14); <START> val= true; <END> } else if (!this.options.enablePreviewFeatures) { previewFeatureNotEnabled(start, end, Record); val= true; } } } } return val; }</code><technical_language>space required</technical_language>

Target:
private boolean handleSyntaxErrorOnNewTokens( int id, int start, int end, int currentKind, char[] errorTokenSource, String errorTokenName, String expectedToken) { boolean val = false; if (isIdentifier(currentKind)) { String eTokenName = new String(errorTokenSource); String origExpectedToken = expectedToken; expectedToken = replaceIfSynthetic(expectedToken); if (isIdentifier(currentKind)) { if (RESTRICTED_IDENTIFIER_RECORD.equals(origExpectedToken) && RECORD.equals(eTokenName)) { if (this.options.sourceLevel < ClassFileConstants.JDK14) { previewFeatureNotSupported(start, end, RECORD, CompilerOptions.VERSION_14); val = true; } else if (!this.options.enablePreviewFeatures) { previewFeatureNotEnabled(start, end, RECORD); val = true; } } } } return val; }
Source:
<code>public static TradfriColor fromCie(int xyX, int xyY, int xyBrightness) { int brightness = xyBrightness; if (brightness > 254) { brightness = 254; } double x = unnormalize(xyX); double y = unnormalize(xyY); double z = 1.0 - x - y; double Y = (brightness / 254.0); double X = (Y / y) * x; double Z = (Y / y) * z; double red = X * 1.656492 - Y * 0.354851 - Z * 0.255038; double green = -X * 0.707196 + Y * 1.655397 + Z * 0.036152; double blue = X * 0.051713 - Y * 0.121364 + Z * 1.011530; if (red > blue && red > green && red > 1.0) { green = green / red; blue = blue / red; red = 1.0; } else if (green > blue && green > red && green > 1.0) { red = red / green; blue = blue / green; green = 1.0; } else if (blue > red && blue > green && blue > 1.0) { red = red / blue; green = green / blue; blue = 1.0; } <START> int redRounded = ensureRgbRange((int) Math.round(red * 255.0)); <END> int greenRounded = ensureRgbRange((int) Math.round(green * 255.0)); int blueRounded = ensureRgbRange((int) Math.round(blue * 255.0)); HSBType hsbType = constructHsbTypeFromRgbWithBrightnessPercent(redRounded, greenRounded, blueRounded, brightness); int rgbR = (int) (hsbType.getRed().intValue() * 2.55); int rgbG = (int) (hsbType.getGreen().intValue() * 2.55); int rgbB = (int) (hsbType.getBlue().intValue() * 2.55); return new TradfriColor(rgbR, rgbG, rgbB, xyX, xyY, brightness, hsbType); }</code><technical_language>I if this is right place for fix. red/green/blue is negative 1? is checked in lines 108-120 need check for negative numbers</technical_language>

Target:
public static TradfriColor fromCie(int xyX, int xyY, int xyBrightness) { int brightness = xyBrightness; if (brightness > 254) { brightness = 254; } double x = unnormalize(xyX); double y = unnormalize(xyY); double z = 1.0 - x - y; double Y = (brightness / 254.0); double X = (Y / y) * x; double Z = (Y / y) * z; double red = X * 1.656492 - Y * 0.354851 - Z * 0.255038; double green = -X * 0.707196 + Y * 1.655397 + Z * 0.036152; double blue = X * 0.051713 - Y * 0.121364 + Z * 1.011530; if (red > blue && red > green && red > 1.0) { green = green / red; blue = blue / red; red = 1.0; } else if (green > blue && green > red && green > 1.0) { red = red / green; blue = blue / green; green = 1.0; } else if (blue > red && blue > green && blue > 1.0) { red = red / blue; green = green / blue; blue = 1.0; } red = Math.max(0.0, red); green = Math.max(0.0, green); blue = Math.max(0.0, blue); int redRounded = (int) Math.round(red * 255.0); int greenRounded = (int) Math.round(green * 255.0); int blueRounded = (int) Math.round(blue * 255.0); HSBType hsbType = constructHsbTypeFromRgbWithBrightnessPercent(redRounded, greenRounded, blueRounded, brightness); int rgbR = (int) (hsbType.getRed().intValue() * 2.55); int rgbG = (int) (hsbType.getGreen().intValue() * 2.55); int rgbB = (int) (hsbType.getBlue().intValue() * 2.55); return new TradfriColor(rgbR, rgbG, rgbB, xyX, xyY, brightness, hsbType); }
Source:
<code>public void checkLedger(final LedgerHandle lh, final GenericCallback<Set<LedgerFragment>> cb) { <START> checkLedger(lh, cb, 100L); <END> }</code><technical_language>interesting, this setting enforce checking entries, no? @govind-menon confirm is purpose of this</technical_language>

Target:
public void checkLedger(final LedgerHandle lh, final GenericCallback<Set<LedgerFragment>> cb) { checkLedger(lh, cb, 0L); }
Source:
<code>public Magnitude(Band band, double brightness) { <START> this(band, brightness, None.INSTANCE, band != null ? band.defaultSystem : System.DEFAULT); <END> }</code><technical_language>If band is null constructor throw IllegalArgumentExceptionwhich a NullPointerException. In other words, I band.defaultSystem null check is okay</technical_language>

Target:
public Magnitude(Band band, double brightness) { this(band, brightness, None.INSTANCE, band.defaultSystem); }
Source:
<code>private void updateFavourites(){ <START> LogHelper.d("FAVOURITES", "Favourites Pref: " + sp.getString("stored", "wot")); <END> if (BusStorage.hasFavourites(sp)) { LogHelper.d("FAVOURITES", "Has Favourites. Processing"); StaticVariables.INSTANCE.setFavouritesList(BusStorage.getStoredBuses(sp)); adapter.updateAdapter(StaticVariables.INSTANCE.getFavouritesList(), null); adapter.notifyDataSetChanged(); LogHelper.d("FAVOURITES", "Finished Processing, retrieving estimated arrival data now"); new GetBusServicesFavouritesRecycler(this, adapter).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, StaticVariables.INSTANCE.getFavouritesList().toArray(new BusServices[0])); LogHelper.d("FAVOURITES", "Finished casting AsyncTasks to retrieve estimated arrival data"); } if (swipeToRefresh.isRefreshing()){ swipeToRefresh.setRefreshing(false); } }</code><technical_language>Define a constant instead of duplicating this literal "FAVOURITES" 4 times</technical_language>

Target:
private void updateFavourites(){ final String TAG = "FAVOURITES"; LogHelper.d(TAG, "Favourites Pref: " + sp.getString("stored", "wot")); if (BusStorage.hasFavourites(sp)) { LogHelper.d(TAG, "Has Favourites. Processing"); StaticVariables.INSTANCE.setFavouritesList(BusStorage.getStoredBuses(sp)); adapter.updateAdapter(StaticVariables.INSTANCE.getFavouritesList(), null); adapter.notifyDataSetChanged(); LogHelper.d(TAG, "Finished Processing, retrieving estimated arrival data now"); new GetBusServicesFavouritesRecycler(this, adapter).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, StaticVariables.INSTANCE.getFavouritesList().toArray(new BusServices[0])); LogHelper.d(TAG, "Finished casting AsyncTasks to retrieve estimated arrival data"); } if (swipeToRefresh.isRefreshing()){ swipeToRefresh.setRefreshing(false); } }
Source:
<code>public void handleTransitionToStandByInNewThread() { <START> new Thread() { <END> @Override public void run() { if (rmContext.isHAEnabled()) { try { LOG.info("Transitioning RM to Standby mode"); transitionToStandby(true); EmbeddedElector elector = rmContext.getLeaderElectorService(); if (elector != null) { elector.rejoinElection(); } } catch (Exception e) { LOG.fatal("Failed to transition RM to Standby mode.", e); ExitUtil.terminate(1, e); } } } }.start(); }</code><technical_language>Instead of anonymous class, define this a separate Thread name for easier debugging</technical_language>

Target:
public void handleTransitionToStandByInNewThread() { Thread standByTransitionThread = new Thread(activeServices.standByTransitionRunnable); standByTransitionThread.setName("StandByTransitionThread"); standByTransitionThread.start(); }
Source:
<code>public void writeFrom(ReadableByteChannel channel, long offset, long size) throws IOException { logger.trace("Log : currentWriteOffset capacityInBytes sizeToAppend offset {}", file.getAbsolutePath(), currentWriteOffset, capacityInBytes, size, offset); if (offset < 0 || offset + size > currentWriteOffset.get()) { metrics.overflowWriteError.inc(1); throw new IllegalArgumentException("Log : " + file.getAbsolutePath() + " error trying to write to log " + "from channel since new data size " + size + "exceeds log end offset " + currentWriteOffset.get()); } long bytesWritten = 0; while (bytesWritten < size) { bytesWritten += fileChannel.transferFrom(channel, offset + bytesWritten, size - bytesWritten); } <START> logger.trace("Log : bytes appended to the log from read channel at {}, bytesWritten: {}", file.getAbsolutePath(), <END> offset, bytesWritten); }</code><technical_language>"appended" ? want rephrase this</technical_language>

Target:
public void writeFrom(ReadableByteChannel channel, long offset, long size) throws IOException { logger.trace("Log : currentWriteOffset capacityInBytes sizeToAppend offset to append at {}", file.getAbsolutePath(), currentWriteOffset, capacityInBytes, size, offset); if (offset < 0 || offset + size > currentWriteOffset.get()) { metrics.overflowWriteError.inc(1); throw new IllegalArgumentException("Log : " + file.getAbsolutePath() + " error trying to write to log " + "from channel since new data size " + size + "exceeds log end offset " + currentWriteOffset.get()); } long bytesWritten = 0; while (bytesWritten < size) { bytesWritten += fileChannel.transferFrom(channel, offset + bytesWritten, size - bytesWritten); } logger.trace("Log : bytes written to the log from read channel at {}, bytesWritten: {}", file.getAbsolutePath(), offset, bytesWritten); }
Source:
<code>public void postEvents(int id) throws Exception { final ServerDiscoverySelector eventReceiverSelector = factory.createSelector(EVENT_RECEIVER_SERVICE_PREFIX + id); eventReceiverSelector.start(); try { ServerDiscoveryUtil.waitUntilInstanceReady(eventReceiverSelector, "Event Receiver"); String host = config.getMiddleManagerHost() + ":" + eventReceiverSelector.pick().getPort(); LOG.info("Event Receiver Found at host [%s]", host); LOG.info("Checking worker /status/health for [%s]", host); <START> final StatusResponseHandler handler = StatusResponseHandler.getInstance(); <END> RetryUtil.retryUntilTrue( () -> { try { StatusResponseHolder response = httpClient.go( new Request(HttpMethod.GET, new URL(StringUtils.format("https://%s/status/health", host))), handler ).get(); return response.getStatus().equals(HttpResponseStatus.OK); } catch (Throwable e) { LOG.error(e, ""); return false; } }, StringUtils.format("Checking /status/health for worker [%s]", host) ); LOG.info("Finished checking worker /status/health for [%s], success", host); EventReceiverFirehoseTestClient client = new EventReceiverFirehoseTestClient( host, EVENT_RECEIVER_SERVICE_PREFIX + id, jsonMapper, httpClient, smileMapper ); client.postEventsFromFile(UNION_DATA_FILE); } finally { eventReceiverSelector.stop(); } }</code><technical_language>This variable is unnecessary now</technical_language>

Target:
public void postEvents(int id) throws Exception { final ServerDiscoverySelector eventReceiverSelector = factory.createSelector(EVENT_RECEIVER_SERVICE_PREFIX + id); eventReceiverSelector.start(); try { ServerDiscoveryUtil.waitUntilInstanceReady(eventReceiverSelector, "Event Receiver"); String host = config.getMiddleManagerHost() + ":" + eventReceiverSelector.pick().getPort(); LOG.info("Event Receiver Found at host [%s]", host); LOG.info("Checking worker /status/health for [%s]", host); RetryUtil.retryUntilTrue( () -> { try { StatusResponseHolder response = httpClient.go( new Request(HttpMethod.GET, new URL(StringUtils.format("https://%s/status/health", host))), StatusResponseHandler.getInstance() ).get(); return response.getStatus().equals(HttpResponseStatus.OK); } catch (Throwable e) { LOG.error(e, ""); return false; } }, StringUtils.format("Checking /status/health for worker [%s]", host) ); LOG.info("Finished checking worker /status/health for [%s], success", host); EventReceiverFirehoseTestClient client = new EventReceiverFirehoseTestClient( host, EVENT_RECEIVER_SERVICE_PREFIX + id, jsonMapper, httpClient, smileMapper ); client.postEventsFromFile(UNION_DATA_FILE); } finally { eventReceiverSelector.stop(); } }
Source:
<code>private void select(Element elementToSelect) { if (elementToSelect == null) { return; } Element currentSelectedElement = getSelectedElement(); if (currentSelectedElement == null) { elementToSelect.setAttribute("selected", "true"); return; } <START> if (currentSelectedElement == elementToSelect) { <END> return; } currentSelectedElement.removeAttribute("selected"); elementToSelect.setAttribute("selected", "true"); }</code><technical_language>try currentSelectedElement.isEqualNode(elementToSelect)</technical_language>

Target:
private void select(Element elementToSelect) { if (elementToSelect == null) { return; } Element currentSelectedElement = getSelectedElement(); if (currentSelectedElement == null) { elementToSelect.setAttribute("selected", "true"); return; } if (currentSelectedElement.isEqualNode(elementToSelect)) { return; } currentSelectedElement.removeAttribute("selected"); elementToSelect.setAttribute("selected", "true"); }
Source:
<code><START> public Object handle(ProceedingJoinPoint proceedingJoinPoint, CircuitBreaker circuitBreaker, String methodName) throws Throwable { <END> CircuitBreakerOperator circuitBreakerOperator = CircuitBreakerOperator.of(circuitBreaker); Object returnValue = proceedingJoinPoint.proceed(); if (returnValue instanceof ObservableSource) { Observable<?> observable = (Observable) returnValue; return observable.lift(circuitBreakerOperator); } else if (returnValue instanceof SingleSource) { Single<?> single = (Single) returnValue; return single.lift(circuitBreakerOperator); } else if (returnValue instanceof CompletableSource) { Completable completable = (Completable) returnValue; return completable.lift(circuitBreakerOperator); } else if (returnValue instanceof MaybeSource) { Maybe<?> maybe = (Maybe) returnValue; return maybe.lift(circuitBreakerOperator); } else if (returnValue instanceof Flowable) { Flowable<?> flowable = (Flowable) returnValue; return flowable.lift(circuitBreakerOperator); } else { logger.error("Unsupported type for RxJava2 circuit breaker {}", returnValue.getClass().getTypeName()); throw new IllegalArgumentException("Not Supported type for the circuit breaker in RxJava2:" + returnValue.getClass().getName()); } }</code><technical_language>methodName is or</technical_language>

Target:
public Object handle(ProceedingJoinPoint proceedingJoinPoint, CircuitBreaker circuitBreaker, String methodName) throws Throwable { CircuitBreakerOperator circuitBreakerOperator = CircuitBreakerOperator.of(circuitBreaker); Object returnValue = proceedingJoinPoint.proceed(); if (returnValue instanceof ObservableSource) { Observable<?> observable = (Observable) returnValue; return observable.lift(circuitBreakerOperator); } else if (returnValue instanceof SingleSource) { Single<?> single = (Single) returnValue; return single.lift(circuitBreakerOperator); } else if (returnValue instanceof CompletableSource) { Completable completable = (Completable) returnValue; return completable.lift(circuitBreakerOperator); } else if (returnValue instanceof MaybeSource) { Maybe<?> maybe = (Maybe) returnValue; return maybe.lift(circuitBreakerOperator); } else if (returnValue instanceof Flowable) { Flowable<?> flowable = (Flowable) returnValue; return flowable.lift(circuitBreakerOperator); } else { logger.error("Unsupported type for RxJava2 circuit breaker return type for method {}", returnValue.getClass().getTypeName(), methodName); throw new IllegalArgumentException("Not Supported type for the circuit breaker in RxJava2:" + returnValue.getClass().getName()); } }
Source:
<code>public void findOptimalSolution(ResolutionPolicy policy, RealVar objective, double precision) { if (policy == ResolutionPolicy.SATISFACTION) { throw new SolverException("Solver.findOptimalSolution(...) can not be called with ResolutionPolicy.SATISFACTION."); } if (objective == null) { throw new SolverException("No objective variable has been defined"); } if (!getObjectiveManager().isOptimization()) { set(new ObjectiveManager<RealVar, Double>(objective, policy, precision, true)); } <START> ISolutionRecorder oldRecorder = getSolutionRecorder(); <END> LastSolutionRecorder recorder = new LastSolutionRecorder(new Solution(), true, this); set(recorder); try { solve(false); } finally { set(oldRecorder); recorder.stop(); } }</code><technical_language>is point in storing previous solution recorder</technical_language>

Target:
public void findOptimalSolution(ResolutionPolicy policy, RealVar objective, double precision) { if (policy == ResolutionPolicy.SATISFACTION) { throw new SolverException("Solver.findOptimalSolution(...) can not be called with ResolutionPolicy.SATISFACTION."); } if (objective == null) { throw new SolverException("No objective variable has been defined"); } if (!getObjectiveManager().isOptimization()) { set(new ObjectiveManager<RealVar, Double>(objective, policy, precision, true)); } LastSolutionRecorder recorder = new LastSolutionRecorder(new Solution(), true, this); try { solve(false); } finally { recorder.stop(); } }
Source:
<code>public static List<MetaSyntax> listSyntaxes(String fileType) { List<MetaSyntax> list = new ArrayList<>(); if (fileType.matches("^$|java|c|cpp|h|hpp|js")) { list.add(new MetaSyntax("\\/\\/", "")); list.add(new MetaSyntax("\\/\\*+", "\\*+\\/")); } if (fileType.matches("^$|xml|http|html")) { list.add(new MetaSyntax("<!--", "-->")); } <START> if (list.isEmpty() && !fileType.isEmpty()) return listSyntaxes(""); <END> return list; }</code><technical_language>explicit blocks for one-liners. I wondering this behavior is preferable returning empty list. for breaks [Principle of Astonishment](<LINK_0> "we do do everything" vs. "we do do nothing"</technical_language>

Target:
public static List<MetaSyntax> listSyntaxes(String fileType) { List<MetaSyntax> list = new ArrayList<>(); if (fileType.matches("java|c|cpp|h|hpp|js|css")) { list.add(new MetaSyntax("\\/\\/", "")); list.add(new MetaSyntax("\\/\\*+", "\\*+\\/")); } if (fileType.matches("xml|http|html")) { list.add(new MetaSyntax("<!--", "-->")); } if (fileType.matches("properties")) { list.add(new MetaSyntax("#", "")); } return list; }
Source:
<code>public void testClosePlaceAlwaysCloseActivityBeforeDestroy() { when(kansasActivity.isType(any())).thenReturn(false); placeManager.closePlace(kansas); verify(kansasActivity).onClose(); <START> verify(activityManager).destroyActivity(kansasActivity); <END> }</code><technical_language>verify order of calls too? onClose() executed destroy called? a hard req, thinking give coverage</technical_language>

Target:
public void testClosePlaceAlwaysCloseActivityBeforeDestroy() { when(kansasActivity.isType(any())).thenReturn(false); placeManager.closePlace(kansas); InOrder inOrder = inOrder(activityManager, kansasActivity); inOrder.verify(kansasActivity).onClose(); inOrder.verify(activityManager).destroyActivity(kansasActivity); }
Source:
<code>private static String getCpuId(Cluster model) { String cpuId = model.getCpu().getId(); if (cpuId.equals("IBM POWER 8")) { cpuId = "IBM POWER8"; } if (cpuId.equals("IBM POWER 8E")) { cpuId = "IBM POWER8E"; } return cpuId; <START> } <END></code><technical_language>confused - I change 'IBM POWER 8E' convert 'IBM POWER v1.0' changed.. need convert POWER 8E in config convert v1.0 for compatibility well</technical_language>

Target:
private static String getCpuId(Cluster model) { String cpuId = model.getCpu().getId(); if (cpuId.equals("IBM POWER 8")) { cpuId = "IBM POWER8"; } if (cpuId.equals("IBM POWER 8 v1.0")) { cpuId = "IBM POWER8 v1.0"; } return cpuId; }
Source:
<code>public final boolean incrementToken() throws IOException { if (state != null) { restoreState(state); if (toCyrillic.length() > 0) { <START> termAtt.setEmpty(); <END> termAtt.append(toCyrillic); posIncr.setPositionIncrement(0); toCyrillic.setLength(0); if (toLatin.length() == 0) { state = null; } return true; } if (toLatin.length() > 0) { termAtt.setEmpty(); termAtt.append(toLatin); posIncr.setPositionIncrement(0); toLatin.setLength(0); state = null; return true; } assert false; } if (!input.incrementToken()) { return false; } boolean matchesCyrillicAndLatin = LATIN_REG.matcher(termAtt).find() && CYR_REG.matcher(termAtt).find(); if (matchesCyrillicAndLatin) { replaceScripts(toCyrillic, latinToCyrillic); replaceScripts(toLatin, cyrillicToLatin); if (!LATIN_REG.matcher(toCyrillic).find()) { state = captureState(); } else { toCyrillic.setLength(0); } if (!CYR_REG.matcher(toLatin).find()) { if (state == null) { state = captureState(); } } else { toLatin.setLength(0); } } return true; }</code><technical_language>nit: extract a method "replayTerm(toCyrillic)" this? reused in toLatin case</technical_language>

Target:
public final boolean incrementToken() throws IOException { if (state != null) { restoreState(state); if (toCyrillic.length() > 0) { replayTerm(toCyrillic); if (toLatin.length() == 0) { state = null; } return true; } if (toLatin.length() > 0) { replayTerm(toLatin); state = null; return true; } assert false; } if (!input.incrementToken()) { return false; } boolean matchesCyrillicAndLatin = hasChars(LATIN_REG) && hasChars(CYR_REG); if (matchesCyrillicAndLatin) { toCyrillic.setLength(0); toCyrillic.append(termAtt); translationTable.replaceLatinToCyrillic(toCyrillic); toLatin.setLength(0); toLatin.append(termAtt); translationTable.replaceCyrillicToLatin(toLatin); if (!LATIN_REG.matcher(toCyrillic).find()) { state = captureState(); } else { toCyrillic.setLength(0); } if (!CYR_REG.matcher(toLatin).find()) { if (state == null) { state = captureState(); } } else { toLatin.setLength(0); } } return true; }
Source:
<code><START> public static<T> Func1<NetworkRequestStatus, DataStreamNotification<T>> fromNetworkRequestStatus() { <END> return networkRequestStatus -> { if (networkRequestStatus.isOngoing()) { return DataStreamNotification.fetchingStart(); } else if (networkRequestStatus.isCompleted()) { return DataStreamNotification.fetchingCompleted(); } else if (networkRequestStatus.isError()) { return DataStreamNotification.fetchingError(); } else { return null; } }; }</code><technical_language>public</technical_language>

Target:
private static<T> Func1<NetworkRequestStatus, DataStreamNotification<T>> fromNetworkRequestStatus() { return networkRequestStatus -> { switch (networkRequestStatus.getStatus()) { case NETWORK_STATUS_ONGOING: return DataStreamNotification.fetchingStart(); case NETWORK_STATUS_COMPLETED: return DataStreamNotification.fetchingCompleted(); case NETWORK_STATUS_ERROR: return DataStreamNotification.fetchingError(); } throw new IllegalStateException("Unexpected network status " + networkRequestStatus); }; }
Source:
<code>private void handleLocalIndexUpdates(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp, ListMultimap<HTableInterfaceReference, Pair<Mutation, byte[]>> indexUpdates) { byte[] tableName = c.getEnvironment().getRegion().getTableDescriptor().getTableName().getName(); HTableInterfaceReference hTableInterfaceReference = new HTableInterfaceReference(new ImmutableBytesPtr(tableName)); List<Pair<Mutation, byte[]>> localIndexUpdates = indexUpdates.removeAll(hTableInterfaceReference); <START> if (localIndexUpdates == null) { <END> return; } List<Mutation> localUpdates = new ArrayList<Mutation>(); Iterator<Pair<Mutation, byte[]>> indexUpdatesItr = localIndexUpdates.iterator(); while (indexUpdatesItr.hasNext()) { Pair<Mutation, byte[]> next = indexUpdatesItr.next(); localUpdates.add(next.getFirst()); } if (!localUpdates.isEmpty()) { miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()])); } }</code><technical_language>I removeAll return empty list null. add a size check</technical_language>

Target:
private void handleLocalIndexUpdates(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp, ListMultimap<HTableInterfaceReference, Pair<Mutation, byte[]>> indexUpdates) { byte[] tableName = c.getEnvironment().getRegion().getTableDescriptor().getTableName().getName(); HTableInterfaceReference hTableInterfaceReference = new HTableInterfaceReference(new ImmutableBytesPtr(tableName)); List<Pair<Mutation, byte[]>> localIndexUpdates = indexUpdates.removeAll(hTableInterfaceReference); if (localIndexUpdates == null || localIndexUpdates.isEmpty()) { return; } List<Mutation> localUpdates = new ArrayList<Mutation>(); Iterator<Pair<Mutation, byte[]>> indexUpdatesItr = localIndexUpdates.iterator(); while (indexUpdatesItr.hasNext()) { Pair<Mutation, byte[]> next = indexUpdatesItr.next(); localUpdates.add(next.getFirst()); } if (!localUpdates.isEmpty()) { miniBatchOp.addOperationsFromCP(0, localUpdates.toArray(new Mutation[localUpdates.size()])); } }
Source:
<code>public void onCreate() { super.onCreate(); WikiSite.setDefaultBaseUrl(Prefs.getMediaWikiBaseUrl()); <START> eventPlatformClient = EventPlatformClient.getInstance(); <END> registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); initExceptionHandling(); LeakCanaryStubKt.setupLeakCanary(); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); RxJavaPlugins.setErrorHandler(Functions.emptyConsumer()); bus = new RxBus(); ViewAnimations.init(getResources()); currentTheme = unmarshalTheme(Prefs.getCurrentThemeId()); appLanguageState = new AppLanguageState(this); updateCrashReportProps(); funnelManager = new FunnelManager(this); sessionFunnel = new SessionFunnel(this); database = new Database(this); initTabs(); enableWebViewDebugging(); registerActivityLifecycleCallbacks(activityLifecycleHandler); NotificationPollBroadcastReceiver.startPollTask(this); InstallReferrerListener.newInstance(this); WikipediaFirebaseMessagingService.Companion.updateSubscription(); }</code><technical_language>This potentially crash app startup, fire a network call (refreshStreamConfigs) else is initialized. This initialized in this sequence</technical_language>

Target:
public void onCreate() { super.onCreate(); WikiSite.setDefaultBaseUrl(Prefs.getMediaWikiBaseUrl()); registerReceiver(connectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); initExceptionHandling(); LeakCanaryStubKt.setupLeakCanary(); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); RxJavaPlugins.setErrorHandler(Functions.emptyConsumer()); bus = new RxBus(); ViewAnimations.init(getResources()); currentTheme = unmarshalTheme(Prefs.getCurrentThemeId()); appLanguageState = new AppLanguageState(this); updateCrashReportProps(); funnelManager = new FunnelManager(this); sessionFunnel = new SessionFunnel(this); database = new Database(this); initTabs(); enableWebViewDebugging(); registerActivityLifecycleCallbacks(activityLifecycleHandler); NotificationPollBroadcastReceiver.startPollTask(this); InstallReferrerListener.newInstance(this); WikipediaFirebaseMessagingService.Companion.updateSubscription(); EventPlatformClient.setUpStreamConfigs(); }
Source:
<code>private static void submitTopologyToFile(TopologyAPI.Topology fTopology, Map<String, String> heronCmdOptions) { String dirName = heronCmdOptions.get(CMDLINE_TOPOLOGY_DEFINITION_TMP_DIRECTORY); if (dirName == null || dirName.isEmpty()) { throw new TopologySubmissionException("Topology definition temp directory not specified. " + "Please set cmdline option: " + CMDLINE_TOPOLOGY_DEFINITION_TMP_DIRECTORY); } <START> String fileName = dirName + "/" + fTopology.getName() + TOPOLOGY_DEFINITION_SUFFIX; <END> try (FileOutputStream fos = new FileOutputStream(new File(fileName)); BufferedOutputStream bos = new BufferedOutputStream(fos)) { byte[] topEncoding = fTopology.toByteArray(); bos.write(topEncoding); } catch (IOException e) { throw new TopologySubmissionException("Error writing topology definition to temp directory: " + dirName, e); } }</code><technical_language>@erenavsarogullari - instead of slash - Java Path class - more generic</technical_language>

Target:
private static void submitTopologyToFile(TopologyAPI.Topology fTopology, Map<String, String> heronCmdOptions) { String dirName = heronCmdOptions.get(CMD_TOPOLOGY_DEFN_TEMPDIR); if (dirName == null || dirName.isEmpty()) { throw new TopologySubmissionException("Topology definition temp directory not specified. " + "Please set cmdline option: " + CMD_TOPOLOGY_DEFN_TEMPDIR); } String fileName = Paths.get(dirName, fTopology.getName() + TOPOLOGY_DEFINITION_SUFFIX).toString(); try (FileOutputStream fos = new FileOutputStream(new File(fileName)); BufferedOutputStream bos = new BufferedOutputStream(fos)) { byte[] topEncoding = fTopology.toByteArray(); bos.write(topEncoding); } catch (IOException e) { throw new TopologySubmissionException("Error writing topology definition to temp directory: " + dirName, e); } }
Source:
<code>public void tearDown() { if (realm.isInTransaction()) { <START> <END> realm.cancelTransaction(); } realm.close(); }</code><technical_language>whitespace</technical_language>

Target:
public void tearDown() { realm.cancelTransaction(); realm.close(); }
Source:
<code>private static Map<String, String> flattenParams(Map<String, Object> params) throws InvalidRequestException { if (params == null) { return new HashMap<String, String>(); } Map<String, String> flatParams = new LinkedHashMap<String, String>(); for (Map.Entry<String, Object> entry : params.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (value instanceof Map<?, ?>) { Map<String, Object> flatNestedMap = new LinkedHashMap<String, Object>(); Map<?, ?> nestedMap = (Map<?, ?>) value; for (Map.Entry<?, ?> nestedEntry : nestedMap.entrySet()) { flatNestedMap.put( String.format("%s[%s]", key, nestedEntry.getKey()), nestedEntry.getValue()); } flatParams.putAll(flattenParams(flatNestedMap)); } else if (value instanceof List<?>) { Map<String, Object> flatNestedMap = new LinkedHashMap<String, Object>(); int index = 0; <START> for (Object element : (List<?>) value) { <END> flatNestedMap.put(String.format("%s[%s]", key, index), element); index += 1; } flatParams.putAll(flattenParams(flatNestedMap)); } else if ("".equals(value)) { throw new InvalidRequestException("You cannot set '"+key+"' to an empty string. "+ "We interpret empty strings as null in requests. "+ "You may set '"+key+"' to null to delete the property.", key, null); } else if (value == null) { flatParams.put(key, ""); } else { flatParams.put(key, value.toString()); } } return flatParams; }</code><technical_language>This cleaner. allocate a new object for iteration of loop: java Iterator<?> myIter = value.iterator(); for (int index=0; myIter.hasNext(); ++index) { flatNestedMap.put(String.format("%s[%s], key, index), myIter.next()); } correct, feel free #ignore</technical_language>

Target:
private static Map<String, String> flattenParams(Map<String, Object> params) throws InvalidRequestException { if (params == null) { return new HashMap<String, String>(); } Map<String, String> flatParams = new LinkedHashMap<String, String>(); for (Map.Entry<String, Object> entry : params.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (value instanceof Map<?, ?>) { Map<String, Object> flatNestedMap = new LinkedHashMap<String, Object>(); Map<?, ?> nestedMap = (Map<?, ?>) value; for (Map.Entry<?, ?> nestedEntry : nestedMap.entrySet()) { flatNestedMap.put( String.format("%s[%s]", key, nestedEntry.getKey()), nestedEntry.getValue()); } flatParams.putAll(flattenParams(flatNestedMap)); } else if (value instanceof List<?>) { Map<String, Object> flatNestedMap = new LinkedHashMap<String, Object>(); Iterator<?> it = ((List<?>)value).iterator(); for (int index = 0; it.hasNext(); ++index) { flatNestedMap.put(String.format("%s[%s]", key, index), it.next()); } flatParams.putAll(flattenParams(flatNestedMap)); } else if ("".equals(value)) { throw new InvalidRequestException("You cannot set '"+key+"' to an empty string. "+ "We interpret empty strings as null in requests. "+ "You may set '"+key+"' to null to delete the property.", key, null); } else if (value == null) { flatParams.put(key, ""); } else { flatParams.put(key, value.toString()); } } return flatParams; }
Source:
<code>public void setText(final String text) { <START> if (this.text != null) { <END> this.text.setText(text); return; } this.text = new Text(text); add(this.text, (Element) getElement()); }</code><technical_language>better/easier Text created/added in constructor set/get there? try that</technical_language>

Target:
public void setText(final String text) { this.text = new Text(text); add(this.text, (Element) getElement()); }
Source:
<code>private void getEditorSetting(NotebookSocket conn, Message fromMessage) throws IOException { String paragraphId = (String) fromMessage.get("paragraphId"); String replName = (String) fromMessage.get("magic"); String noteId = getOpenNoteId(conn); <START> String user = SecurityUtils.getPrincipal(); <END> Message resp = new Message(OP.EDITOR_SETTING); resp.put("paragraphId", paragraphId); resp.put("editor", notebook().getInterpreterFactory().getEditorSetting(user, noteId, replName)); conn.send(serializeMessage(resp)); return; }</code><technical_language>here, fromMessage->principal more sense</technical_language>

Target:
private void getEditorSetting(NotebookSocket conn, Message fromMessage) throws IOException { String paragraphId = (String) fromMessage.get("paragraphId"); String replName = (String) fromMessage.get("magic"); String noteId = getOpenNoteId(conn); String user = fromMessage.principal; Message resp = new Message(OP.EDITOR_SETTING); resp.put("paragraphId", paragraphId); resp.put("editor", notebook().getInterpreterFactory().getEditorSetting(user, noteId, replName)); conn.send(serializeMessage(resp)); return; }
Source:
<code>public void reproduceIssue(XmlSuite.FailurePolicy policy, String[] expectedMsgs) { TestNG testNG = create(ExampleClassSample.class); testNG.setConfigFailurePolicy(policy); ExampleClassListener listener = new ExampleClassListener(); testNG.addListener((ITestNGListener) listener); testNG.run(); assertThat(listener.messages.size()).isEqualTo(4); String[] expected = new String[]{ "beforeInvocation:_test_method: test1", "afterInvocation:_test_method: test1", "beforeInvocation:_test_method: test2", "afterInvocation:_test_method: test2" }; assertThat(listener.messages).containsExactly(expected); <START> assertThat(listener.configMsgs.size()).isEqualTo(expectedMsgs.length); <END> assertThat(listener.configMsgs).containsExactly(expectedMsgs); }</code><technical_language>Useless containsExactly check a error message fails</technical_language>

Target:
public void reproduceIssue(XmlSuite.FailurePolicy policy, String[] expectedMsgs) { TestNG testNG = create(ExampleClassSample.class); testNG.setConfigFailurePolicy(policy); ExampleClassListener listener = new ExampleClassListener(); testNG.addListener((ITestNGListener) listener); testNG.run(); String[] expected = new String[]{ "beforeInvocation:_test_method: test1", "afterInvocation:_test_method: test1", "beforeInvocation:_test_method: test2", "afterInvocation:_test_method: test2" }; assertThat(listener.messages).containsExactly(expected); assertThat(listener.configMsgs).containsExactly(expectedMsgs); }
Source:
<code>public void checkReservedUnixGroupNames(Attribute groupNameAttribute) throws InternalErrorException, WrongAttributeValueException { if(groupNameAttribute == null) return; if (perunNamespaces == null) { <START> perunNamespaces = BeansUtils.getAllPropertiesFromCustomConfiguration("perun-namespaces.properties"); <END> } String reservedNames; if ((reservedNames = perunNamespaces.get(groupNameAttribute.getFriendlyName() + ":reservedNames")) != null) { List<String> reservedNamesList = Arrays.asList(reservedNames.split("\\s*,\\s*")); if (reservedNamesList.contains(groupNameAttribute.getValue())) throw new WrongAttributeValueException(groupNameAttribute, "This groupName is reserved."); } else { if (reservedNamesForUnixGroups.contains(groupNameAttribute.getValue())) throw new WrongAttributeValueException(groupNameAttribute, "This groupName is reserved."); } }</code><technical_language>If file exception is thrown (when file exists, correct status), Internal Error Exception is thrown fail. In this case need set perunNamespaces map empty continue</technical_language>

Target:
public void checkReservedUnixGroupNames(Attribute groupNameAttribute) throws InternalErrorException, WrongAttributeValueException { if(groupNameAttribute == null) return; checkPerunNamespacesMap(); String reservedNames = perunNamespaces.get(groupNameAttribute.getFriendlyName() + ":reservedNames"); if (reservedNames != null) { List<String> reservedNamesList = Arrays.asList(reservedNames.split("\\s*,\\s*")); if (reservedNamesList.contains(groupNameAttribute.getValue())) throw new WrongAttributeValueException(groupNameAttribute, "This groupName is reserved."); } else { if (reservedNamesForUnixGroups.contains(groupNameAttribute.getValue())) throw new WrongAttributeValueException(groupNameAttribute, "This groupName is reserved."); } }
Source:
<code>private Promise<Breakpoint> toBreakpointPromise(Promise<Optional<File>> filePromise, BreakpointDto dto) { <START> return filePromise.then(new Function<Optional<File>, Breakpoint>() { <END> @Override public Breakpoint apply(Optional<File> file) throws FunctionException { return file.isPresent() ? new Breakpoint(BREAKPOINT, dto.getLocation().getLineNumber(), dto.getLocation().getTarget(), file.get(), false) : null; } }).catchError(new Function<PromiseError, Breakpoint>() { @Override public Breakpoint apply(PromiseError arg) throws FunctionException { return null; } }); }</code><technical_language>lambda</technical_language>

Target:
private Promise<Breakpoint> toBreakpointPromise(Promise<Optional<File>> filePromise, BreakpointDto dto) { return filePromise.then((Function<Optional<File>, Breakpoint>)file -> createBreakpoint(file.get(), dto)).catchError(error -> null); }