auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public final Void execute(final Input values, final ExecutionContext context) throws Exception { final Dimension size = values.map.getMapSize(); final double dpiRatio = values.map.getDpi() / PDF_DPI; final Dimension pixels = new Dimension((int) Math.ceil(size.width * dpiRatio), (int) Math.ceil(size.height * dpiRatio)); <START> if (pixels.height < maxHeight && pixels.width < maxWidth) { <END> return null; } final Dimension tileSize = adaptTileDimensions(pixels, maxWidth, maxHeight); final List<MapLayer> layers = values.map.getLayers(); for (int i = 0; i < layers.size(); i++) { final MapLayer layer = layers.get(i); context.stopIfCanceled(); if (layer instanceof WmsLayer) { final WmsLayer wmsLayer = (WmsLayer) layer; final WmsLayerParam params = wmsLayer.getParams(); if (matchers.matches(new URI(params.baseURL), HttpMethod.GET)) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Converting layer {}[{}] into a tiled WMS layer with tileSize={}x{}", wmsLayer.getParams().baseURL, String.join(", ", wmsLayer.getParams().layers), tileSize.width, tileSize.height); } values.map.replaceLayer(i, new TiledWmsLayer(wmsLayer, tileSize)); } } } return null; }</code><technical_language><=</technical_language>

Target:
public final Void execute(final Input values, final ExecutionContext context) throws Exception { final Dimension size = values.map.getMapSize(); final double dpiRatio = values.map.getDpi() / PDF_DPI; final Dimension pixels = new Dimension((int) Math.ceil(size.width * dpiRatio), (int) Math.ceil(size.height * dpiRatio)); if (pixels.height <= maxHeight && pixels.width <= maxWidth) { return null; } final Dimension tileSize = adaptTileDimensions(pixels, maxWidth, maxHeight); final List<MapLayer> layers = values.map.getLayers(); for (int i = 0; i < layers.size(); i++) { final MapLayer layer = layers.get(i); context.stopIfCanceled(); if (layer instanceof WmsLayer) { final WmsLayer wmsLayer = (WmsLayer) layer; final WmsLayerParam params = wmsLayer.getParams(); if (matchers.matches(new URI(params.baseURL), HttpMethod.GET)) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Converting layer {}[{}] into a tiled WMS layer with tileSize={}x{}", wmsLayer.getParams().baseURL, String.join(", ", wmsLayer.getParams().layers), tileSize.width, tileSize.height); } values.map.replaceLayer(i, new TiledWmsLayer(wmsLayer, tileSize)); } } } return null; }
Source:
<code>public static SharedStorage create(String id, int size, String state, String description, String cloudpanelId, int sizeUsed, String cifsPath, String nfsPath, String name, String creationDate, List<Server> servers) { <START> return new AutoValue_SharedStorage(id, size, state, description, cloudpanelId, sizeUsed, cifsPath, nfsPath, name, creationDate, servers == null ? ImmutableList.<Server>of() : servers); <END> }</code><technical_language>ImmutableList.copyOf server list is present</technical_language>

Target:
public static SharedStorage create(String id, int size, String state, String description, String cloudpanelId, int sizeUsed, String cifsPath, String nfsPath, String name, String creationDate, List<Server> servers) { return new AutoValue_SharedStorage(id, size, state, description, cloudpanelId, sizeUsed, cifsPath, nfsPath, name, creationDate, servers == null ? ImmutableList.<Server>of() : ImmutableList.copyOf(servers)); }
Source:
<code>@Override public String toString() { <START> return S.toString(ValidateIndexesCheckSizeIssue.class, this) + ", " + t.getClass() + ": " + t.getMessage(); <END> }</code><technical_language>This method throw *NullPointerException* if *t* is null. follows: return S.toString(ValidateIndexesCheckSizeIssue.class, this, "err", t);</technical_language>

Target:
@Override public String toString() { return S.toString(ValidateIndexesCheckSizeIssue.class, this, "err", t); }
Source:
<code>private static <T extends VmBase> void addImportedDisks(T entity, List<VmDevice> vmDeviceToUpdate) { final Guid id = entity.getId(); for (BaseDisk disk : getDisks(entity.getImages())) { Guid deviceId = disk.getId(); VmDevice vmDevice = addManagedDevice(new VmDeviceId(deviceId, id), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false, <START> ""); <END> updateVmDevice(entity, vmDevice, deviceId, vmDeviceToUpdate); } }</code><technical_language>please remove alias setting (should encapsulated in addManagedDevice</technical_language>

Target:
private static <T extends VmBase> void addImportedDisks(T entity, List<VmDevice> vmDeviceToUpdate) { final Guid id = entity.getId(); for (BaseDisk disk : getDisks(entity.getImages())) { Guid deviceId = disk.getId(); VmDevice vmDevice = addManagedDevice(new VmDeviceId(deviceId, id), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); updateVmDevice(entity, vmDevice, deviceId, vmDeviceToUpdate); } }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; <START> if (modeService.isReadOnlyEnabled()) { <END> if (!req.getMethod().equals("GET") && !isWhitelisted(req.getRequestURI())) { HttpServletResponse resp = ((HttpServletResponse) response); resp.sendError(SC_SERVICE_UNAVAILABLE, READ_ONLY_ERROR_MESSAGE); return; } } chain.doFilter(request, response); }</code><technical_language>I if 503 is correct this case. is wrong server. In opinion 403 better</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (modeService.isReadOnlyEnabled()) { HttpServletRequest req = (HttpServletRequest) request; if (!req.getMethod().equals("GET") && !isWhitelisted(req.getRequestURI())) { HttpServletResponse resp = ((HttpServletResponse) response); resp.sendError(SC_SERVICE_UNAVAILABLE, READ_ONLY_ERROR_MESSAGE); return; } } chain.doFilter(request, response); }
Source:
<code>protected SocketConfig buildSocketConfig() { <START> return SocketConfig.custom() <END> .setSoTimeout(readTimeout == -1 ? 0 : readTimeout) .build(); }</code><technical_language>I this return null if is timeout. I see, a null SocketConfig is supported occurs (if customizations)</technical_language>

Target:
protected SocketConfig buildSocketConfig() { if (readTimeout < 1) { return null; } return SocketConfig.custom() .setSoTimeout(readTimeout) .build(); }
Source:
<code>private void joinConflicts(UMLRTDiff change1, UMLRTDiff change2, Comparison comparison) { final Conflict change2Conflict = change2.getConflict(); change1.getConflict().getDifferences().addAll(change2Conflict.getDifferences()); <START> change1.getConflict().getDifferences().removeAll(change1.getRefinedBy()); change1.getConflict().getDifferences().removeAll(change2.getRefinedBy()); <END> comparison.getConflicts().remove(change2Conflict); }</code><technical_language>is this necessary? "join" refines well? If removing refines is desired included in test well</technical_language>

Target:
private void joinConflicts(UMLRTDiff change1, UMLRTDiff change2, Comparison comparison) { final Conflict change2Conflict = change2.getConflict(); change1.getConflict().getDifferences().addAll(change2Conflict.getDifferences()); comparison.getConflicts().remove(change2Conflict); }
Source:
<code>public static final int <START> hashCode(char[] <END> array) { int length = array.length; int hash = length == 0 ? 31 : array[0]; for (int i = length; --i > 0;) hash = (hash * 31) + array[i]; return hash & 0x7FFFFFFF; }</code><technical_language>java.util.Arrays.hashCode(char[])</technical_language>

Target:
public static final int hashCode(char[] array) { return Arrays.hashCode(array); }
Source:
<code><START> public void writeTo(AsyncWritableChannel channel, Callback<Long> callback) throws IOException { <END> prepareBuffer(); channel.write(bufferToSend, callback); }</code><technical_language>I recommend removing throws IOException interface. checked exception dealt calling callback.onComplete(null, ex). I this helps unify failure handling paths caller needs deal with</technical_language>

Target:
public void writeTo(AsyncWritableChannel channel, Callback<Long> callback) { prepareBuffer(); channel.write(bufferToSend, callback); }
Source:
<code>public void registerContext(final VmwareContext context) { assert (context.getPool() == this); assert (context.getPoolKey() != null); synchronized (this) { Queue<VmwareContext> ctxList = _pool.get(context.getPoolKey()); if (ctxList == null) { <START> ctxList = EvictingQueue.create(_maxIdleQueueLength); <END> _pool.put(context.getPoolKey(), ctxList); } if (ctxList.size() > _maxIdleQueueLength) { final VmwareContext oldestContext = ctxList.remove(); if (oldestContext != null) { try { oldestContext.close(); } catch (Throwable t) { s_logger.error("Unexpected exception caught while trying to purge oldest VmwareContext", t); } } } context.clearStockObjects(); ctxList.add(context); if (s_logger.isTraceEnabled()) { s_logger.trace("Recycle VmwareContext into idle pool: " + context.getPoolKey() + ", current idle pool size: " + ctxList.size() + ", outstanding count: " + VmwareContext.getOutstandingContextCount()); } } }</code><technical_language>get a synchronised evictingqueue</technical_language>

Target:
public void registerContext(final VmwareContext context) { assert (context.getPool() == this); assert (context.getPoolKey() != null); final String poolKey = context.getPoolKey().intern(); synchronized (poolKey) { Queue<VmwareContext> ctxQueue = _pool.get(poolKey); if (ctxQueue == null) { ctxQueue = new ConcurrentLinkedQueue<>(); _pool.put(poolKey, ctxQueue); } if (ctxQueue.size() >= _maxIdleQueueLength) { final VmwareContext oldestContext = ctxQueue.remove(); if (oldestContext != null) { try { oldestContext.close(); } catch (Throwable t) { s_logger.error("Unexpected exception caught while trying to purge oldest VmwareContext", t); } } } context.clearStockObjects(); ctxQueue.add(context); if (s_logger.isTraceEnabled()) { s_logger.trace("Recycle VmwareContext into idle pool: " + context.getPoolKey() + ", current idle pool size: " + ctxQueue.size() + ", outstanding count: " + VmwareContext.getOutstandingContextCount()); } } }
Source:
<code>public Optional<RGBValues> getFillColor() { RGBValues rgbValues = null; if (style instanceof NodeStyle) { rgbValues = new NodeStyleQuery((NodeStyle) style).getBackgroundColor().get(); } else if (style instanceof FlatContainerStyle) { rgbValues = ((FlatContainerStyle) style).getBackgroundColor(); } else if (style instanceof ShapeContainerStyle) { rgbValues = <START> ((FlatContainerStyle) style).getBackgroundColor(); <END> } return Optional.ofNullable(rgbValues); }</code><technical_language>Copy/Paste error: ShapeContainerStyle. This errors in tests: java.lang.ClassCastException: org.eclipse.sirius.diagram.business.internal.metamodel.spec.ShapeContainerStyleSpec cast org.eclipse.sirius.diagram.FlatContainerStyle org.eclipse.sirius.diagram.ui.business.internal.query.ColorStyleQuery.getFillColor(ColorStyleQuery.java:105)</technical_language>

Target:
public Optional<RGBValues> getFillColor() { RGBValues rgbValues = null; if (style instanceof NodeStyle) { rgbValues = new NodeStyleQuery((NodeStyle) style).getBackgroundColor().get(); } else if (style instanceof FlatContainerStyle) { rgbValues = ((FlatContainerStyle) style).getBackgroundColor(); } else if (style instanceof ShapeContainerStyle) { rgbValues = ((ShapeContainerStyle) style).getBackgroundColor(); } return Optional.ofNullable(rgbValues); }
Source:
<code>public final synchronized void putValue(@Nullable V value) { V cachedValue = this.value.get(); <START> if (cachedValue == null || !cachedValue.equals(value)) { <END> this.value = new SoftReference<>(value); expiresAt = System.nanoTime() + expiry; } }</code><technical_language>@cweitkamp If wants put a "now", check expiresAt updated? If expire is minute I call putValue(somemmutableObj) 30 seconds, I expect cached expires</technical_language>

Target:
public final synchronized void putValue(@Nullable V value) { this.value = new SoftReference<>(value); expiresAt = calcExpiresAt(); }
Source:
<code>public void reset() { attempt = 0; <START> currentSleepTime = baseRetryTimeoutMillis; <END> }</code><technical_language>this be: Math.min(baseRetryTimeoutMillis, capRetryTimeoutMillis)</technical_language>

Target:
public void reset() { attempt = 0; currentBackoffMillis = Math.min(maxBackoffMillis, initialBackoffMillis); }
Source:
<code>public IgniteTestResources(IgniteConfiguration cfg) throws IgniteCheckedException { this.cfg = cfg; <START> log = rootLog.getLogger(getClass()); <END> jmx = prepareMBeanServer(); ctx = new GridTestKernalContext(log, this.cfg); rsrcProc = new GridResourceProcessor(ctx); }</code><technical_language>this change</technical_language>

Target:
public IgniteTestResources(IgniteConfiguration cfg) throws IgniteCheckedException { this.cfg = cfg; this.log = rootLog.getLogger(getClass()); this.jmx = prepareMBeanServer(); this.ctx = new GridTestKernalContext(log, this.cfg); this.rsrcProc = new GridResourceProcessor(ctx); }
Source:
<code>void performComplete(BitmapHunter hunter) { <START> if (shouldWriteToMemoryCache(hunter.getData().memoryPolicy)) { <END> Result result = hunter.getResult(); if (result != null) { if (result instanceof Result.Bitmap) { Bitmap bitmap = ((Result.Bitmap) result).getBitmap(); cache.set(hunter.getKey(), bitmap); } } } hunterMap.remove(hunter.getKey()); deliver(hunter); }</code><technical_language>revert (@JvmField declaration)</technical_language>

Target:
void performComplete(BitmapHunter hunter) { if (shouldWriteToMemoryCache(hunter.data.memoryPolicy)) { Result result = hunter.getResult(); if (result != null) { if (result instanceof Result.Bitmap) { Bitmap bitmap = ((Result.Bitmap) result).getBitmap(); cache.set(hunter.getKey(), bitmap); } } } hunterMap.remove(hunter.getKey()); deliver(hunter); }
Source:
<code>public static void addSortedParams(UriBuilder uriBuilder, DataMap params) { <START> convertRawProjectionFieldsToMaskTree(params); <END> Map<String, String> map = dataMapToQueryParams(params); addSortedParams(uriBuilder, map); }</code><technical_language>Agree Evan, projection parameters MaskTree in resourContext. a fix update buildCriteriaURI() method in BatchFinderResponseBuilder replace projection params masktree objects</technical_language>

Target:
public static void addSortedParams(UriBuilder uriBuilder, DataMap params) { Map<String, String> map = dataMapToQueryParams(params); addSortedParams(uriBuilder, map); }
Source:
<code>public static void beforeTest() throws IOException { String contextSwitchesUstPath = FileLocator.toFileURL(CtfTestTrace.CONTEXT_SWITCHES_UST.getTraceURL()).getPath(); CONTEXT_SWITCHES_UST_STUB = new TraceModelStub("ust", contextSwitchesUstPath, CONTEXT_SWITCHES_UST_UUID); String contextSwitchesKernelPath = FileLocator.toFileURL(CtfTestTrace.CONTEXT_SWITCHES_KERNEL.getTraceURL()).getPath(); CONTEXT_SWITCHES_KERNEL_STUB = new TraceModelStub("kernel", contextSwitchesKernelPath, CONTEXT_SWITCHES_KERNEL_UUID); <START> ImmutableList.Builder<String> b = ImmutableList.builder(); b.add("DataProviderDescriptorStub[fId=org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:org.eclipse.linuxtools.lttng2.ust.analysis.callstack, fName=LTTng-UST CallStack - Latency vs Time, fDescription=Show latencies provided by Analysis module: LTTng-UST CallStack, fTypeId=TREE_TIME_XY]"); b.add("DataProviderDescriptorStub[fId=org.eclipse.tracecompass.internal.analysis.profiling.callstack.provider.CallStackDataProvider, fName=Flame Chart, fDescription=Show a call stack over time, fTypeId=TIME_GRAPH]"); b.add("DataProviderDescriptorStub[fId=org.eclipse.tracecompass.internal.tmf.core.histogram.HistogramDataProvider, fName=Histogram, fDescription=Show a histogram of number of events to time for a trace, fTypeId=TREE_TIME_XY]"); DATA_PROVIDER_DESCRIPTOR_TOSTINGS = b.build(); <END> }</code><technical_language>Create actual object if equal method instead</technical_language>

Target:
public static void beforeTest() throws IOException { String contextSwitchesUstPath = FileLocator.toFileURL(CtfTestTrace.CONTEXT_SWITCHES_UST.getTraceURL()).getPath(); CONTEXT_SWITCHES_UST_STUB = new TraceModelStub("ust", contextSwitchesUstPath, CONTEXT_SWITCHES_UST_UUID); String contextSwitchesKernelPath = FileLocator.toFileURL(CtfTestTrace.CONTEXT_SWITCHES_KERNEL.getTraceURL()).getPath(); CONTEXT_SWITCHES_KERNEL_STUB = new TraceModelStub("kernel", contextSwitchesKernelPath, CONTEXT_SWITCHES_KERNEL_UUID); ImmutableList.Builder<DataProviderDescriptorStub> b = ImmutableList.builder(); b.add(new DataProviderDescriptorStub("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:org.eclipse.linuxtools.lttng2.ust.analysis.callstack", "LTTng-UST CallStack - Latency vs Time", "Show latencies provided by Analysis module: LTTng-UST CallStack", ProviderType.TREE_TIME_XY.name())); b.add(new DataProviderDescriptorStub("org.eclipse.tracecompass.internal.analysis.profiling.callstack.provider.CallStackDataProvider", "Flame Chart", "Show a call stack over time", ProviderType.TIME_GRAPH.name())); b.add(new DataProviderDescriptorStub("org.eclipse.tracecompass.internal.tmf.core.histogram.HistogramDataProvider", "Histogram", "Show a histogram of number of events to time for a trace", ProviderType.TREE_TIME_XY.name())); EXPECTED_DATA_PROVIDER_DESCRIPTOR = b.build(); }
Source:
<code>private static List<ExtMap> queryDirectoryGroups( final ExtensionProxy extension, final String namespace, final ExtMap filter, boolean groupsResolving, boolean groupsResolvingRecursive ) { List<ExtMap> directoryGroups = new ArrayList<>(); <START> for (ExtMap group : queryGroupRecords(extension, namespace, filter, groupsResolving, groupsResolvingRecursive)) { <END> directoryGroups.add(group); } return directoryGroups; }</code><technical_language>simplify this stream.map.collect</technical_language>

Target:
private static List<ExtMap> queryDirectoryGroups( final ExtensionProxy extension, final String namespace, final ExtMap filter, boolean groupsResolving, boolean groupsResolvingRecursive ) { return queryGroupRecords(extension, namespace, filter, groupsResolving, groupsResolvingRecursive) .stream() .collect(Collectors.toList()); }
Source:
<code>public void testDescribeNoTimestamp(){ client.add("name", "Gerald"); client.add("address", "123 Main St"); client.add("title", "Person"); <START> String[] expecteds = {"address" , "name", "title"}; <END> Set<String> actuals = client.describe(); Assert.assertArrayEquals(expecteds, actuals.toArray(new String[actuals.size()])); }</code><technical_language>@aunyks expected a Set convert return of describe method array</technical_language>

Target:
public void testDescribeNoTimestamp(){ client.add("name", "Gerald"); client.add("address", "123 Main St"); client.add("title", "Person"); Set<String> expecteds = Sets.newHashSet(); expecteds.add("name"); expecteds.add("address"); expecteds.add("title"); Set<String> actuals = client.describe(); Assert.assertEquals(expecteds, actuals); }
Source:
<code>public void onRequestPermissionsResult( int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { <START> if (requestCode == PERMISSIONS_LOCATION) { <END> if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { enableLocation(); } } }</code><technical_language>reason for switching PermissionsManager here</technical_language>

Target:
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { permissionsManager.onRequestPermissionsResult(requestCode, permissions, grantResults); }
Source:
<code>public void testClearPractitionerLinks() { assertLinkCount(2); myEmpiProviderR4.clearEmpiLinks(new StringType("practitioner")); assertNoPractitionerLinksExist(); try { <START> myPersonDao.read(new IdDt(myPractitionerPersonId.getValueAsString()).toVersionless()); <END> fail(); } catch (ResourceNotFoundException e) }</code><technical_language>Tests this read a bit nicer if start a successful read clearEmpiLinks() is called</technical_language>

Target:
public void testClearPractitionerLinks() { assertLinkCount(2); Person read = myPersonDao.read(new IdDt(myPractitionerPersonId.getValueAsString()).toVersionless()); assertThat(read, is(notNullValue())); myEmpiProviderR4.clearEmpiLinks(new StringType("Practitioner")); assertNoPractitionerLinksExist(); try { myPersonDao.read(new IdDt(myPractitionerPersonId.getValueAsString()).toVersionless()); fail(); } catch (ResourceNotFoundException e) }
Source:
<code>public Serializable execute(TaskResult... results) throws IOException { File file = new File(s3LocalRelativePath); SchedulerExamplesUtils.createDirIfNotExists(file); AmazonS3 amazonS3 = S3ConnectorUtils.getS3Client(accessKey, secretKey, scheme, host); <START> if (s3RemoteRelativePath.endsWith(File.separator)) { <END> downloadDir(bucketName, s3RemoteRelativePath, s3LocalRelativePath, false, amazonS3); return (Serializable) SchedulerExamplesUtils.listDirectoryContents(file, new ArrayList<>()); } else { s3LocalRelativePath = Paths.get(s3LocalRelativePath, Paths.get(s3Url).getFileName().toString()).toString(); downloadFile(bucketName, s3RemoteRelativePath, s3LocalRelativePath, false, amazonS3); return (Serializable) Arrays.asList(s3LocalRelativePath); } }</code><technical_language>extract method checks if string ends file separator. this code is kinda hard understand do u need check this (I is correct works, review is check readability)</technical_language>

Target:
public Serializable execute(TaskResult... results) throws IOException { File file = new File(s3LocalRelativePath); SchedulerExamplesUtils.createDirIfNotExists(file); AmazonS3 amazonS3 = S3ConnectorUtils.getS3Client(accessKey, secretKey, scheme, host); if (SchedulerExamplesUtils.isDirectoryPath(s3RemoteRelativePath)) { downloadDir(bucketName, s3RemoteRelativePath, s3LocalRelativePath, false, amazonS3); return (Serializable) SchedulerExamplesUtils.listDirectoryContents(file, new ArrayList<>()); } else { s3LocalRelativePath = Paths.get(s3LocalRelativePath, Paths.get(s3Url).getFileName().toString()).toString(); downloadFile(bucketName, s3RemoteRelativePath, s3LocalRelativePath, false, amazonS3); return (Serializable) Arrays.asList(s3LocalRelativePath); } }
Source:
<code>public void keyValue_nullOrEmptyThrows() { <START> String[] illegalKeyValues = { null, ""}; <END> for (String key : illegalKeyValues) { try { UserCondition.keyValue(key, "value"); fail(); } catch (IllegalArgumentException ignore) { } } try { UserCondition.keyValue("key", null); fail(); } catch (IllegalArgumentException ignore) { } }</code><technical_language>I illegalKeys is illegalKeyValues</technical_language>

Target:
public void keyValue_nullOrEmptyThrows() { String[] illegalKeys = { null, ""}; for (String key : illegalKeys) { try { UserCondition.keyValue(key, "value"); fail(); } catch (IllegalArgumentException ignore) { } } try { UserCondition.keyValue("key", null); fail(); } catch (IllegalArgumentException ignore) { } }
Source:
<code>public List<ConfigMap> createConfigMaps(List<ConfigMap> configMaps, RuntimeIdentity identity) throws InfrastructureException { if (configMaps.isEmpty()) { <START> return configMaps; <END> } validate(identity, WorkspaceStatus.STARTING); List<ConfigMap> createdConfigMaps = new ArrayList<>(); for (ConfigMap cm : configMaps) { putLabel(cm, CHE_WORKSPACE_ID_LABEL, identity.getWorkspaceId()); createdConfigMaps.add( clientFactory.create().configMaps().inNamespace(cheNamespaceName).create(cm)); } return createdConfigMaps; }</code><technical_language>Easier understand if return emptyList here</technical_language>

Target:
public List<ConfigMap> createConfigMaps(List<ConfigMap> configMaps, RuntimeIdentity identity) throws InfrastructureException { if (configMaps.isEmpty()) { return Collections.emptyList(); } validate(identity, WorkspaceStatus.STARTING); List<ConfigMap> createdConfigMaps = new ArrayList<>(); for (ConfigMap cm : configMaps) { createdConfigMaps.add(createConfigMap(cm, identity)); } return createdConfigMaps; }
Source:
<code>public WebElement execute(SelenideElement proxy, WebElementSource locator, Object[] args) { boolean selected = (Boolean) args[0]; WebElement element = locator.getWebElement(); if (!element.isDisplayed()) { throw new InvalidStateException("Cannot change invisible element"); <START> } <END> String tag = element.getTagName(); if (!tag.equals("options")) { if (tag.equals("input")) { String type = element.getAttribute("type"); if (!type.equals("checkbox") && !type.equals("radio")) { throw new InvalidStateException("Only use setSelected on checkbox/option/radio"); } } else { throw new InvalidStateException("Only use setSelected on checkbox/option/radio"); } } if (element.getAttribute("readonly") != null || element.getAttribute("disabled") != null) throw new InvalidStateException("Cannot change value of readonly/disabled element"); if (element.isSelected() != selected) { click.execute(proxy, locator, NO_ARGS); } return proxy; }</code><technical_language>This is a valid change, is 1 I like. This code call WebElement method, slow. isDisplayed, getTagName, getAttribute("type"), getAttribute("readonly"), element.getAttribute("disabled"). implement JS call</technical_language>

Target:
public WebElement execute(SelenideElement proxy, WebElementSource locator, Object[] args) { boolean selected = (Boolean) args[0]; WebElement element = locator.getWebElement(); if (!element.isDisplayed()) { throw new InvalidStateException("Cannot change invisible element"); } String tag = element.getTagName(); if (!tag.equals("option")) { if (tag.equals("input")) { String type = element.getAttribute("type"); if (!type.equals("checkbox") && !type.equals("radio")) { throw new InvalidStateException("Only use setSelected on checkbox/option/radio"); } } else { throw new InvalidStateException("Only use setSelected on checkbox/option/radio"); } } if (element.getAttribute("readonly") != null || element.getAttribute("disabled") != null) throw new InvalidStateException("Cannot change value of readonly/disabled element"); if (element.isSelected() != selected) { click.execute(proxy, locator, NO_ARGS); } return proxy; }
Source:
<code>public Path pack(final Path folder, String namespace, String name, String tkName) throws IOException, URISyntaxException { Path zipFilePath = Paths.get(folder.toAbsolutePath().toString() + ".zip"); String workingDir = zipFilePath.getParent().toString(); File jarLocation = new File(ZippedToolkitStreamsContext.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); File libDir = new File(jarLocation.getParent()); File topologyToolkit = new File(libDir.getParent()); PrintWriter tkManifest = new PrintWriter("manifest_tk.txt", "UTF-8"); PrintWriter mainComposite = new PrintWriter("main_composite.txt", "UTF-8"); tkManifest.println(tkName); tkManifest.println("com.ibm.streamsx.topology"); mainComposite.print(namespace + "::" + name); tkManifest.close(); mainComposite.close(); List<Path> paths = new ArrayList<Path>(); paths.add(Paths.get(topologyToolkit.getAbsolutePath())); paths.add(Paths.get(workingDir + "/manifest_tk.txt")); paths.add(Paths.get(workingDir + "/main_composite.txt")); paths.add(Paths.get(topologyToolkit.getAbsolutePath() + "/opt/python/templates/common/Makefile")); paths.add(folder); addAllToZippedArchive(paths, zipFilePath); JSONObject jso = new OrderedJSONObject(); <START> super.deleteToolkit(new File(paths.get(1).toString()), jso); <END> super.deleteToolkit(new File(paths.get(2).toString()), jso); return zipFilePath; }</code><technical_language>new File(paths.get(1).toString()).delete() - need JSON then</technical_language>

Target:
public Path pack(final Path folder, String namespace, String name, String tkName) throws IOException, URISyntaxException { Path zipFilePath = Paths.get(folder.toAbsolutePath().toString() + ".zip"); String workingDir = zipFilePath.getParent().toString(); File jarLocation = new File(ZippedToolkitStreamsContext.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); File libDir = new File(jarLocation.getParent()); File topologyToolkit = new File(libDir.getParent()); PrintWriter tkManifest = new PrintWriter("manifest_tk.txt", "UTF-8"); PrintWriter mainComposite = new PrintWriter("main_composite.txt", "UTF-8"); tkManifest.println(tkName); tkManifest.println("com.ibm.streamsx.topology"); mainComposite.print(namespace + "::" + name); tkManifest.close(); mainComposite.close(); List<Path> paths = new ArrayList<Path>(); paths.add(Paths.get(topologyToolkit.getAbsolutePath())); paths.add(Paths.get(workingDir + "/manifest_tk.txt")); paths.add(Paths.get(workingDir + "/main_composite.txt")); paths.add(Paths.get(topologyToolkit.getAbsolutePath() + "/opt/python/templates/common/Makefile")); paths.add(folder); addAllToZippedArchive(paths, zipFilePath); paths.get(1).toFile().delete(); paths.get(2).toFile().delete(); return zipFilePath; }
Source:
<code>public StageType getType() { <START> return StageType.MOVE; <END> }</code><technical_language>MOVE stage type for this operation</technical_language>

Target:
public StageType getType() { return StageType.REPL_TXN; }
Source:
<code>protected void initExternal() { String className = String.format("org.nuxeo.ecm.storage.%s.DBSHelperImpl", coreType); try { dbsHelper = (DBSHelper) Class.forName(className).newInstance(); dbsHelper.init(); } catch (ReflectiveOperationException e) { <START> throw new ExceptionInInitializerError("DBSHelperImpl not found: " + className); <END> } }</code><technical_language>Please include throwing</technical_language>

Target:
protected void initExternal() { String className = String.format("org.nuxeo.ecm.core.storage.%s.DBSHelperImpl", coreType); try { dbsHelper = (DBSHelper) Class.forName(className).newInstance(); dbsHelper.init(); } catch (ReflectiveOperationException e) { throw new NuxeoException("DBSHelperImpl not found: " + className, e); } }
Source:
<code>void set(ChangeInfo info, String revision, <START> Labels labels, Element reviewers) { <END> this.changeId = info.legacy_id(); this.info = info; this.revision = revision; this.labels = labels; this.reviewers = reviewers; reviewerSuggestOracle.setChange(changeId); renderReviewers(info); }</code><technical_language>UI widgets passed init() set(). Passing init() matches pattern Labels.init() ChangeScreen2 gain access additional UiFields of set() controls</technical_language>

Target:
void set(ChangeInfo info, String revision, Labels labels, Element reviewers) { this.info = info; this.revision = revision; this.labels = labels; this.reviewers = reviewers; reviewerSuggestOracle.setChange(info.legacy_id()); renderReviewers(info); }
Source:
<code>public void testClone() { ServerTemplate src = new ServerTemplate(); src.setId("test1"); src.setName("test1"); src.setMode(KieServerMode.DEVELOPMENT); List<String> capabilities = new ArrayList<String>(); capabilities.add(Capability.RULE.toString()); src.setCapabilities(capabilities); Map<Capability, ContainerConfig> containerSpecRule = new HashMap<>(); containerSpecRule.put(Capability.RULE, new RuleConfig(1L, KieScannerStatus.STARTED)); src.addContainerSpec(new ContainerSpec("test", "test1", new ServerTemplateKey("test", "test"), new ReleaseId("test", "test", "1"), KieContainerStatus.STARTED, containerSpecRule)); Map<Capability, ContainerConfig> containerSpecProcess = new HashMap<>(); containerSpecProcess.put(Capability.PROCESS, new ProcessConfig("test1", "test1", "test1", "test1")); src.addContainerSpec(new ContainerSpec("test1", "test1", new ServerTemplateKey("test1", "test1"), new ReleaseId("test1", "test1", "2"), KieContainerStatus.STARTED, containerSpecProcess)); Map<Capability, ServerConfig> cloneServerConfig = new HashMap<Capability, ServerConfig>(); cloneServerConfig.put(Capability.RULE,new ServerConfig()); src.setConfigs(cloneServerConfig); src.addServerInstance(new ServerInstanceKey("test1", "test1", "test1", "test1")); ServerTemplate dest = src.cloneServerTemplate(); assertEquals(src, dest); assertEquals(false, src == dest); <START> } <END></code><technical_language>assertNotEquals</technical_language>

Target:
public void testClone() { ServerTemplate src = new ServerTemplate(); src.setId("test1"); src.setName("test1"); src.setMode(KieServerMode.DEVELOPMENT); List<String> capabilities = new ArrayList<String>(); capabilities.add(Capability.RULE.toString()); src.setCapabilities(capabilities); Map<Capability, ContainerConfig> containerSpecRule = new HashMap<>(); containerSpecRule.put(Capability.RULE, new RuleConfig(1L, KieScannerStatus.STARTED)); src.addContainerSpec(new ContainerSpec("test", "test1", new ServerTemplateKey("test", "test"), new ReleaseId("test", "test", "1"), KieContainerStatus.STARTED, containerSpecRule)); Map<Capability, ContainerConfig> containerSpecProcess = new HashMap<>(); containerSpecProcess.put(Capability.PROCESS, new ProcessConfig("test1", "test1", "test1", "test1")); src.addContainerSpec(new ContainerSpec("test1", "test1", new ServerTemplateKey("test1", "test1"), new ReleaseId("test1", "test1", "2"), KieContainerStatus.STARTED, containerSpecProcess)); Map<Capability, ServerConfig> cloneServerConfig = new HashMap<Capability, ServerConfig>(); cloneServerConfig.put(Capability.RULE,new ServerConfig()); src.setConfigs(cloneServerConfig); src.addServerInstance(new ServerInstanceKey("test1", "test1", "test1", "test1")); ServerTemplate dest = src.cloneServerTemplate(); assertEquals(src, dest); assertFalse(src == dest); }
Source:
<code>public void saveInstanceState(Bundle out) { out.putInt(CURRENTLY_EXECUTING_ID, mCurrentMeasure != null ? mCurrentMeasure.getID() : -1); <START> out.putInt(RECOVERY_STATE, mRecoveryState); <END> }</code><technical_language>if mentioned this wrong, 100% confident safe enough savedInstanceState for a safety check asynchronous execution</technical_language>

Target:
public void saveInstanceState(Bundle out) { out.putInt(CURRENT_MEASUERE_ID_KEY, mCurrentMeasure != null ? mCurrentMeasure.getID() : -1); out.putInt(LAST_STATUS_KEY, mLastExecutionStatus); out.putString(LAST_DISPLAY_STATUS_KEY, mLastDisplayStatus); out.putString(ARCHIVE_PATH_KEY, mAppArchivePath); out.putBoolean(CCZ_SELECTION_ENABLED_KEY, cczSelectionEnabled); }
Source:
<code>public boolean acquire(K key, final Runnable cacheHit) { if (cache.putIfAbsent(key, true) == null) { cacheHit.run(); <START> return false; <END> } return true; }</code><technical_language>return values inversed before, is intentional</technical_language>

Target:
public boolean acquire(K key, final Runnable cacheHit) { if (cache.putIfAbsent(key, true) != null) { cacheHit.run(); return false; } return true; }
Source:
<code>private void saveMetadataFile(FileformatInterface gdzfile, Process process) { try { if (this.autoSave) { serviceManager.getFileService().writeMetadataFile(gdzfile, process); } } catch (Exception e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung("Error while writing metadata: " + process.getTitle(), e); } }</code><technical_language>setErrorMessage</technical_language>

Target:
private void saveMetadataFile(FileformatInterface gdzfile, Process process) { try { if (this.autoSave) { serviceManager.getFileService().writeMetadataFile(gdzfile, process); } } catch (PreferencesException | WriteException | IOException | RuntimeException e) { Helper.setErrorMessage("Error while writing metadata: ", process.getTitle(), logger, e); } }
Source:
<code>public View getView(Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; } if (view == null) { alphaValue = 255; } view = View.inflate(context, R.layout.brick_ev3_motor_move, null); view = BrickViewProvider.setAlphaOnView(view, alphaValue); setCheckboxView(R.id.brick_ev3_motor_move_checkbox); editSpeed = (TextView) view.findViewById(R.id.ev3_motor_move_speed_edit_text); getFormulaWithBrickField(BrickField.LEGO_EV3_SPEED).setTextFieldId(R.id.ev3_motor_move_speed_edit_text); getFormulaWithBrickField(BrickField.LEGO_EV3_SPEED).refreshTextField(view); editSpeed.setOnClickListener(this); ArrayAdapter<CharSequence> motorAdapter = ArrayAdapter.createFromResource(context, R.array.ev3_motor_chooser, android.R.layout.simple_spinner_item); motorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner motorSpinner = (Spinner) view.findViewById(R.id.brick_ev3_motor_move_spinner); motorSpinner.setAdapter(motorAdapter); motorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { motorEnum = Motor.values()[position]; motor = motorEnum.name(); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); if (motorEnum == null) { readResolve(); } motorSpinner.setSelection(motorEnum.ordinal()); <START> motorSpinner.setGravity(Gravity.CENTER); <END> return view; }</code><technical_language>this done in code</technical_language>

Target:
public View getView(Context context, int brickId, BaseAdapter baseAdapter) { if (animationState) { return view; } if (view == null) { alphaValue = 255; } view = View.inflate(context, R.layout.brick_ev3_motor_move, null); view = BrickViewProvider.setAlphaOnView(view, alphaValue); setCheckboxView(R.id.brick_ev3_motor_move_checkbox); editSpeed = (TextView) view.findViewById(R.id.ev3_motor_move_speed_edit_text); getFormulaWithBrickField(BrickField.LEGO_EV3_SPEED).setTextFieldId(R.id.ev3_motor_move_speed_edit_text); getFormulaWithBrickField(BrickField.LEGO_EV3_SPEED).refreshTextField(view); editSpeed.setOnClickListener(this); ArrayAdapter<CharSequence> motorAdapter = ArrayAdapter.createFromResource(context, R.array.ev3_motor_chooser, android.R.layout.simple_spinner_item); motorAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner motorSpinner = (Spinner) view.findViewById(R.id.brick_ev3_motor_move_spinner); motorSpinner.setAdapter(motorAdapter); motorSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { motorEnum = Motor.values()[position]; motor = motorEnum.name(); } @Override public void onNothingSelected(AdapterView<?> arg0) { } }); if (motorEnum == null) { readResolve(); } motorSpinner.setSelection(motorEnum.ordinal()); return view; }
Source:
<code>private Predicate<ChangeData> rewriteImpl(Predicate<ChangeData> in, ChangeIndex index, int limit) throws QueryParseException { if (isIndexPredicate(in, index)) { return in; } else if (in instanceof LimitPredicate) { return new LimitPredicate(limit); } else if (!isRewritePossible(in)) { return null; } int n = in.getChildCount(); BitSet isIndexed = new BitSet(n); BitSet notIndexed = new BitSet(n); BitSet rewritten = new BitSet(n); List<Predicate<ChangeData>> newChildren = Lists.newArrayListWithCapacity(n); boolean hasLimit = false; for (int i = 0; i < n; i++) { Predicate<ChangeData> c = in.getChild(i); Predicate<ChangeData> nc = rewriteImpl(c, index, limit); if (nc == c) { isIndexed.set(i); newChildren.add(c); continue; } else if (nc == null ) { notIndexed.set(i); newChildren.add(c); continue; } else if (nc instanceof LimitPredicate) { if (hasLimit) { <START> n--; <END> continue; } else { hasLimit = true; } } rewritten.set(i); newChildren.add(nc); } if (isIndexed.cardinality() == n) { return in; } else if (notIndexed.cardinality() == n) { return null; } else if (rewritten.cardinality() == n) { return in.copy(newChildren); } return partitionChildren(in, newChildren, isIndexed, index, limit); }</code><technical_language>this omit some other child? n is number of inputs. decrementing child in group, e.g.: project:bar limit:12 limit:14 branch:master n-- limit:14 kills branch:master iteration</technical_language>

Target:
private Predicate<ChangeData> rewriteImpl(Predicate<ChangeData> in, ChangeIndex index, int limit) throws QueryParseException { if (isIndexPredicate(in, index)) { return in; } else if (in instanceof LimitPredicate) { return new LimitPredicate(limit); } else if (!isRewritePossible(in)) { return null; } int n = in.getChildCount(); BitSet isIndexed = new BitSet(n); BitSet notIndexed = new BitSet(n); BitSet rewritten = new BitSet(n); List<Predicate<ChangeData>> newChildren = Lists.newArrayListWithCapacity(n); for (int i = 0; i < n; i++) { Predicate<ChangeData> c = in.getChild(i); Predicate<ChangeData> nc = rewriteImpl(c, index, limit); if (nc == c) { isIndexed.set(i); newChildren.add(c); } else if (nc == null ) { notIndexed.set(i); newChildren.add(c); } else { rewritten.set(i); newChildren.add(nc); } } if (isIndexed.cardinality() == n) { return in; } else if (notIndexed.cardinality() == n) { return null; } else if (rewritten.cardinality() == n) { return in.copy(newChildren); } return partitionChildren(in, newChildren, isIndexed, index, limit); }
Source:
<code>public void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) throws CommentNotFoundException, CommentSecurityException { IdRef annotationRef = new IdRef(annotationId); if (!session.exists(annotationRef)) { throw new CommentNotFoundException("The annotation " + annotationId + " does not exist."); } NuxeoPrincipal principal = session.getPrincipal(); if (!principal.isAdministrator() && !annotation.getAuthor().equals(principal.getName())) { throw new CommentSecurityException("The user " + principal.getName() + " can not edit annotations of document " + annotation.getParentId()); } <START> CoreInstance.doPrivileged(session, s -> { Framework.getService(CommentManager.class).updateComment(s, annotationId, annotation); <END> }); }</code><technical_language>this change? Do need doPrivileged</technical_language>

Target:
public void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) throws CommentNotFoundException, CommentSecurityException { IdRef annotationRef = new IdRef(annotationId); if (!session.exists(annotationRef)) { throw new CommentNotFoundException("The annotation " + annotationId + " does not exist."); } NuxeoPrincipal principal = session.getPrincipal(); if (!principal.isAdministrator() && !annotation.getAuthor().equals(principal.getName())) { throw new CommentSecurityException("The user " + principal.getName() + " can not edit annotations of document " + annotation.getParentId()); } Framework.getService(CommentManager.class).updateComment(session, annotationId, annotation); }
Source:
<code>public boolean isSearchUsingTags() { return origText.contains("tag") <START> || getSearchObjectStr() != null && getSearchObjectStr().equals(SearchObjects.VDC_USER_OBJ_NAME) && origText.contains("vm") <END> || getCrossRefObjList().contains(SearchObjects.VDC_STORAGE_POOL_OBJ_NAME) || getCrossRefObjList().contains(SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME); }</code><technical_language>This is "feature" of SearchEngine, I handle in this patch</technical_language>

Target:
public boolean isSearchUsingTags() { return origText.contains("tag") || isUserSearchUsingTags() || getCrossRefObjList().contains(SearchObjects.VDC_STORAGE_POOL_OBJ_NAME) || getCrossRefObjList().contains(SearchObjects.VDC_STORAGE_DOMAIN_OBJ_NAME); }
Source:
<code>public MQTTDataGenerator getDataGenerator(final String brokerURI, final String topic) { <START> MQTTSubscribeClient subscribeClient = mqttSubscribeClientMap.get(brokerURI); <END> if (subscribeClient == null) { subscribeClient = new MQTTSubscribeClient(brokerURI, "MISTClient", mqttSubscribeClientMap); mqttSubscribeClientMap.put(brokerURI, subscribeClient); } return subscribeClient.connectToTopic(topic); }</code><technical_language>synchronized? I synchronization overhead is significant</technical_language>

Target:
public MQTTDataGenerator getDataGenerator(final String brokerURI, final String topic) { MQTTSubscribeClient subscribeClient = mqttSubscribeClientMap.get(brokerURI); if (subscribeClient == null) { subscribeClient = new MQTTSubscribeClient(brokerURI, "MISTClient", mqttSubscribeClientMap); mqttSubscribeClientMap.putIfAbsent(brokerURI, subscribeClient); subscribeClient = mqttSubscribeClientMap.get(brokerURI); } return subscribeClient.connectToTopic(topic); }
Source:
<code>public InvalidQuotaParametersException(String errorStr, Throwable cause) { <START> super("InvalidQuotaParametersException: " + errorStr, cause); <END> }</code><technical_language>call super(message, cause)</technical_language>

Target:
public InvalidQuotaParametersException(String errorStr, Throwable cause) { super(errorStr, cause); }
Source:
<code>private void clearAsyncTasksWithOutVdsmId() { <START> if (getReturnValue().getTaskPlaceHolderIdList().size() > 0) { <END> TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Void runInTransaction() { for (final Guid asyncTaskId : getReturnValue().getTaskPlaceHolderIdList()) { AsyncTasks task = getAsyncTaskDao().get(asyncTaskId); if (task != null && Guid.isNullOrEmpty(task.getVdsmTaskId())) { AsyncTaskManager.removeTaskFromDbByTaskId(task.getTaskId()); } } return null; } }); } }</code><technical_language>please change isEmpty</technical_language>

Target:
private void clearAsyncTasksWithOutVdsmId() { if (!getReturnValue().getTaskPlaceHolderIdList().isEmpty()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { for (Guid asyncTaskId : getReturnValue().getTaskPlaceHolderIdList()) { AsyncTasks task = getAsyncTaskDao().get(asyncTaskId); if (task != null && Guid.isNullOrEmpty(task.getVdsmTaskId())) { AsyncTaskManager.removeTaskFromDbByTaskId(task.getTaskId()); } } return null; } }); } }
Source:
<code>private SearchNavigationLinks convertSearchLinksToPublicApiHost(SearchNavigationLinks originalLinks) { SearchNavigationLinks updatedLinks = new SearchNavigationLinks(); if (originalLinks.getFirstPage() != null) { <START> updatedLinks.withFirstLink(publicApiUriGenerator.convertHostToPublicAPI(originalLinks.getFirstPage().getHref())); <END> } if(originalLinks.getLastPage() != null) { updatedLinks.withLastLink(publicApiUriGenerator.convertHostToPublicAPI(originalLinks.getLastPage().getHref())); } if(originalLinks.getSelf() != null) { updatedLinks.withSelfLink(publicApiUriGenerator.convertHostToPublicAPI(originalLinks.getSelf().getHref())); } if(originalLinks.getNextPage() != null) { updatedLinks.withNextLink(publicApiUriGenerator.convertHostToPublicAPI(originalLinks.getNextPage().getHref())); } if(originalLinks.getPrevPage() != null) { updatedLinks.withPrevLink(publicApiUriGenerator.convertHostToPublicAPI(originalLinks.getPrevPage().getHref())); } return updatedLinks; }</code><technical_language>If originalLinks.getFirstPage() returned Optional, do this: java originalLinks.getFirstPage() .map(Link::getHref) .map(publicApiUriGenerator::convertHostToPublicAPI) .ifPresent(updatedLinks::withFirstLink); a bit invasive do though</technical_language>

Target:
private SearchNavigationLinks convertSearchLinksToPublicApiHost(SearchNavigationLinks originalLinks) { SearchNavigationLinks updatedLinks = new SearchNavigationLinks(); if (originalLinks.getFirstPage() != null) { updatedLinks.withFirstLink(createPubliApiMandateSearchLinkWithQueryFrom(originalLinks.getFirstPage().getHref())); } if(originalLinks.getLastPage() != null) { updatedLinks.withLastLink(createPubliApiMandateSearchLinkWithQueryFrom(originalLinks.getLastPage().getHref())); } if(originalLinks.getSelf() != null) { updatedLinks.withSelfLink(createPubliApiMandateSearchLinkWithQueryFrom(originalLinks.getSelf().getHref())); } if(originalLinks.getNextPage() != null) { updatedLinks.withNextLink(createPubliApiMandateSearchLinkWithQueryFrom(originalLinks.getNextPage().getHref())); } if(originalLinks.getPrevPage() != null) { updatedLinks.withPrevLink(createPubliApiMandateSearchLinkWithQueryFrom(originalLinks.getPrevPage().getHref())); } return updatedLinks; }
Source:
<code>public boolean equals(Object object) { <START> if (this == object) return true; <END> if (object == null || getClass() != object.getClass()) return false; VersionID versionID = (VersionID) object; return (version == versionID.version && index == versionID.index); }</code><technical_language>returns separate line</technical_language>

Target:
public boolean equals(Object object) { if (this == object) { return true; } if (object == null || getClass() != object.getClass()) { return false; } VersionID versionID = (VersionID) object; return (version == versionID.version && index == versionID.index); }