auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean remove(Object attachment) { XWikiAttachment xwikiAttachment = (XWikiAttachment) attachment; if(map.put(xwikiAttachment.getFilename(), xwikiAttachment) == null) return false; <START> map.remove(attachment); <END> updateMap(); return true; }</code><technical_language>This work map key is a String, XWikiAttachment</technical_language>

Target:
public boolean remove(Object attachment) { XWikiAttachment xwikiAttachment = (XWikiAttachment) attachment; if (map.remove(xwikiAttachment.getFilename()) == null) { return false; } updatedMap(); return true; }
Source:
<code>public void connectionPoolMetrics(){ navigation.selectRow().invoke("View"); Application.waitUntilVisible(); <START> <END> MetricsAreaFragment metricsArea = dsPage.getConnectionPoolMetricsArea(); double expectedActivePercentage = metricsArea.getPercentage(ACTIVE, AVAILABLE_CONNECTIONS); double expectedMaxUsedPercentage = metricsArea.getPercentage(MAX_USED, AVAILABLE_CONNECTIONS); MetricsFragment activeMetrics = metricsArea.getMetricsFragment(ACTIVE); MetricsFragment maxUsedMetrics = metricsArea.getMetricsFragment(MAX_USED); assertEquals(expectedActivePercentage, activeMetrics.getPercentage(), DELTA); assertEquals(expectedMaxUsedPercentage, maxUsedMetrics.getPercentage(), DELTA); }</code><technical_language>Please move this end of before() method</technical_language>

Target:
public void connectionPoolMetrics(){ MetricsAreaFragment metricsArea = dsPage.getConnectionPoolMetricsArea(); double expectedActivePercentage = metricsArea.getPercentage(ACTIVE, AVAILABLE_CONNECTIONS); double expectedMaxUsedPercentage = metricsArea.getPercentage(MAX_USED, AVAILABLE_CONNECTIONS); MetricsFragment activeMetrics = metricsArea.getMetricsFragment(ACTIVE); MetricsFragment maxUsedMetrics = metricsArea.getMetricsFragment(MAX_USED); assertEquals(expectedActivePercentage, activeMetrics.getPercentage(), DELTA); assertEquals(expectedMaxUsedPercentage, maxUsedMetrics.getPercentage(), DELTA); }
Source:
<code>public void run() { try { <START> File tempFile = File.createTempFile("tempFile", "fileshare"); <END> tempFile.deleteOnExit(); cloudFile.downloadToFile(tempFile.getAbsolutePath()); } catch (StorageException | IOException e) { throw new RuntimeException(e); } }</code><technical_language>Re-use temp file</technical_language>

Target:
public void run() { try { cloudFile.downloadToFile(targetFilePath); } catch (StorageException | IOException e) { throw new RuntimeException(e); } }
Source:
<code>private boolean isActiveVds() { VDS vds = vdsDao.get(getParameters().getId()); if (vds == null) { getQueryReturnValue().setExceptionString( <START> "Cannot fetch storage devices, host doesn't exist anymore."); <END> } else if (vds.getStatus() != VDSStatus.Up) { getQueryReturnValue().setExceptionString(String.format( "Cannot fetch storage devices, host %s is not UP.", vds.getHostName())); } else { return true; } getQueryReturnValue().setSucceeded(false); return false; }</code><technical_language>front end facing messages shown in webadmin. I is introduce new messages in EngineMessage in frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java frontend/webadmin/modules/frontend/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties</technical_language>

Target:
private boolean isActiveVds() { VDS vds = vdsDao.get(getParameters().getId()); if (vds == null) { getQueryReturnValue() .setExceptionString(EngineMessage.CANNOT_FETCH_STORAGE_DEVICES_HOST_DOESNT_EXIST_ANYMORE.name()); } else if (vds.getStatus() != VDSStatus.Up) { getQueryReturnValue().setExceptionString(String.format( "Cannot fetch storage devices, host %s is not UP.", vds.getHostName())); } else { return true; } getQueryReturnValue().setSucceeded(false); return false; }
Source:
<code>public JpaStoreConfigurationBuilder batchSize(long batchSize) { <START> attributes.attribute(MAX_BATCH_SIZE).set((int) batchSize); <END> return self(); }</code><technical_language>normally, some people pass in Long.MAX_VALUE, convert -1 :( honest a lot of config code is missing validations. For example want a number 0 passed in well. in > Integer.MAX_VALUE I Integer.MAX_VALUE batch size</technical_language>

Target:
public JpaStoreConfigurationBuilder batchSize(long batchSize) { int size = batchSize > Integer.MAX_VALUE ? Integer.MAX_VALUE : (batchSize < Integer.MIN_VALUE ? Integer.MIN_VALUE : (int) batchSize); maxBatchSize(size); return self(); }
Source:
<code>public HashMap<String, Integer> getVisualizationWikisSetup() { List<String> wikiList = new ArrayList<String>(); HashMap<String, Integer> visualizationSetup = new HashMap<String, Integer>(); for (WebElement element : visualizationWikis) { wikiList.add(element.getAttribute("href")); } int video = 0; int entertainment = 0; int lifestyle = 0; for (String URL : wikiList) { getUrl(URL); String hubName = hubIndicator.getText().toLowerCase(); hubName = hubName.substring(2, hubName.length() - 2).replace(" ", "_"); <START> if (hubName.equals(HubName.Video_Games.toString().toLowerCase())) { <END> video += 1; } if (hubName.equals(HubName.Entertainment.toString().toLowerCase())) { entertainment += 1; } if (hubName.equals(HubName.Lifestyle.toString().toLowerCase())) { lifestyle += 1; } } visualizationSetup.put(HubName.Video_Games.toString(), video); visualizationSetup.put(HubName.Entertainment.toString(), entertainment); visualizationSetup.put(HubName.Lifestyle.toString(), lifestyle); return visualizationSetup; }</code><technical_language>change a chain of ifs switch-case</technical_language>

Target:
public HashMap<String, Integer> getVisualizationWikisSetup() { List<String> wikiList = new ArrayList<String>(); HashMap<String, Integer> visualizationSetup = new HashMap<String, Integer>(); for (WebElement element : visualizationWikis) { wikiList.add(element.getAttribute("href")); } int video = 0; int entertainment = 0; int lifestyle = 0; for (String URL : wikiList) { getUrl(URL); String hubName = hubIndicator.getText().toLowerCase(); hubName = hubName.substring(2, hubName.length() - 2).replace(" ", "_"); switch (hubName) { case "video_games": video += 1; break; case "entertainment": entertainment += 1; break; case "lifestyle": lifestyle += 1; break; } } visualizationSetup.put(HubName.Video_Games.toString(), video); visualizationSetup.put(HubName.Entertainment.toString(), entertainment); visualizationSetup.put(HubName.Lifestyle.toString(), lifestyle); return visualizationSetup; }
Source:
<code>private void handleStandbyContainerStop(String standbyContainerID, String resourceID, String preferredHost, AbstractContainerAllocator containerAllocator) { Optional<StandbyContainerManager.FailoverMetadata> failoverMetadata = this.checkIfUsedForFailover(resourceID); if (failoverMetadata.isPresent()) { String activeContainerID = failoverMetadata.get().activeContainerID; String standbyContainerHostname = failoverMetadata.get().getStandbyContainerHostname(resourceID); log.info("Requesting resource for active container on host {}, and backup container on any host", activeContainerID, standbyContainerHostname, standbyContainerID); containerAllocator.requestResource(activeContainerID, standbyContainerHostname); containerAllocator.requestResource(standbyContainerID, ResourceRequestState.ANY_HOST); <START> return; <END> } else { log.info("Issuing request for standby container on host {}, since this is not for a failover", standbyContainerID, preferredHost); containerAllocator.requestResource(standbyContainerID, preferredHost); return; } }</code><technical_language>remove returns control flow hard understand</technical_language>

Target:
private void handleStandbyContainerStop(String standbyContainerID, String resourceID, String preferredHost, AbstractContainerAllocator containerAllocator) { Optional<StandbyContainerManager.FailoverMetadata> failoverMetadata = this.checkIfUsedForFailover(resourceID); if (failoverMetadata.isPresent()) { String activeContainerID = failoverMetadata.get().activeContainerID; String standbyContainerHostname = failoverMetadata.get().getStandbyContainerHostname(resourceID); log.info("Requesting resource for active container on host {}, and backup container on any host", activeContainerID, standbyContainerHostname, standbyContainerID); SamzaResourceRequest resourceRequestForActive = containerAllocator.getResourceRequest(activeContainerID, standbyContainerHostname); failoverMetadata.get().recordResourceRequest(resourceRequestForActive); containerAllocator.issueResourceRequest(resourceRequestForActive); containerAllocator.requestResource(standbyContainerID, ResourceRequestState.ANY_HOST); } else { log.info("Issuing request for standby container on host {}, since this is not for a failover", standbyContainerID, preferredHost); containerAllocator.requestResource(standbyContainerID, preferredHost); } }
Source:
<code>public void exitDoubleArray(ExprParser.DoubleArrayContext ctx) { Double[] values = new Double[ctx.doubleElement().size()]; for (int i = 0; i < values.length; i++) { <START> if (ctx.doubleElement(i).getText().equalsIgnoreCase("null")) { <END> values[i] = null; } else { values[i] = Double.parseDouble(ctx.doubleElement(i).getText()); } } nodes.put(ctx, new DoubleArrayExpr(values)); }</code><technical_language>This similar blocks NULL_LITERAL constant</technical_language>

Target:
public void exitDoubleArray(ExprParser.DoubleArrayContext ctx) { Double[] values = new Double[ctx.numericElement().size()]; for (int i = 0; i < values.length; i++) { if (ctx.numericElement(i).NULL() != null) { values[i] = null; } else if (ctx.numericElement(i).LONG() != null) { values[i] = Numbers.parseDoubleObject(ctx.numericElement(i).LONG().getText()); } else if (ctx.numericElement(i).DOUBLE() != null) { values[i] = Numbers.parseDoubleObject(ctx.numericElement(i).DOUBLE().getText()); } else { throw new RE("Failed to parse array element %s as a double", ctx.numericElement(i).getText()); } } nodes.put(ctx, new DoubleArrayExpr(values)); }
Source:
<code>private static Optional<Path> findAtPath(final Path path) { <START> if (Files.exists(path)) { return Optional.of(path); } else { return Optional.empty(); } <END> }</code><technical_language>if noticed, a notation here: suggestion return Optional.of(path).filter(Files::exists);</technical_language>

Target:
private static Optional<Path> findAtPath(final Path path) { return Optional.of(path).filter(Files::exists); }
Source:
<code>private String getCommitMessage() { List<PatchSetDetail> details = change.getPatchSetDetails(); int index = details.size() - 1; for (PatchSetDetail detail : details) { if (detail.getPatchSet() == patchSet) { <START> index = details.indexOf(detail); <END> } } return details.get(index).getInfo().getMessage(); }</code><technical_language>Instead of index lookup detail again, record detail instead of index</technical_language>

Target:
private String getCommitMessage() { List<PatchSetDetail> details = change.getPatchSetDetails(); PatchSetDetail patchSetDetail = details.get(details.size() - 1); for (PatchSetDetail detail : details) { if (detail.getPatchSet() == patchSet) { patchSetDetail = detail; } } return patchSetDetail.getInfo().getMessage(); }
Source:
<code>void loadResources(final LoadListener loadListener) { com.verizon.ads.utils.ThreadUtils.runOffUiThread(new Runnable() { @Override public void run() { try { JSONObject iconImageJSON = verizonAd.getJSON("iconImage"); if (iconImageJSON != null) { AdapterNativeMappedImage adapterNativeMappedImage = nativeMappedImageFromJSON(iconImageJSON.optString("url")); if (adapterNativeMappedImage != null) { setIcon(adapterNativeMappedImage); } } JSONObject mainImageJSON = verizonAd.getJSON("mainImage"); if (mainImageJSON != null) { List<com.google.android.gms.ads.formats.NativeAd.Image> imagesList = new ArrayList<>(); AdapterNativeMappedImage adapterNativeMappedImage = nativeMappedImageFromJSON(mainImageJSON.optString("url")); if (adapterNativeMappedImage != null) { imagesList.add(adapterNativeMappedImage); ImageView imageView = new ImageView(context); imageView.setImageDrawable(adapterNativeMappedImage.getDrawable()); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imageView.setLayoutParams(layoutParams); setMediaView(imageView); } setImages(imagesList); } <START> loadListener.onLoadComplete(); <END> } catch (Exception e) { Log.e(TAG, "Unable to load resources.", e); loadListener.onLoadError(); } } }); }</code><technical_language>This complete if icon images/mediaview fails set. In case, invoke error callback return</technical_language>

Target:
void loadResources(final LoadListener loadListener) { ThreadUtils.runOffUiThread(new Runnable() { @Override public void run() { try { boolean iconSet = false; boolean mediaViewSet = false; JSONObject iconImageJSON = verizonAd.getJSON("iconImage"); if (iconImageJSON != null) { AdapterNativeMappedImage adapterNativeMappedImage = parseImageComponent(iconImageJSON); if (adapterNativeMappedImage != null) { setIcon(adapterNativeMappedImage); iconSet = true; } } JSONObject mainImageJSON = verizonAd.getJSON("mainImage"); if (mainImageJSON != null) { List<com.google.android.gms.ads.formats.NativeAd.Image> imagesList = new ArrayList<>(); AdapterNativeMappedImage adapterNativeMappedImage = parseImageComponent(mainImageJSON); if (adapterNativeMappedImage != null) { imagesList.add(adapterNativeMappedImage); ImageView imageView = new ImageView(context); imageView.setImageDrawable(adapterNativeMappedImage.getDrawable()); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imageView.setLayoutParams(layoutParams); setMediaView(imageView); mediaViewSet = true; } setImages(imagesList); } if (mediaViewSet && iconSet) { loadListener.onLoadComplete(); } else { Log.e(TAG, "Failed to set icon and/or media view"); loadListener.onLoadError(); } } catch (Exception e) { Log.e(TAG, "Unable to load resources.", e); loadListener.onLoadError(); } } }); }
Source:
<code>public void execute(final K key, Runnable r) { Runnable old = latest.put(key, r); <START> if (old == null) { <END> exec.execute(() -> { Runnable run = latest.remove(key); if (run != null) { run.run();; } }); } }</code><technical_language>do care knowing is dropped? ignorant of issue requires tuning</technical_language>

Target:
public void execute(final K key, Runnable r) { Runnable old = latest.put(key, r); if (old == null) { exec.execute(() -> { Runnable run = latest.remove(key); if (run != null) { run.run(); } }); } else { LOG.debug("Replacing runnable for - {}", key, r); } }
Source:
<code>private static void setFinalOutputChannel(DataChannel outputChannel, Schema outputSchema) { outputChannel.setShuffleType(NONE_SHUFFLE); outputChannel.setShuffleOutputNum(1); <START> outputChannel.setStoreType(BuiltinStorages.DRAW); <END> outputChannel.setSchema(outputSchema); }</code><technical_language>adding a final variable for default store type in class</technical_language>

Target:
private void setFinalOutputChannel(DataChannel outputChannel, Schema outputSchema) { outputChannel.setShuffleType(NONE_SHUFFLE); outputChannel.setShuffleOutputNum(1); outputChannel.setStoreType(finalOutputStoreType); outputChannel.setSchema(outputSchema); }
Source:
<code>public OrcSnappyDecompressor(OrcDataSourceId orcDataSourceId, int maxBufferSize) { <START> this.orcDataSourceId = orcDataSourceId; <END> this.maxBufferSize = maxBufferSize; }</code><technical_language>Check for null</technical_language>

Target:
public OrcSnappyDecompressor(OrcDataSourceId orcDataSourceId, int maxBufferSize) { this.orcDataSourceId = requireNonNull(orcDataSourceId, "orcDataSourceId is null"); this.maxBufferSize = maxBufferSize; }
Source:
<code>protected void recvCommands() throws IOException { PushCertificateParser certParser = getPushCertificateParser(); boolean readCapabilities = true; try { for (;;) { String line; try { line = pckIn.readString(); } catch (EOFException eof) { if (commands.isEmpty()) return; throw eof; } if (line == PacketLineIn.END) { break; } if (line.length() >= 48 && line.startsWith("shallow ")) { clientShallowCommits.add(ObjectId.fromString(line.substring(8, 48))); continue; } if (readCapabilities) { FirstLine firstLine = new FirstLine(line); enabledCapabilities = firstLine.getCapabilities(); readCapabilities = false; <START> enableCapabilities(); <END> line = firstLine.getLine(); if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) { certParser.receiveHeader(pckIn, !isBiDirectionalPipe()); continue; } } if (line.equals(PushCertificateParser.BEGIN_SIGNATURE)) { certParser.receiveSignature(pckIn); continue; } ReceiveCommand cmd = parseCommand(line); if (cmd.getRefName().equals(Constants.HEAD)) { cmd.setResult(Result.REJECTED_CURRENT_BRANCH); } else { cmd.setRef(refs.get(cmd.getRefName())); } commands.add(cmd); if (certParser.enabled()) { certParser.addCommand(cmd); } } pushCert = certParser.build(); } catch (PackProtocolException e) { pckIn.discardUntilEnd(); fatalError(e.getMessage()); throw e; } }</code><technical_language>unrelated? Moving enableCapabilities() call a good change change harder follow</technical_language>

Target:
protected void recvCommands() throws IOException { PushCertificateParser certParser = getPushCertificateParser(); boolean firstPkt = true; try { for (;;) { String line; try { line = pckIn.readString(); } catch (EOFException eof) { if (commands.isEmpty()) return; throw eof; } if (line == PacketLineIn.END) { break; } if (line.length() >= 48 && line.startsWith("shallow ")) { clientShallowCommits.add(ObjectId.fromString(line.substring(8, 48))); continue; } if (firstPkt) { firstPkt = false; FirstLine firstLine = new FirstLine(line); enabledCapabilities = firstLine.getCapabilities(); line = firstLine.getLine(); enableCapabilities(); if (line.equals(GitProtocolConstants.OPTION_PUSH_CERT)) { certParser.receiveHeader(pckIn, !isBiDirectionalPipe()); continue; } } if (line.equals(PushCertificateParser.BEGIN_SIGNATURE)) { certParser.receiveSignature(pckIn); continue; } ReceiveCommand cmd = parseCommand(line); if (cmd.getRefName().equals(Constants.HEAD)) { cmd.setResult(Result.REJECTED_CURRENT_BRANCH); } else { cmd.setRef(refs.get(cmd.getRefName())); } commands.add(cmd); if (certParser.enabled()) { certParser.addCommand(cmd); } } pushCert = certParser.build(); } catch (PackProtocolException | InvalidObjectIdException e) { if (sideBand) { try { pckIn.discardUntilEnd(); } catch (IOException e2) { } } fatalError(e.getMessage()); throw e; } }
Source:
<code>public void testConsistentHashLoadBalance() { int runs = 10000; <START> long invokerCount0 = 0; <END> Map<Invoker, Long> invokerHited = new HashMap<>(); Map<Invoker, AtomicLong> counter = getInvokeCounter(runs, ConsistentHashLoadBalance.NAME); for (Invoker minvoker : counter.keySet()) { Long count = counter.get(minvoker).get(); if (count == 0) { invokerCount0 ++; } else { invokerHited.put(minvoker, count); } } Assert.assertEquals(counter.size() - 1, invokerCount0); Assert.assertEquals(1, invokerHited.size()); Assert.assertEquals(runs, invokerHited.values().iterator().next().intValue()); }</code><technical_language>thought variable naming, is 'untouchedNodesCount' instead of invokerCount0 touchedNodesHitMap more intended functionality point of view</technical_language>

Target:
public void testConsistentHashLoadBalance() { int runs = 10000; long unHitedInvokerCount = 0; Map<Invoker, Long> hitedInvokers = new HashMap<>(); Map<Invoker, AtomicLong> counter = getInvokeCounter(runs, ConsistentHashLoadBalance.NAME); for (Invoker minvoker : counter.keySet()) { Long count = counter.get(minvoker).get(); if (count == 0) { unHitedInvokerCount++; } else { hitedInvokers.put(minvoker, count); } } Assert.assertEquals("the number of unHitedInvoker should be counter.size() - 1", counter.size() - 1, unHitedInvokerCount); Assert.assertEquals("the number of hitedInvoker should be 1", 1, hitedInvokers.size()); Assert.assertEquals("the number of hited count should be the number of runs", runs, hitedInvokers.values().iterator().next().intValue()); }
Source:
<code>public void selectAllDeprecatedRuleKeys_return_values_even_if_there_is_no_rule() { db.executeUpdateSql("delete from deprecated_rule_keys"); DeprecatedRuleKeyDto deprecatedRuleKeyDto1 = new DeprecatedRuleKeyDto() .setUuid(uuidFactory.create()) .setOldRepositoryKey(randomAlphanumeric(50)) .setOldRuleKey(randomAlphanumeric(50)) .setRuleId(random.nextInt(1_000_000)) .setCreatedAt(1_500_000_000_000L); DeprecatedRuleKeyDto deprecatedRuleKeyDto2 = new DeprecatedRuleKeyDto() .setUuid(uuidFactory.create()) .setOldRepositoryKey(randomAlphanumeric(50)) .setOldRuleKey(randomAlphanumeric(50)) .setRuleId(random.nextInt(1_000_000)) .setCreatedAt(1_500_000_000_000L); underTest.insert(db.getSession(), deprecatedRuleKeyDto1); underTest.insert(db.getSession(), deprecatedRuleKeyDto2); List<DeprecatedRuleKeyDto> deprecatedRuleKeyDtos = underTest.selectAllDeprecatedRuleKeys(db.getSession()); assertThat(deprecatedRuleKeyDtos).hasSize(2); assertThat(deprecatedRuleKeyDtos) .extracting(DeprecatedRuleKeyDto::getNewRepositoryKey, DeprecatedRuleKeyDto::getNewRuleKey) .containsExactly( tuple(null, null), <START> tuple(null, null) <END> ); }</code><technical_language>I tests missing: - deleting existing rules - deleting passing empty list (what a circuit breaker in this case in implementation?)</technical_language>

Target:
public void selectAllDeprecatedRuleKeys_return_values_even_if_there_is_no_rule() { db.rules().insertDeprecatedKey(); db.rules().insertDeprecatedKey(); Set<DeprecatedRuleKeyDto> deprecatedRuleKeyDtos = underTest.selectAllDeprecatedRuleKeys(db.getSession()); assertThat(deprecatedRuleKeyDtos).hasSize(2); assertThat(deprecatedRuleKeyDtos) .extracting(DeprecatedRuleKeyDto::getNewRepositoryKey, DeprecatedRuleKeyDto::getNewRuleKey) .containsExactly( tuple(null, null), tuple(null, null) ); }
Source:
<code>synchronized void removeObjects(Map<?, ?> associatedObjects) { for (Object <START> name : <END> associatedObjects.values()) { RegistryObject toRemove = (RegistryObject) name; remove((toRemove).getObjectId(), true); if (toRemove instanceof ExtensionPoint) removeExtensionPoint(((ExtensionPoint) toRemove).getUniqueIdentifier()); } }</code><technical_language>rename registryObject</technical_language>

Target:
synchronized void removeObjects(Map<?, ?> associatedObjects) { for (Object registryObject : associatedObjects.values()) { RegistryObject toRemove = (RegistryObject) registryObject; remove((toRemove).getObjectId(), true); if (toRemove instanceof ExtensionPoint) removeExtensionPoint(((ExtensionPoint) toRemove).getUniqueIdentifier()); } }
Source:
<code>private void copyPI(TaggedValuePointable tvp, NodeTreePointable ntp, IMutableValueStorage mvs) throws IOException { <START> PINodeBuilder pnb = new PINodeBuilder(); <END> VoidPointable vp1 = ppool.takeOne(VoidPointable.class); VoidPointable vp2 = ppool.takeOne(VoidPointable.class); PINodePointable pnp = ppool.takeOne(PINodePointable.class); tvp.getValue(pnp); pnp.getContent(ntp, vp1); pnp.getTarget(ntp, vp2); pnb.reset(mvs); pnb.setContent(vp2); pnb.setTarget(vp1); ppool.giveBack(pnp); ppool.giveBack(vp1); ppool.giveBack(vp2); }</code><technical_language>builder a class level variable</technical_language>

Target:
private void copyPI(TaggedValuePointable tvp, NodeTreePointable ntp, IMutableValueStorage mvs) throws IOException { VoidPointable vp1 = ppool.takeOne(VoidPointable.class); VoidPointable vp2 = ppool.takeOne(VoidPointable.class); PINodePointable pnp = ppool.takeOne(PINodePointable.class); tvp.getValue(pnp); pnp.getContent(ntp, vp1); pnp.getTarget(ntp, vp2); pnb.reset(mvs); pnb.setContent(vp2); pnb.setTarget(vp1); ppool.giveBack(pnp); ppool.giveBack(vp1); ppool.giveBack(vp2); }
Source:
<code><START> private Properties buildAssetConditionProperties(AssetCondition condition) { Properties buildingProperties = new Properties(); <END> safelyAddProperty(buildingProperties, CuCamsConstants.CapAssetApi.CONDITION_CODE, condition.getAssetConditionCode()); safelyAddProperty(buildingProperties, CuCamsConstants.CapAssetApi.CONDITION_NAME, condition.getAssetConditionName()); return buildingProperties; }</code><technical_language>naming is a confusing here. "buildingProperties" variable renamed "assetConditionProperties" instead, more in line method returning</technical_language>

Target:
private Properties buildAssetConditionProperties(AssetCondition condition) { Properties assetConditionProperties = new Properties(); safelyAddProperty(assetConditionProperties, CuCamsConstants.CapAssetApi.CONDITION_CODE, condition.getAssetConditionCode()); safelyAddProperty(assetConditionProperties, CuCamsConstants.CapAssetApi.CONDITION_NAME, condition.getAssetConditionName()); return assetConditionProperties; }
Source:
<code>public synchronized void run() { if (!crlByUrlEnabled || crlLocationUrl == null) { return; } if (!crlLocationUrl.startsWith(HTTPS)) { postErrorEvent("The provided URL was not an HTTPS URL."); return; } Object entity = getRemoteCrl(); if (!(entity instanceof InputStream)) { <START> postErrorEvent("Unable to download the CRL."); <END> return; } FileBackedOutputStream fileBackedOutputStream = null; try { ByteSource byteSource; try (InputStream entityStream = (InputStream) entity) { fileBackedOutputStream = new FileBackedOutputStream(FILE_BACKED_STREAM_THRESHOLD); IOUtils.copy(entityStream, fileBackedOutputStream); fileBackedOutputStream.close(); byteSource = fileBackedOutputStream.asByteSource(); } File crlFile = getCrlFile(byteSource); if (!crlIsValid(byteSource)) { postErrorEvent("An error occurred while validating the CRL."); return; } writeCrlToFile(byteSource, crlFile); } catch (IOException e) { LOGGER.warn("Unable to copy CRL to local CRL. {}", e.getMessage()); postErrorEvent("An error occurred while downloading the CRL."); } finally { if (fileBackedOutputStream != null) { try { fileBackedOutputStream.reset(); } catch (IOException e) { LOGGER.warn("Error occurred while deleting the temporary file. {}", e.getMessage()); } } } }</code><technical_language>"Unable download remote CRL" configuration needs corrected</technical_language>

Target:
public synchronized void run() { if (!crlByUrlEnabled || crlLocationUrl == null) { return; } if (!crlLocationUrl.startsWith(HTTPS)) { postErrorEvent("The provided URL was not an HTTPS URL."); return; } Object entity = getRemoteCrl(); if (!(entity instanceof InputStream)) { postErrorEvent("Unable to download the remote CRL."); return; } FileBackedOutputStream fileBackedOutputStream = null; try { ByteSource byteSource; try (InputStream entityStream = (InputStream) entity) { fileBackedOutputStream = new FileBackedOutputStream(FILE_BACKED_STREAM_THRESHOLD); IOUtils.copy(entityStream, fileBackedOutputStream); fileBackedOutputStream.close(); byteSource = fileBackedOutputStream.asByteSource(); } File crlFile = getCrlFile(byteSource); if (!crlIsValid(byteSource)) { postErrorEvent("An error occurred while validating the CRL."); return; } writeCrlToFile(byteSource, crlFile); } catch (IOException e) { LOGGER.warn("Unable to copy CRL to local CRL. {}", e.getMessage()); postErrorEvent("An error occurred while downloading the CRL."); } finally { if (fileBackedOutputStream != null) { try { fileBackedOutputStream.reset(); } catch (IOException e) { LOGGER.warn("Error occurred while deleting the temporary file. {}", e.getMessage()); } } } }
Source:
<code>public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { {"GlideToBrick", R.string.brick_glide, new GlideToBrick(), <START> R.id.brick_glide_to_edit_text_x, R.id.brick_glide_to_edit_text_y, "1+2", <END> 42, "1 + 2 ", "42 "}, {"PlaceAtBrick", R.string.brick_place_at, new PlaceAtBrick(), R.id.brick_place_at_edit_text_x, R.id.brick_place_at_edit_text_y, "1+2", 42, "1 + 2 ", "42 "} }); }</code><technical_language>input expected outcomes same, possibly move test cases. (to reduce overhead)</technical_language>

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { {"GlideToBrick", R.string.brick_glide, new GlideToBrick()}, {"PlaceAtBrick", R.string.brick_place_at, new PlaceAtBrick()} }); }
Source:
<code>private synchronized void onUpdate() { if (hueBridge != null) { if (pollingJob == null || pollingJob.isCancelled()) { int pollingInterval = DEFAULT_POLLING_INTERVAL; try { Object pollingIntervalConfig = getConfig().get(POLLING_INTERVAL); if (pollingIntervalConfig != null) { pollingInterval = ((BigDecimal) pollingIntervalConfig).intValue(); } else { logger.info("Polling interval not configured for this hue bridge. Using default value: {}s", pollingInterval); } } catch (NumberFormatException ex) { logger.info("Wrong configuration value for polling interval. Using default value: {}s", pollingInterval); } pollingJob = scheduler.scheduleWithFixedDelay(pollingRunnable, 1, pollingInterval, TimeUnit.SECONDS); } if (sensorPollingJob == null || sensorPollingJob.isCancelled()) { int pollingInterval = DEFAULT_SENSOR_POLLING_INTERVAL; try { Object pollingIntervalConfig = getConfig().get(SENSOR_POLLING_INTERVAL); if (pollingIntervalConfig != null) { <START> pollingInterval = ((BigDecimal) pollingIntervalConfig).intValue(); <END> } else { logger.info( "Sensor polling interval not configured for this hue bridge. Using default value: {}ms", pollingInterval); } } catch (NumberFormatException ex) { logger.info("Wrong configuration value for sensor polling interval. Using default value: {}ms", pollingInterval); } sensorPollingJob = scheduler.scheduleWithFixedDelay(sensorPollingRunnable, 1, pollingInterval, TimeUnit.MILLISECONDS); } } }</code><technical_language>cast here? framework getConfig() converts a BigDecimal potentially a String here</technical_language>

Target:
private synchronized void onUpdate() { if (hueBridge != null) { if (pollingJob == null || pollingJob.isCancelled()) { int pollingInterval = DEFAULT_POLLING_INTERVAL; if (hueBridgeConfig.getPollingInterval() < 1) { logger.info("Wrong configuration value for polling interval. Using default value: {}s", pollingInterval); } else { pollingInterval = hueBridgeConfig.getPollingInterval(); } pollingJob = scheduler.scheduleWithFixedDelay(pollingRunnable, 1, pollingInterval, TimeUnit.SECONDS); } if (sensorPollingJob == null || sensorPollingJob.isCancelled()) { int sensorPollingInterval = DEFAULT_SENSOR_POLLING_INTERVAL; if (hueBridgeConfig.getSensorPollingInterval() < 50) { logger.info("Wrong configuration value for sensor polling interval. Using default value: {}s", sensorPollingInterval); } else { sensorPollingInterval = hueBridgeConfig.getSensorPollingInterval(); } sensorPollingJob = scheduler.scheduleWithFixedDelay(sensorPollingRunnable, 1, sensorPollingInterval, TimeUnit.MILLISECONDS); } } }
Source:
<code>public void endWindow() { try { bucketManager.blockUntilAllRequestsServiced(); handleIdleTime(); Preconditions.checkArgument(waitingEvents.isEmpty(), waitingEvents.keySet()); if (orderedOutput) { emitProcessedTuples(); Preconditions.checkArgument(decisions.isEmpty(), "events pending - " + decisions.size()); } appWindow++; if (!saveDataAtCheckpoint) { bucketManager.endWindow(super.getCurrentWindow()); } else { Preconditions.checkArgument(super.getContext().getValue(OperatorContext.APPLICATION_WINDOW_COUNT) == super .getContext().getValue(OperatorContext.CHECKPOINT_WINDOW_COUNT)); <START> if (appWindow % super.getContext().getValue(DAGContext.CHECKPOINT_WINDOW_COUNT) == super.getContext().getValue( <END> DAGContext.CHECKPOINT_WINDOW_COUNT) - 1) { bucketManager.endWindow(super.getCurrentWindow()); } } } catch (Throwable cause) { DTThrowable.rethrow(cause); } }</code><technical_language>This logic a flaw. works appWindow = 1, is, appWindow = streaming window</technical_language>

Target:
public void endWindow() { try { bucketManager.blockUntilAllRequestsServiced(); handleIdleTime(); Preconditions.checkArgument(waitingEvents.isEmpty(), waitingEvents.keySet()); if (orderedOutput) { emitProcessedTuples(); Preconditions.checkArgument(decisions.isEmpty(), "events pending - " + decisions.size()); } appWindow++; bucketManager.endWindow(super.getCurrentWindow()); } catch (Throwable cause) { DTThrowable.rethrow(cause); } }
Source:
<code>public void testWriteValueCantCopyFieldName() throws Exception { IonStruct data = struct("{a:{b:10}}"); IonValue a = data.get("a"); IonReader ir = system().newReader(a); ir.next(); iw = makeWriter(); iw.stepIn(IonType.STRUCT); <START> iw.writeValue(ir); END> }</code><technical_language>starting shift JUnit's [ExpectedException](<LINK_0> (instead of @Test(expected=...)) line exception is expected isolated</technical_language>

Target:
public void testWriteValueCantCopyFieldName() throws Exception { IonStruct data = struct("{a:{b:10}}"); IonValue a = data.get("a"); IonReader ir = system().newReader(a); ir.next(); iw = makeWriter(); iw.stepIn(IonType.STRUCT); thrown.expect(IllegalStateException.class); iw.writeValue(ir); }
Source:
<code>public static IdpResponse from(@NonNull Exception e) { if (e instanceof FirebaseUiException) { return new IdpResponse((FirebaseUiException) e); } else if (e instanceof FirebaseAuthAnonymousUpgradeException) { return ((FirebaseAuthAnonymousUpgradeException) e).getResponse(); } else if (e instanceof FirebaseUiUserCollisionException) { FirebaseUiUserCollisionException collisionException = (FirebaseUiUserCollisionException) e; User user = new User.Builder( collisionException.getProviderId(), collisionException.getEmail()) .build(); return new IdpResponse(user, null, null, false, <START> new FirebaseUiException(((FirebaseUiUserCollisionException) e).getErrorCode(), <END> e.getMessage()), collisionException.getCredential()); } else { FirebaseUiException wrapped = new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR, e.getMessage()); wrapped.setStackTrace(e.getStackTrace()); return new IdpResponse(wrapped); } }</code><technical_language>nit: cast e collisionException here</technical_language>

Target:
public static IdpResponse from(@NonNull Exception e) { if (e instanceof FirebaseUiException) { return new IdpResponse((FirebaseUiException) e); } else if (e instanceof FirebaseAuthAnonymousUpgradeException) { return ((FirebaseAuthAnonymousUpgradeException) e).getResponse(); } else if (e instanceof FirebaseUiUserCollisionException) { FirebaseUiUserCollisionException collisionException = (FirebaseUiUserCollisionException) e; User user = new User.Builder( collisionException.getProviderId(), collisionException.getEmail()) .build(); return new IdpResponse(user, null, null, false, new FirebaseUiException(collisionException.getErrorCode(), collisionException.getMessage()), collisionException.getCredential()); } else { FirebaseUiException wrapped = new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR, e.getMessage()); wrapped.setStackTrace(e.getStackTrace()); return new IdpResponse(wrapped); } }
Source:
<code>static Map<String, Object> bannerSoyData( GitilesView view, ImageLoader img, RootNode nav) { Map<String, Object> data = new HashMap<>(); data.put("siteTitle", null); data.put("logoUrl", null); data.put("homeUrl", null); if (nav == null) { return data; } for (Iterator<Node> i = nav.getChildren().iterator(); i.hasNext();) { Node n = i.next(); if (n instanceof HeaderNode) { HeaderNode h = (HeaderNode) n; if (h.getLevel() == 1) { data.put("siteTitle", MarkdownUtil.getInnerText(h)); i.remove(); break; } } } for (ReferenceNode r : nav.getReferences()) { String key = MarkdownUtil.getInnerText(r); String url = r.getUrl(); if ("logo".equalsIgnoreCase(key)) { Object src; <START> if (url.startsWith("https://") || url.startsWith("http://")) { <END> src = url; } else if (HtmlBuilder.isImageDataUri(url)) { src = Sanitizers.filterImageDataUri(url); } else if (img != null) { src = img.loadImage(url); } else { src = FilterImageDataUri.INSTANCE.getInnocuousOutput(); } data.put("logoUrl", src); } else if ("home".equalsIgnoreCase(key)) { if (MarkdownUtil.isAbsolutePathToMarkdown(url)) { url = GitilesView.doc().copyFrom(view).setPathPart(url).toUrl(); } data.put("homeUrl", url); } } return data; }</code><technical_language>In another change introduced a helper method for this</technical_language>

Target:
static Map<String, Object> bannerSoyData( GitilesView view, ImageLoader img, RootNode nav) { Map<String, Object> data = new HashMap<>(); data.put("siteTitle", null); data.put("logoUrl", null); data.put("homeUrl", null); if (nav == null) { return data; } for (Iterator<Node> i = nav.getChildren().iterator(); i.hasNext();) { Node n = i.next(); if (n instanceof HeaderNode) { HeaderNode h = (HeaderNode) n; if (h.getLevel() == 1) { data.put("siteTitle", MarkdownUtil.getInnerText(h)); i.remove(); break; } } } for (ReferenceNode r : nav.getReferences()) { String key = MarkdownUtil.getInnerText(r); String url = r.getUrl(); if ("logo".equalsIgnoreCase(key)) { Object src; if (HtmlBuilder.isValidHttpUri(url)) { src = url; } else if (HtmlBuilder.isImageDataUri(url)) { src = Sanitizers.filterImageDataUri(url); } else if (img != null) { src = img.loadImage(url); } else { src = FilterImageDataUri.INSTANCE.getInnocuousOutput(); } data.put("logoUrl", src); } else if ("home".equalsIgnoreCase(key)) { if (MarkdownUtil.isAbsolutePathToMarkdown(url)) { url = GitilesView.doc().copyFrom(view).setPathPart(url).toUrl(); } data.put("homeUrl", url); } } return data; }
Source:
<code>private void runMigration() { if (migrationState.hasAlreadyMigrated()) { return; } destinationLog.truncate(destinationLog.getGreatestLogEntry()); long lowerBound = lowestSequenceToMigrate(); <START> long upperBound = sourceLog.getGreatestLogEntry(); <END> try (PaxosStateLogBatchReader<V> reader = new PaxosStateLogBatchReader<>(sourceLog, hydrator, 100)) { long numberOfBatches = (upperBound - lowerBound) / BATCH_SIZE + 1; LongStream.iterate(lowerBound, x -> x + BATCH_SIZE) .limit(numberOfBatches) .mapToObj(sequence -> reader.readBatch(sequence, BATCH_SIZE)) .forEach(destinationLog::writeBatchOfRounds); } migrationState.finishMigration(); }</code><technical_language>benign, avoid future confusion handle edge case here: this method returns PaxosAcceptor.NO_LOG_ENTRY if zero entries in source log, meaning numberOfBatches = (-1 - 0) / BATCH_SIZE + 1 Java semantics is 1. is a batch zero BATCH_SIZE entries reader try read</technical_language>

Target:
private void runMigration() { if (migrationState.hasAlreadyMigrated()) { return; } destinationLog.truncate(destinationLog.getGreatestLogEntry()); long lowerBound = lowestSequenceToMigrate(); long upperBound = sourceLog.getGreatestLogEntry(); if (upperBound == PaxosAcceptor.NO_LOG_ENTRY) { migrationState.finishMigration(); return; } try (PaxosStateLogBatchReader<V> reader = new PaxosStateLogBatchReader<>(sourceLog, hydrator, 100)) { long numberOfBatches = (upperBound - lowerBound) / BATCH_SIZE + 1; LongStream.iterate(lowerBound, x -> x + BATCH_SIZE) .limit(numberOfBatches) .mapToObj(sequence -> reader.readBatch(sequence, BATCH_SIZE)) .forEach(destinationLog::writeBatchOfRounds); } migrationState.finishMigration(); }
Source:
<code>public void completed() { <START> <END> }</code><technical_language>ArrayList of languages translated cleared</technical_language>

Target:
public void completed() { languages.clear(); }
Source:
<code>public void selectItem(String path) { String locator = " waitItem(path); try { new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator))) .click(); } catch (StaleElementReferenceException ex) { <START> LOG.error(ex.getLocalizedMessage(), ex); <END> waitProjectExplorer(); clickOnRefreshTreeButton(); waitItem(path); new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator))) .click(); } }</code><technical_language>IMHO log exception warn() interrupt execution of tests</technical_language>

Target:
public void selectItem(String path) { String locator = " waitItem(path); try { new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator))) .click(); } catch (StaleElementReferenceException ex) { LOG.warn(ex.getLocalizedMessage(), ex); waitProjectExplorer(); clickOnRefreshTreeButton(); waitItem(path); new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC) .until(ExpectedConditions.visibilityOfElementLocated(By.xpath(locator))) .click(); } }
Source:
<code><START> public void setSystemTimes(long time) { <END> systemTimes = new long[] { time }; }</code><technical_language>a nitpick: remove access modifier enable access package</technical_language>

Target:
void setSystemTimes(long time) { systemTimes = new long[] { time }; }
Source:
<code>private boolean pickDefaultSuggestion(boolean autoCorrectToPreferred) { if (mKeyboardHandler.hasMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS)) { performUpdateSuggestions(); } final CharSequence typedWord = mWord.getTypedWord(); final CharSequence actualWordToOutput = autoCorrectToPreferred ? mWord.getPreferredWord() : typedWord; if (!TextUtils.isEmpty(actualWordToOutput)) { TextEntryState.acceptedDefault(typedWord); <START> boolean fixed = !TextUtils.equals(typedWord, actualWordToOutput); <END> commitWordToInput(actualWordToOutput, fixed); if (!fixed) { checkAddToDictionaryWithAutoDictionary( mWord, mAutoComplete ? Suggest.AdditionType.Picked : Suggest.AdditionType.Typed); } return true; } return false; }</code><technical_language>final stay if</technical_language>

Target:
private boolean pickDefaultSuggestion(boolean autoCorrectToPreferred) { if (mKeyboardHandler.hasMessages(KeyboardUIStateHandler.MSG_UPDATE_SUGGESTIONS)) { performUpdateSuggestions(); } final CharSequence typedWord = mWord.getTypedWord(); final CharSequence actualWordToOutput = autoCorrectToPreferred ? mWord.getPreferredWord() : typedWord; if (!TextUtils.isEmpty(actualWordToOutput)) { TextEntryState.acceptedDefault(typedWord); final boolean fixed = !TextUtils.equals(typedWord, actualWordToOutput); commitWordToInput(actualWordToOutput, fixed); if (!fixed) { checkAddToDictionaryWithAutoDictionary( mWord, mAutoComplete ? Suggest.AdditionType.Picked : Suggest.AdditionType.Typed); } return true; } return false; }
Source:
<code>protected CommandResult<RuleViolation> doAllow(final GraphCommandExecutionContext context, final Command<GraphCommandExecutionContext, RuleViolation> command) { final CommandResult<RuleViolation> result = super.doAllow(context, command); if (!CommandUtils.isError(result) && hasRules(context)) { <START> final org.kie.workbench.common.stunner.core.graph.Graph target = getGraph(context); <END> final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final GraphCommandResultBuilder builder = new GraphCommandResultBuilder(); final Collection<RuleViolation> cardinalityRuleViolations = doEvaluate(context, RuleContextBuilder.GraphContexts.cardinality(target, candidate, CardinalityContext.Operation.DELETE)); builder.addViolations(cardinalityRuleViolations); for (final RuleViolation violation : cardinalityRuleViolations) { if (builder.isError(violation)) { return builder.build(); } } return builder.build(); } return result; }</code><technical_language>Do need FQCN</technical_language>

Target:
protected CommandResult<RuleViolation> doAllow(final GraphCommandExecutionContext context, final Command<GraphCommandExecutionContext, RuleViolation> command) { final CommandResult<RuleViolation> result = super.doAllow(context, command); if (!CommandUtils.isError(result) && hasRules(context)) { final Graph target = getGraph(context); final Node<View<?>, Edge> candidate = (Node<View<?>, Edge>) getCandidate(context); final GraphCommandResultBuilder builder = new GraphCommandResultBuilder(); final Collection<RuleViolation> cardinalityRuleViolations = doEvaluate(context, RuleContextBuilder.GraphContexts.cardinality(target, candidate, CardinalityContext.Operation.DELETE)); builder.addViolations(cardinalityRuleViolations); for (final RuleViolation violation : cardinalityRuleViolations) { if (builder.isError(violation)) { return builder.build(); } } return builder.build(); } return result; }
Source:
<code>public void setUp() { MockitoAnnotations.initMocks(this); results = new SearchResults<JudgmentSearchResult>(); results.addResult(new JudgmentSearchResult()); when(result.getTotalResults()).thenReturn(0L); <START> when(judgmentsWebSearchService.search(org.mockito.Mockito.any(JudgmentCriteriaForm.class), org.mockito.Mockito.any(Pageable.class))).thenReturn(results); <END> when(ccListService.findCommonCourts()).thenReturn(commonCourts); when(scListService.findScChambers()).thenReturn(scChambers); when(scJudgmentFormRepository.findAll()).thenReturn(scJudgmentForms); mockMvc = webAppContextSetup(webApplicationCtx) .build(); }</code><technical_language>try Mockito.any() (with normal import instead of static)</technical_language>

Target:
public void setUp() { MockitoAnnotations.initMocks(this); simpleDivisions = testCourtsFactory.getSimpleDivisions(); results = new SearchResults<JudgmentSearchResult>(); results.addResult(new JudgmentSearchResult()); when(judgmentsWebSearchService.search(Mockito.any(JudgmentCriteriaForm.class), Mockito.any(Pageable.class))).thenReturn(results); when(ccListService.findCommonCourts()).thenReturn(commonCourts); when(scListService.findScChambers()).thenReturn(scChambers); when(scJudgmentFormRepository.findAll()).thenReturn(scJudgmentForms); mockMvc = webAppContextSetup(webApplicationCtx) .build(); }
Source:
<code>public void testGroupByCollectList() throws Exception { Schema purchaseSchema = Schema.recordOf( "purchase", Schema.Field.of("ts", Schema.of(Schema.Type.LONG)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("item", Schema.of(Schema.Type.STRING)), Schema.Field.of("price", Schema.of(Schema.Type.DOUBLE))); Schema userSchema = Schema.recordOf( "user", Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("itemList", Schema.arrayOf(Schema.of(Schema.Type.STRING)))); GroupByConfig groupByConfig = new GroupByConfig("user", "itemList:CollectList(item)"); GroupByAggregator groupByAggregator = new GroupByAggregator(groupByConfig); MockPipelineConfigurer mockConfigurer = new MockPipelineConfigurer(purchaseSchema, <START> ImmutableMap.of( <END> CoreValidator.ID, new CoreValidator())); groupByAggregator.configurePipeline(mockConfigurer); Assert.assertEquals(userSchema, mockConfigurer.getOutputSchema()); }</code><technical_language>I pass empty map mock</technical_language>

Target:
public void testGroupByCollectList() throws Exception { Schema purchaseSchema = Schema.recordOf( "purchase", Schema.Field.of("ts", Schema.of(Schema.Type.LONG)), Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("item", Schema.of(Schema.Type.STRING)), Schema.Field.of("price", Schema.of(Schema.Type.DOUBLE))); Schema userSchema = Schema.recordOf( "user", Schema.Field.of("user", Schema.of(Schema.Type.STRING)), Schema.Field.of("itemList", Schema.arrayOf(Schema.of(Schema.Type.STRING)))); GroupByConfig groupByConfig = new GroupByConfig("user", "itemList:CollectList(item)"); GroupByAggregator groupByAggregator = new GroupByAggregator(groupByConfig); MockPipelineConfigurer mockConfigurer = new MockPipelineConfigurer(purchaseSchema, Collections.EMPTY_MAP); groupByAggregator.configurePipeline(mockConfigurer); Assert.assertEquals(userSchema, mockConfigurer.getOutputSchema()); }
Source:
<code>public void setFocus() { StyledText widget = <START> fSourceViewer.getTextWidget(); <END> if (fSourceViewer != null && widget != null && !widget.isDisposed()) { widget.setFocus(); } }</code><technical_language>null ;-). note, Text compact assignment</technical_language>

Target:
public void setFocus() { if (fSourceViewer != null) { StyledText widget = fSourceViewer.getTextWidget(); if (widget != null && !widget.isDisposed()) { widget.setFocus(); } } }
Source:
<code>public void setStrategy(DifferentialEntropyStateStrategy strategy) { <START> requireNonNull(strategy, "strategy is null"); <END> this.strategy = strategy; }</code><technical_language>nit: combine assignment this.strategy = requireNonNull(strategy, "strategy is null");</technical_language>

Target:
public void setStrategy(DifferentialEntropyStateStrategy strategy) { this.strategy = requireNonNull(strategy, "strategy is null"); }