auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Map<String, List<AppiumDevice>> getDevices() throws Exception { String platform = System.getenv(PLATFORM); Map<String, List<AppiumDevice>> devicesByHost = new HashMap<>(); if (capabilityManager.getCapabilities().has("hostMachines")) { JSONArray hostMachines = capabilityManager.getHostMachineObject(); for (Object hostMachine : hostMachines) { JSONObject hostMachineJson = (JSONObject) hostMachine; String machineIP = hostMachineJson.getString("machineIP"); IAppiumManager appiumManager = AppiumManagerFactory.getAppiumManager(machineIP); List<Device> devices = appiumManager.getDevices(machineIP, platform); if ((!platform.equalsIgnoreCase("android") && capabilityManager.isApp() && capabilityManager.isSimulatorAppPresentInCapsJson() && hostMachineJson.has("simulators")) || (capabilityManager.getCapabilityObjectFromKey("iOS").has("browserName") <START> && hostMachineJson.has("simulators"))) { <END> JSONArray simulators = hostMachineJson.getJSONArray("simulators"); List<Device> simulatorsToBoot = getSimulatorsToBoot( machineIP, simulators); devices.addAll(simulatorsToBoot); } List<AppiumDevice> appiumDevices = getAppiumDevices(machineIP, devices); devicesByHost.put(machineIP, appiumDevices); } } else { throw new RuntimeException("Provide hostMachine in Caps.json for execution"); } return devicesByHost; }</code><technical_language>if (!platform.equalsIgnoreCase("android") && capabilityManager.isApp() && capabilityManager.isSimulatorAppPresentInCapsJson() && hostMachineJson.has("simulators")) && !capabilityManager.getCapabilityObjectFromKey("iOS").has("browserName")) { condition this. Booted simulators needs in case of safari. didnt work expected lets change</technical_language>

Target:
private Map<String, List<AppiumDevice>> getDevices() throws Exception { String platform = System.getenv(PLATFORM); Map<String, List<AppiumDevice>> devicesByHost = new HashMap<>(); if (capabilityManager.getCapabilities().has("hostMachines")) { JSONArray hostMachines = capabilityManager.getHostMachineObject(); for (Object hostMachine : hostMachines) { JSONObject hostMachineJson = (JSONObject) hostMachine; String machineIP = hostMachineJson.getString("machineIP"); IAppiumManager appiumManager = AppiumManagerFactory.getAppiumManager(machineIP); List<Device> devices = appiumManager.getDevices(machineIP, platform); if ((!platform.equalsIgnoreCase("android") && capabilityManager.isApp() && capabilityManager.isSimulatorAppPresentInCapsJson() && hostMachineJson.has("simulators")) && !capabilityManager.getCapabilityObjectFromKey("iOS").has("browserName")) { JSONArray simulators = hostMachineJson.getJSONArray("simulators"); List<Device> simulatorsToBoot = getSimulatorsToBoot( machineIP, simulators); devices.addAll(simulatorsToBoot); } List<AppiumDevice> appiumDevices = getAppiumDevices(machineIP, devices); devicesByHost.put(machineIP, appiumDevices); } } else { throw new RuntimeException("Provide hostMachine in Caps.json for execution"); } return devicesByHost; }
Source:
<code>protected List<String> getToolbarTooltips() { String[] tooltipsArray = { "Align Views", "Optimize", <START> "", <END> "Show View Filters", "Show Legend", "", "Reset the Time Scale to Default", "Select Previous State Change", "Select Next State Change", "", "Add Bookmark...", "Previous Marker", "Next Marker", "", "Select Previous Process", "Select Next Process", "Zoom In", "Zoom Out", "", "Hide Arrows", "Follow CPU Backward", "Follow CPU Forward", "Go to previous event of the selected thread", "Go to next event of the selected thread" }; return Arrays.asList(tooltipsArray); }</code><technical_language>If is obvious, extracted a constant obvious name like... SEPARATOR</technical_language>

Target:
protected List<String> getToolbarTooltips() { String[] tooltipsArray = { "Align Views", "Optimize", SEPARATOR, "Show View Filters", "Show Legend", SEPARATOR, "Reset the Time Scale to Default", "Select Previous State Change", "Select Next State Change", SEPARATOR, "Add Bookmark...", "Previous Marker", "Next Marker", SEPARATOR, "Select Previous Process", "Select Next Process", "Zoom In", "Zoom Out", SEPARATOR, "Hide Arrows", "Follow CPU Backward", "Follow CPU Forward", "Go to previous event of the selected thread", "Go to next event of the selected thread" }; return Arrays.asList(tooltipsArray); }
Source:
<code>public ToStringHelper string() { return super.string() .add("app", app) .add("script", script) .add("location", locations) .add("port", port) .add("bindAddress", bindAddress) .add("noConsole", noConsole) .add("noConsoleSecurity", noConsoleSecurity) .add("startupFailOnPersistenceErrors", startupFailOnPersistenceErrors) .add("startupFailsOnCatalogErrors", startupFailOnCatalogErrors) .add("startupContinueOnWebErrors", startupContinueOnWebErrors) <START> .add("startupFailOnManagedAppsErrors", startupFailOnManagedAppsErrors) <END> .add("stopWhichAppsOnShutdown", stopWhichAppsOnShutdown) .add("noShutdownOnExit", noShutdownOnExit) .add("stopOnKeyPress", stopOnKeyPress) .add("localBrooklynProperties", localBrooklynProperties) .add("persist", persist) .add("persistenceLocation", persistenceLocation) .add("persistenceDir", persistenceDir) .add("highAvailability", highAvailability); }</code><technical_language>Add new catalog options</technical_language>

Target:
public ToStringHelper string() { return super.string() .add("app", app) .add("script", script) .add("location", locations) .add("port", port) .add("bindAddress", bindAddress) .add("noConsole", noConsole) .add("noConsoleSecurity", noConsoleSecurity) .add("startupFailOnPersistenceErrors", startupFailOnPersistenceErrors) .add("startupFailsOnCatalogErrors", startupFailOnCatalogErrors) .add("startupContinueOnWebErrors", startupContinueOnWebErrors) .add("startupFailOnManagedAppsErrors", startupFailOnManagedAppsErrors) .add("catalogInitial", catalogInitial) .add("catalogAdd", catalogAdd) .add("catalogReset", catalogReset) .add("catalogForce", catalogForce) .add("stopWhichAppsOnShutdown", stopWhichAppsOnShutdown) .add("noShutdownOnExit", noShutdownOnExit) .add("stopOnKeyPress", stopOnKeyPress) .add("localBrooklynProperties", localBrooklynProperties) .add("persist", persist) .add("persistenceLocation", persistenceLocation) .add("persistenceDir", persistenceDir) .add("highAvailability", highAvailability); }
Source:
<code>private Color getColor(RGB rgb) { if (rgb == null) { return null; } <START> return resourceManger.createColor(rgb); <END> }</code><technical_language>no. This is wrong create a new color object time (actually created, manager is incrementing a reference counter)</technical_language>

Target:
private Color getColor(RGB rgb) { if (rgb == null) { return null; } return fColors.getUnchecked(rgb); }
Source:
<code>public void testConnectOverProxy_explicit_http_uses_direct_connection() throws Exception { CountingProxy countingProxy = CountingProxy.start(); try { Proxy proxy = countingProxy.asProxy(); <START> FtpURLConnection connection <END> = (FtpURLConnection) fileUrl.openConnection(proxy); assertContents(connection.getInputStream()); } finally { int numConnections = countingProxy.shutdownAndGetConnectionCount(); assertEquals(0, numConnections); } }</code><technical_language>need FtpURLConnection here</technical_language>

Target:
public void testConnectOverProxy_explicit_http_uses_direct_connection() throws Exception { URL fileUrl = addFileEntry(FILE_PATH, fileContents); CountingProxy countingProxy = CountingProxy.start(); final int numConnections; try { Proxy proxy = countingProxy.asProxy(); URLConnection connection = fileUrl.openConnection(proxy); assertContents(fileContents, connection.getInputStream()); } finally { numConnections = countingProxy.shutdownAndGetConnectionCount(); } assertEquals(0, numConnections); }
Source:
<code>public void existsByExampleShouldReturnNonExistingWithoutThrowException() { Example<ReactivePerson> example = Example.of(new ReactivePerson("foo", "bar", -1)); <START> StepVerifier.create(repository.findOne(example)).expectNextCount(0).verifyComplete(); <END> }</code><technical_language>expectNextCount(0) omitted simplified StepVerifier.create(repository.findOne(example)).verifyComplete();</technical_language>

Target:
public void existsByExampleShouldReturnNonExistingWithoutThrowException() { Example<ReactivePerson> example = Example.of(new ReactivePerson("foo", "bar", -1)); StepVerifier.create(repository.findOne(example)).verifyComplete(); }
Source:
<code>void serializeMessageInfoList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { for (MessageInfo messageInfo : messageInfoList) { outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? (byte) 1 : 0); if (version == MessageInfoListVersion_V2) { Long crc = messageInfo.getCrc(); if (crc != null) { <START> outputBuffer.put((byte) 1); <END> outputBuffer.putLong(crc); } else { outputBuffer.put((byte) 0); } } } } }</code><technical_language>prefer constants</technical_language>

Target:
void serializeMessageInfoList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { for (MessageInfo messageInfo : messageInfoList) { outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); if (version == MessageInfoListVersion_V2) { Long crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } } } } }
Source:
<code>public static ModelStats computeStats(String theResult) { ModelStats modelStats = new ModelStats(); Stats wordStats = tokenLevelStats(theResult); modelStats.setTokenStats(wordStats); Stats fieldStats = fieldLevelStats(theResult); modelStats.setFieldStats(fieldStats); <START> theResult = theResult.replace("\n\n", "\n \n"); <END> StringTokenizer stt = new StringTokenizer(theResult, "\n"); boolean allGood = true; int correctInstance = 0; int totalInstance = 0; String line = null; while (stt.hasMoreTokens()) { line = stt.nextToken(); if ((line.trim().length() == 0) || (!stt.hasMoreTokens())) { totalInstance++; if (allGood) { correctInstance++; } allGood = true; } else { StringTokenizer st = new StringTokenizer(line, "\t "); String obtainedLabel = null; String expectedLabel = null; while (st.hasMoreTokens()) { obtainedLabel = getPlainLabel(st.nextToken()); if (st.hasMoreTokens()) { expectedLabel = obtainedLabel; } } if (!obtainedLabel.equals(expectedLabel)) { allGood = false; } } } modelStats.setTotalInstances(totalInstance); modelStats.setCorrectInstance(correctInstance); return modelStats; }</code><technical_language>I is copied current code. I find a bit hard follow. This replace new line feeds new line feeds a space in-between them. I guess in general easier if this method parse result. out of scope</technical_language>

Target:
public static ModelStats computeStats(String theResult) { return new ModelStats(theResult); }
Source:
<code>private static String checkSitePathToken(Site site, String pattern) { if (site.getRequestScheme().hasPathToken()) { <START> StringBuilder modified = new StringBuilder(pattern.length() + 8); <END> modified.append("/*"); if (!pattern.isEmpty() && !pattern.startsWith("/")) { modified.append('/'); } modified.append(pattern); return modified.toString(); } else { return pattern; } }</code><technical_language>8</technical_language>

Target:
private static String checkSitePathToken(Site site, String pattern) { if (site.getRequestScheme().hasPathToken()) { StringBuilder modified = new StringBuilder(pattern.length() + 3); modified.append("/*"); if (!pattern.isEmpty() && !pattern.startsWith("/")) { modified.append('/'); } modified.append(pattern); return modified.toString(); } else { return pattern; } }
Source:
<code>public CompletableFuture<Void> restoreSnapshot(String snapshotName) { <START> boolean takeFailSafeSnapshot = false; <END> return restoreSnapshot(snapshotName, takeFailSafeSnapshot); }</code><technical_language>I safe inline this var</technical_language>

Target:
public CompletableFuture<Void> restoreSnapshot(String snapshotName) { return restoreSnapshot(snapshotName, false); }
Source:
<code><START> public void select(final int... indices) { <END> waitForEnabled(); if (indices.length > 1) assertMultiSelect(); setFocus(); log.debug(MessageFormat.format("Selecting rows {0} in table {1}", StringUtils.join(indices, ", "), this)); for (int i = 0; i < indices.length; i++) { assertIsLegalRowIndex(indices[i]); } asyncExec(new VoidResult() { public void run() { for (int i = 0; i < indices.length; i++) { lastSelectionItem = widget.getItem(indices[i]); if (i == 0) { widget.setSelection(indices[0]); notifySelect(); } else { widget.select(indices[i]); notifySelect(true); } } } }); }</code><technical_language>This method effect if called empty array. I intended behaviour select nothing, ie. call unselect()</technical_language>

Target:
public void select(final int... indices) { waitForEnabled(); if (indices.length > 1) { assertMultiSelect(); } else if (indices.length == 0) { unselect(); return; } setFocus(); log.debug(MessageFormat.format("Selecting rows {0} in table {1}", StringUtils.join(indices, ", "), this)); for (int i = 0; i < indices.length; i++) { assertIsLegalRowIndex(indices[i]); } asyncExec(new VoidResult() { public void run() { for (int i = 0; i < indices.length; i++) { lastSelectionItem = widget.getItem(indices[i]); if (i == 0) { widget.setSelection(indices[0]); notifySelect(); } else { widget.select(indices[i]); notifySelect(true); } } } }); }
Source:
<code>public <K> Map<K, FixedLengthSliceInput> readFully(Map<K, DiskRange> diskRanges) throws IOException { checkNotNull(diskRanges, "diskRanges is null"); if (diskRanges.isEmpty()) { return ImmutableMap.of(); } Iterable<DiskRange> mergedRanges = mergeAdjacentDiskRanges(diskRanges.values(), maxMergeDistance, maxReadSize); Map<DiskRange, byte[]> buffers = new LinkedHashMap<>(); for (DiskRange mergedRange : mergedRanges) { byte[] buffer = new byte[mergedRange.getLength()]; readFully(mergedRange.getOffset(), buffer); buffers.put(mergedRange, buffer); } ImmutableMap.Builder<K, FixedLengthSliceInput> slices = ImmutableMap.builder(); <START> for (Entry<K, DiskRange> entry : diskRanges.entrySet()) { <END> slices.put(entry.getKey(), new BasicSliceInput(getDiskRangeSlice(entry.getValue(), buffers))); } return slices.build(); }</code><technical_language>If lambda expression, codes simple</technical_language>

Target:
public <K> Map<K, FixedLengthSliceInput> readFully(Map<K, DiskRange> diskRanges) throws IOException { checkNotNull(diskRanges, "diskRanges is null"); if (diskRanges.isEmpty()) { return ImmutableMap.of(); } Iterable<DiskRange> mergedRanges = mergeAdjacentDiskRanges(diskRanges.values(), maxMergeDistance, maxReadSize); Map<DiskRange, byte[]> buffers = new LinkedHashMap<>(); for (DiskRange mergedRange : mergedRanges) { byte[] buffer = new byte[mergedRange.getLength()]; readFully(mergedRange.getOffset(), buffer); buffers.put(mergedRange, buffer); } ImmutableMap.Builder<K, FixedLengthSliceInput> slices = ImmutableMap.builder(); diskRanges.forEach((K key, DiskRange range) -> slices.put(key, new BasicSliceInput(getDiskRangeSlice(range, buffers)))); return slices.build(); }
Source:
<code>private Coin(final long satoshis) { <START> if ( Math.abs(satoshis) > COIN_VALUE * NetworkParameters.MAX_COINS ) <END> throw new ArithmeticException("Magnitude of specified amount exceeds total possible quantity of Bitcoins."); this.value = satoshis; }</code><technical_language>COIN.value COIN_VALUE? need define a separate long constant for this</technical_language>

Target:
private Coin(final long satoshis) { checkArgument(Math.abs(satoshis) <= COIN_VALUE * NetworkParameters.MAX_COINS, "%s satoshis exceeds maximum possible quantity of Bitcoin.", satoshis); this.value = satoshis; }
Source:
<code><START> public static String fixLocation(String location) { <END> String[] parts = location.split(":", 2); if (parts[1].charAt(0) == '/') { return parts[0] + ":" + parts[1].substring(1); } return location; }</code><technical_language>this do? result is passed Datasets.load produce a dataset view URI. appears check if URI is absolute (assuming a scheme) remove beginning '/' if so</technical_language>

Target:
public static String fixLocation(String location) { int colon = location.indexOf(':'); if (colon != -1) { String scheme = location.substring(0, colon); String path = location.substring(colon+1); if (path.charAt(0) == '/') { return scheme + ":" + path.substring(1); } } return location; }
Source:
<code>public void resetFailures() { rpcManager0.throwBefore = false; rpcManager0.throwInFuture = false; <START> IntStream.of(0, 1, 2).mapToObj(this::cache).forEach(Cache::clear); <END> }</code><technical_language>suggestion: caches().forEach(Cache::clear);</technical_language>

Target:
public void resetFailures() { rpcManager0.throwBefore = false; rpcManager0.throwInFuture = false; caches().forEach(Cache::clear); }
Source:
<code>public void unauthorizedPerunAdmin() throws Exception { <START> assertFalse(AuthzResolver.authorized(new PerunSessionImpl( perun, new PerunPrincipal("pepa", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient() ), "default_policy")); <END> }</code><technical_language>I appreciate code style here. easy read. :slightly_smiling_face:</technical_language>

Target:
public void unauthorizedPerunAdmin() throws Exception { assertFalse(AuthzResolver.authorized(new PerunSessionImpl( perun, new PerunPrincipal("pepa", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient() ), "default_policy", Collections.emptyList())); }
Source:
<code>private boolean removeVm() { VM vm = getVm(); Guid vmId = getVmId(); hasImages = vm.getDiskList().size() > 0; if (getParameters().isRemoveDisks() && hasImages) { if (!removeVmImages(null)) { return false; <START> } else if (getReturnValue().getTaskIdList().isEmpty()) { <END> endCommandWithoutTasks(); } } else { endCommandWithoutTasks(); } return true; }</code><technical_language>need for "else" word..it's code more confusing in opinion</technical_language>

Target:
private boolean removeVm() { VM vm = getVm(); hasImages = vm.getDiskList().size() > 0; if (getParameters().isRemoveDisks() && hasImages) { if (!removeVmImages(null)) { return false; } } else { endCommandWithoutTasks(); } return true; }
Source:
<code>public LargeServerMessage createLargeMessage(final long id, final Message message) throws Exception { readLock(); try { if (isReplicated()) { replicator.largeMessageBegin(id); } LargeServerMessageImpl largeMessage = (LargeServerMessageImpl) createLargeMessage(); largeMessage.copyHeadersAndProperties(message); largeMessage.setMessageID(id); if (largeMessage.isDurable()) { final long maxRecordSize = getMaxRecordSize(); final int messageEncodeSize = largeMessage.getEncodeSize(); if (messageEncodeSize > maxRecordSize) { if (logger.isDebugEnabled()) { logger.debug("Message header too large for " + largeMessage); } else { <START> logger.warn("Message with id " + largeMessage.getMessageID() + " has a header too large. Set log level to debug to log the message header."); <END> } throw ActiveMQJournalBundle.BUNDLE.recordLargerThanStoreMax(messageEncodeSize, maxRecordSize); } } largeMessage.validateFile(); if (largeMessage.isDurable()) { long pendingRecordID = storePendingLargeMessage(id, LargeServerMessage.NO_PENDING_ID); largeMessage.setPendingRecordID(pendingRecordID); } return largeMessage; } finally { readUnLock(); } }</code><technical_language>things: - logger.warn called, matter what. - a Logger ID here? Also, change message this (when logger). "Message ID " + ID + " a header large. More information debug level for class " + org.apache.activemq.artemis.packageNameGoesHere.ClassNameGoesHere</technical_language>

Target:
public LargeServerMessage createLargeMessage(final long id, final Message message) throws Exception { readLock(); try { if (isReplicated()) { replicator.largeMessageBegin(id); } LargeServerMessageImpl largeMessage = (LargeServerMessageImpl) createLargeMessage(); largeMessage.copyHeadersAndProperties(message); largeMessage.setMessageID(id); if (largeMessage.isDurable()) { final long maxRecordSize = getMaxRecordSize(); final int messageEncodeSize = largeMessage.getEncodeSize(); if (messageEncodeSize > maxRecordSize) { ActiveMQServerLogger.LOGGER.messageWithHeaderTooLarge(largeMessage.getMessageID(), logger.getName()); if (logger.isDebugEnabled()) { logger.debug("Message header too large for " + largeMessage); } throw ActiveMQJournalBundle.BUNDLE.recordLargerThanStoreMax(messageEncodeSize, maxRecordSize); } } largeMessage.validateFile(); if (largeMessage.isDurable()) { long pendingRecordID = storePendingLargeMessage(id, LargeServerMessage.NO_PENDING_ID); largeMessage.setPendingRecordID(pendingRecordID); } return largeMessage; } finally { readUnLock(); } }
Source:
<code><START> public boolean isEmpty() { <END> return this.components.isEmpty(); }</code><technical_language>side of user, of implementation</technical_language>

Target:
public boolean isEmpty() { return !(this.bold.isPresent() || this.italic.isPresent() || this.underline.isPresent() || this.strikethrough.isPresent() || this.obfuscated.isPresent()); }
Source:
<code><START> public String getQueuedFlowIds() { <END> final List<Integer> allIds = new ArrayList<>(); try { getExecutionIdsHelper(allIds, this.executorLoader.fetchQueuedFlows()); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get queued flow ids.", e); } return allIds.toString(); }</code><technical_language>question above</technical_language>

Target:
public List<Integer> getQueuedFlowIds() { final List<Integer> allIds = new ArrayList<>(); try { getExecutionIdsHelper(allIds, this.executorLoader.fetchQueuedFlows()); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get queued flow ids.", e); } return allIds; }
Source:
<code>private EVCacheClient selectClient(List<EVCacheClient> clients) { if (clients == null) { if (log.isDebugEnabled()) log.debug("clients is null returning null!!!"); return null; } if (clients.size() == 1) { return clients.get(0); } <START> final long currentVal = Math.abs(numberOfModOps.incrementAndGet()); <END> final int index = (int) (currentVal % clients.size()); return clients.get(index); }</code><technical_language>move Math.abs next line for index</technical_language>

Target:
private EVCacheClient selectClient(List<EVCacheClient> clients) { if (clients == null) { if (log.isDebugEnabled()) log.debug("clients is null returning null!!!"); return null; } if (clients.size() == 1) { return clients.get(0); } final long currentVal = numberOfModOps.incrementAndGet(); final int index = Math.abs((int) (currentVal % clients.size())); return clients.get(index); }
Source:
<code>private boolean isConsoleCommandsExecutionAllowed() { if (getSelectedItem() == null) { return false; } <START> return getSelectedItems() <END> .stream() .map(consolesFactory::getVmConsolesForVm) .anyMatch(VmConsoles::canConnectToConsole); }</code><technical_language>getSelectedItems() return null here? I :) if() check for getSelectedItems() instead</technical_language>

Target:
private boolean isConsoleCommandsExecutionAllowed() { if (getSelectedItems() == null) { return false; } return getSelectedItems() .stream() .map(consolesFactory::getVmConsolesForVm) .anyMatch(VmConsoles::canConnectToConsole); }
Source:
<code>public List<Shard> getShards() { InputStream response = null; try { <START> response = client.get(buildUri(db.getDBUri()).path("/_shards").build()); <END> return getResponseList(response, client.getGson(), Shard.class, new TypeToken<List<Shard>>() { }.getType()); } finally { close(response); } }</code><technical_language>this / _shards need removing? In other places been</technical_language>

Target:
public List<Shard> getShards() { InputStream response = null; try { response = client.get(buildUri(getDBUri()).path("_shards").build()); return getResponseList(response, client.getGson(), Shard.class, new TypeToken<List<Shard>>() { }.getType()); } finally { close(response); } }
Source:
<code>public List<Diagnosis> getDiagnoses(Encounter encounter){ Query query = sessionFactory.getCurrentSession().createQuery( <START> "from Diagnosis d where d.encounter = :encounterId order by dateCreated desc"); <END> query.setInteger("encounterId", encounter.getId()); return query.list(); }</code><technical_language>comparing Encounter object for d.encounter Integer for encounter.getId()</technical_language>

Target:
public List<Diagnosis> getDiagnoses(Encounter encounter){ Query query = sessionFactory.getCurrentSession().createQuery( "from Diagnosis d where d.encounter.encounterId = :encounterId order by dateCreated desc"); query.setInteger("encounterId", encounter.getId()); return query.list(); }
Source:
<code>public static Iterable<? extends Object> data() { <START> return Arrays.asList(true, false); <END> }</code><technical_language>this yields 2 boxing warnings, suppress Boolean.TRUE FALSE</technical_language>

Target:
public static Iterable<? extends Object> data() { return Arrays.asList(Boolean.TRUE, Boolean.FALSE); }
Source:
<code>protected TmfXYChartViewer createChartViewer(Composite parent) { TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedXYTreeViewer_DefaultViewerTitle, Messages.ScriptedXYTreeViewer_DefaultXAxis, Messages.ScriptedXYTreeViewer_DefaultYAxis, 1); <START> return new TmfFilteredXYChartViewer(parent, settings, getViewSite().getSecondaryId().replace(ScriptedXYView.COLON, ":")); END> }</code><technical_language>inline, I meant call getSecondaryIdName() in constructor call instead of assigning a local variable before. a good idea a method retrieve this name trivial. bring getSecondaryIdName()</technical_language>

Target:
protected TmfXYChartViewer createChartViewer(Composite parent) { TmfXYChartSettings settings = new TmfXYChartSettings(Messages.ScriptedXYTreeViewer_DefaultViewerTitle, Messages.ScriptedXYTreeViewer_DefaultXAxis, Messages.ScriptedXYTreeViewer_DefaultYAxis, 1); return new TmfFilteredXYChartViewer(parent, settings, secondaryId); }
Source:
<code>public static Script createP2WPKHOutputScript(byte[] hash) { <START> checkArgument(hash.length == 20); <END> return new ScriptBuilder().smallNum(0).data(hash).build(); }</code><technical_language>I constant SegwitAddress.WITNESS_PROGRAM_LENGTH_PKH here</technical_language>

Target:
public static Script createP2WPKHOutputScript(byte[] hash) { checkArgument(hash.length == SegwitAddress.WITNESS_PROGRAM_LENGTH_PKH); return new ScriptBuilder().smallNum(0).data(hash).build(); }
Source:
<code>private BundleDescription[] addDevConstraints(BundleDescription[] reRefresh) { if (!developmentMode) return reRefresh; Set<BundleDescription> additionalRefresh = new HashSet<>(); ResolverBundle[] <START> unresolved = <END> unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle unresolved1 : unresolved) { addUnresolvedWithDependents(unresolved1, additionalRefresh); addHostsFromFragmentConstraints(unresolved1, additionalRefresh); } if (additionalRefresh.size() == 0) return reRefresh; if (reRefresh != null) for (BundleDescription reRefresh1 : reRefresh) { additionalRefresh.add(reRefresh1); } return additionalRefresh.toArray(new BundleDescription[additionalRefresh.size()]); }</code><technical_language>rename allUnresolved unresolved in foreach loop variable</technical_language>

Target:
private BundleDescription[] addDevConstraints(BundleDescription[] reRefresh) { if (!developmentMode) return reRefresh; Set<BundleDescription> additionalRefresh = new HashSet<>(); ResolverBundle[] allUnresolved = unresolvedBundles.toArray(new ResolverBundle[unresolvedBundles.size()]); for (ResolverBundle unresolved : allUnresolved ) { addUnresolvedWithDependents(unresolved, additionalRefresh); addHostsFromFragmentConstraints(unresolved, additionalRefresh); } if (additionalRefresh.size() == 0) return reRefresh; if (reRefresh != null) for (BundleDescription description : reRefresh) { additionalRefresh.add(description); } return additionalRefresh.toArray(new BundleDescription[additionalRefresh.size()]); }
Source:
<code>public AbstractSolaceDirectInputOperator() { <START> throwable = new AtomicReference<Throwable>(); <END> currentWindowRecoveryState = Maps.newLinkedHashMap(); }</code><technical_language>move this top logic requires it</technical_language>

Target:
public AbstractSolaceDirectInputOperator() { }
Source:
<code><START> public List<Citation> getByLicenseAndDOB(String driversLicenseNumber, String driversLiscenseState, LocalDate dob, String lastName) { <END> List<CitationDataSource> sources = citationDataSourceFactory.getAllCitationDataSources(); List<Observable<Citation>> citationSearches = Lists.newArrayList(); for(CitationDataSource source : sources) { citationSearches.add(Observable.from(source.getByLicenseAndDOB(driversLicenseNumber, driversLiscenseState, dob, lastName))); } return Observable.merge(citationSearches).onExceptionResumeNext(Observable.just(null)).toList().toBlocking().first(); }</code><technical_language>Please update name of method reflect params more generic. i.e. getByLicenseAndDOBAndLastName or, methods require DOB, getByLicenseAndLastName</technical_language>

Target:
public List<Citation> getByLicenseAndDOB(String driversLicenseNumber, String driversLiscenseState, LocalDate dob, String lastName) { List<CitationDataSource> sources = citationDataSourceFactory.getAllCitationDataSources(); List<Observable<Citation>> citationSearches = Lists.newArrayList(); for(CitationDataSource source : sources) { citationSearches.add(Observable.from(source.getByLicenseAndDOBAndLastName(driversLicenseNumber, driversLiscenseState, dob, lastName))); } return Observable.merge(citationSearches).onExceptionResumeNext(Observable.just(null)).toList().toBlocking().first(); }
Source:
<code>public void getStatesByApplicationIdShouldReturnAnEmptyList() { given(applicationsRepository.findOne(FIRST_ID)).willReturn(APPLICATION_ENTITY_WITHOUT_STATES); given(statesRepository.findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES)).willReturn(EMPTY_STATE_ENTITY_LIST); given(modelMapper.map(EMPTY_STATE_ENTITY_LIST, STATE_VIEW_DTO_LIST_TYPE)).willReturn(EMPTY_STATE_VIEW_DTO_LIST); List<StateViewDTO> stateViewDTOList = statesService.getStatesByApplicationId(FIRST_ID); assertThat(stateViewDTOList, notNullValue()); assertThat(stateViewDTOList.isEmpty(), is(true)); <START> then(applicationsRepository).should(times(AT_ONE_TIME)).findOne(FIRST_ID); <END> then(statesRepository).should(times(AT_ONE_TIME)).findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES); }</code><technical_language>should(times(1)) is should()</technical_language>

Target:
public void getStatesByApplicationIdShouldReturnAnEmptyList() { given(applicationsRepository.findOne(FIRST_ID)).willReturn(APPLICATION_ENTITY_WITHOUT_STATES); given(statesRepository.findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES)).willReturn(EMPTY_STATE_ENTITY_LIST); given(modelMapper.map(EMPTY_STATE_ENTITY_LIST, STATE_VIEW_DTO_LIST_TYPE)).willReturn(EMPTY_STATE_VIEW_DTO_LIST); List<StateViewDTO> stateViewDTOList = statesService.getStatesByApplicationId(FIRST_ID); assertThat(stateViewDTOList, notNullValue()); assertThat(stateViewDTOList.isEmpty(), is(true)); then(applicationsRepository).should().findOne(FIRST_ID); then(statesRepository).should().findByApplicationEntityOrderByStateIndexDesc(APPLICATION_ENTITY_WITHOUT_STATES); }
Source:
<code><START> public GroupTrainer( <END> IgniteCache<GroupTrainerCacheKey<K>, V> cache, Ignite ignite) { this.cache = cache; this.ignite = ignite; }</code><technical_language>class is declared package private, public modifier redundant. Consider declaring class public removing public modifier constructor</technical_language>

Target:
GroupTrainer( IgniteCache<GroupTrainerCacheKey<K>, V> cache, Ignite ignite) { this.cache = cache; this.ignite = ignite; }
Source:
<code>public void insertMetadata(String name, Metadata metadata) throws EntityNotFoundException { Product product = null; try { product = productManager.load(name); } catch (Exception e) { <START> log.warning("EntityNotFoundException: " + e.getMessage()); <END> throw new APIException(new EntityNotFoundException(Product.class, name, e)); } product.addMetadata(metadata); productManager.update(product); }</code><technical_language>Idem, warning error</technical_language>

Target:
public void insertMetadata(String name, Metadata metadata) throws APIException { Product product = null; try { product = productManager.load(name); } catch (Exception e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class, name, e)); } product.addMetadata(metadata); productManager.update(product); }
Source:
<code>public CompletableFuture<Void> visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable { <START> return ctx.onReturn((rCtx, rCommand, rv, throwable) -> { <END> lockManager.unlockAll(ctx); return null; }); }</code><technical_language>unlockAllReturnHandler used</technical_language>

Target:
public CompletableFuture<Void> visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable { return ctx.onReturn(unlockAllReturnHandler); }
Source:
<code>private <T extends JestResult> T deserializeResponse(HttpResponse response, final HttpRequest httpRequest, Action<T> clientRequest) throws IOException { StatusLine statusLine = response.getStatusLine(); try { return clientRequest.createNewElasticSearchResult( response.getEntity() == null ? null : EntityUtils.toString(response.getEntity()), statusLine.getStatusCode(), statusLine.getReasonPhrase(), gson ); } catch (com.google.gson.JsonSyntaxException e) { for (Header header : response.getAllHeaders()) { final String mimeType = header.getValue(); if (!mimeType.startsWith("application/json")) { throw new IOException("Request " + httpRequest.toString() + " yielded " + mimeType <START> + ", should be json: " + statusLine.toString()); <END> } } throw e; } }</code><technical_language>Adding original JsonSyntaxException good idea eventhough end long stack trace in original message. add kind of edge cases people run information is information all. :)</technical_language>

Target:
private <T extends JestResult> T deserializeResponse(HttpResponse response, final HttpRequest httpRequest, Action<T> clientRequest) throws IOException { StatusLine statusLine = response.getStatusLine(); try { return clientRequest.createNewElasticSearchResult( response.getEntity() == null ? null : EntityUtils.toString(response.getEntity()), statusLine.getStatusCode(), statusLine.getReasonPhrase(), gson ); } catch (com.google.gson.JsonSyntaxException e) { for (Header header : response.getAllHeaders()) { final String mimeType = header.getValue(); if (!mimeType.startsWith("application/json")) { final String message = "Request " + httpRequest.toString() + " yielded " + mimeType + ", should be json: " + statusLine.toString(); throw new IOException(message, e); } } throw e; } }
Source:
<code>private void showResults(final Shell shell) { if (this.results.isEmpty()) return; else if (this.results.size() == 1) { Entry<Repository, Object> entry = this.results.entrySet() .iterator().next(); if (entry.getValue() instanceof PullResult) new PullResultDialog(shell, entry.getKey(), (PullResult) entry .getValue()).open(); else { IStatus status = (IStatus) entry.getValue(); if (status == NOT_TRIED_STATUS) { MessageDialog .openInformation( shell, UIText.PullOperationUI_PullCanceledWindowTitle, UIText.PullOperationUI_PullOperationCanceledMessage); } else if (status.getException() instanceof TransportException) { <START> MessageDialog <END> .openWarning( shell, UIText.PullOperationUI_PullFailed, NLS.bind( UIText.PullOperationUI_GitDataTransferFailed, status.getMessage())); } else Activator.handleError(status.getMessage(), status .getException(), true); } } else new MultiPullResultDialog(shell, results).open(); }</code><technical_language>ErrorDialog.openError pass status in there. This people confronted JGit error message (only if want details) able copy error message</technical_language>

Target:
private void showResults(final Shell shell) { if (this.results.isEmpty()) return; else if (this.results.size() == 1) { Entry<Repository, Object> entry = this.results.entrySet() .iterator().next(); if (entry.getValue() instanceof PullResult) new PullResultDialog(shell, entry.getKey(), (PullResult) entry .getValue()).open(); else { IStatus status = (IStatus) entry.getValue(); if (status == NOT_TRIED_STATUS) { MessageDialog .openInformation( shell, UIText.PullOperationUI_PullCanceledWindowTitle, UIText.PullOperationUI_PullOperationCanceledMessage); } else if (status.getException() instanceof TransportException) { ErrorDialog.openError(shell, UIText.PullOperationUI_PullFailed, UIText.PullOperationUI_ConnectionProblem, status); } else Activator.handleError(status.getMessage(), status .getException(), true); } } else new MultiPullResultDialog(shell, results).open(); }
Source:
<code>private void fetchAdvancedDetails(String volumeName) { VDSReturnValue returnValue = executeCommand(volumeName); <START> getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); <END> }</code><technical_language>I is set return topmost level i.e. in executeQueryCommand() I suggest remove this method, rename executeCommand() fetchAdvancedDetails(). code in executeQueryCommand() like: @Override protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (StringUtils.isNotEmpty(volumeName)) { getQueryReturnValue().setReturnValue(fetchAdvancedDetails(volumeName)); } else { getQueryReturnValue().setReturnValue(getServiceInfo()); } } This means methods getServiceInfo() fetchAdvancedDetails() return GlusterVolumeAdvancedDetails</technical_language>

Target:
private GlusterVolumeAdvancedDetails fetchAdvancedDetails(String volumeName) { VDSReturnValue returnValue = getBackendResourceManager().RunVdsCommand(VDSCommandType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsVDSParameters(getUpServerId(getParameters().getClusterId()), getParameters().getClusterId(), volumeName, getParameters().getBrickName(), getParameters().isDetailRequired())); return (GlusterVolumeAdvancedDetails) returnValue.getReturnValue(); }
Source:
<code>public void handleData(final ITmfEvent event) { super.handleData(event); if (event != null && event.getTrace() == trace) { sci.processEvent(event); } else if (event != null && experiment != null) { <START> for (ITmfTrace childTrace : experiment.getTraces()) { <END> if (childTrace == event.getTrace()) { sci.processEvent(event); } } } }</code><technical_language>too, getTraceSet() check contents. way, need 'experiment' field all</technical_language>

Target:
public void handleData(final ITmfEvent event) { super.handleData(event); if (event != null) { for (ITmfTrace onetrace : TmfTraceManager.getTraceSet(trace)) { if (event.getTrace() == onetrace) { sci.processEvent(event); } } } }
Source:
<code>public SimpleDocumentModel(String... schemas) { <START> this(Arrays.asList(schemas)); <END> }</code><technical_language>replaced List.of</technical_language>

Target:
public SimpleDocumentModel(String... schemas) { this(List.of(schemas)); }
Source:
<code>public void registerCachedFile(String filePath, String name) throws RuntimeException, IOException { if (!this.cacheFile.containsKey(name)) { try { URI u = new URI(filePath); if (!u.getPath().startsWith("/")) { u = new URI(new File(filePath).getAbsolutePath()); } FileSystem fs = FileSystem.get(u); if (fs.exists(new Path(u.getPath()))) { this.cacheFile.put(name, u.toString()); } else { <START> throw new RuntimeException("File " + u.toString() + " oesn't exist."); <END> } } catch (URISyntaxException ex) { throw new RuntimeException("Invalid path: " + filePath); } } else { throw new RuntimeException("cache file " + name + "already exists!"); } }</code><technical_language>typo</technical_language>

Target:
public void registerCachedFile(String filePath, String name) throws RuntimeException, IOException { if (!this.cacheFile.containsKey(name)) { try { URI u = new URI(filePath); if (!u.getPath().startsWith("/")) { u = new URI(new File(filePath).getAbsolutePath()); } FileSystem fs = FileSystem.get(u); if (fs.exists(new Path(u.getPath()))) { this.cacheFile.put(name, u.toString()); } else { throw new RuntimeException("File " + u.toString() + " doesn't exist."); } } catch (URISyntaxException ex) { throw new RuntimeException("Invalid path: " + filePath, ex); } } else { throw new RuntimeException("cache file " + name + "already exists!"); } }
Source:
<code>public static void checkAcidTable(CatalogTable catalogTable, ObjectPath tablePath) { <START> if (catalogTable != null && catalogTable.getOptions() != null) { <END> String tableIsTransactional = catalogTable.getOptions().get("transactional"); if (tableIsTransactional == null) { tableIsTransactional = catalogTable.getOptions().get("transactional".toUpperCase()); } if (tableIsTransactional != null && tableIsTransactional.equalsIgnoreCase("true")) { throw new FlinkHiveException(String.format("Reading or writing ACID table %s is not supported.", tablePath)); } } }</code><technical_language>catalogTable tablePath null, a constructor of HiveTableSource</technical_language>

Target:
public static void checkAcidTable(CatalogTable catalogTable, ObjectPath tablePath) { String tableIsTransactional = catalogTable.getOptions().get("transactional"); if (tableIsTransactional == null) { tableIsTransactional = catalogTable.getOptions().get("transactional".toUpperCase()); } if (tableIsTransactional != null && tableIsTransactional.equalsIgnoreCase("true")) { throw new FlinkHiveException(String.format("Reading or writing ACID table %s is not supported.", tablePath)); } }
Source:
<code>private double calculateWeightedAverageResponse(List<DiseaseOccurrenceReview> reviews) { double weightedResponseTotal = 0.0; double expertWeightingsTotal = 0.0; for (DiseaseOccurrenceReview review : reviews) { double expertWeighting = review.getExpert().getWeighting(); weightedResponseTotal += review.getResponse().getValue() * expertWeighting; expertWeightingsTotal += expertWeighting; } <START> double normalisedValue = weightedResponseTotal / expertWeightingsTotal; <END> return shift(normalisedValue); }</code><technical_language>this a division zero? e.g. If reviews, if weightings of experts 0</technical_language>

Target:
private double calculateWeightedAverageResponse(List<DiseaseOccurrenceReview> reviews) { double weightedResponseTotal = 0.0; double expertWeightingsTotal = 0.0; for (DiseaseOccurrenceReview review : reviews) { double expertWeighting = review.getExpert().getWeighting(); weightedResponseTotal += review.getResponse().getValue() * expertWeighting; expertWeightingsTotal += expertWeighting; } return (expertWeightingsTotal == 0.0) ? 0.0 : shift(weightedResponseTotal / expertWeightingsTotal); }
Source:
<code>private AuthConfig authConfigUsingStore(final JsonNode config, final String reposName) throws Exception { final JsonNode credsStoreNode = config.get("credsStore"); if (credsStoreNode != null && !credsStoreNode.isMissingNode() && credsStoreNode.isTextual()) { final String credsStore = credsStoreNode.asText(); if (isBlank(credsStore)) { <START> log.warn("CredStore field will be ignored, because value is blank"); <END> return null; } return runCredentialProvider(reposName, credsStore); } return null; }</code><technical_language>a bit clearer: suggestion log.warn("Docker auth config credsStore field ignored, is blank");</technical_language>

Target:
private AuthConfig authConfigUsingStore(final JsonNode config, final String reposName) throws Exception { final JsonNode credsStoreNode = config.get("credsStore"); if (credsStoreNode != null && !credsStoreNode.isMissingNode() && credsStoreNode.isTextual()) { final String credsStore = credsStoreNode.asText(); if (isBlank(credsStore)) { log.warn("Docker auth config credsStore field will be ignored, because value is blank"); return null; } return runCredentialProvider(reposName, credsStore); } return null; }
Source:
<code>public void testShutdown() { final int POOL_SIZE = 25; final int CHECKOUT = POOL_SIZE; SynchronousLifecycle lifecycle = new SynchronousLifecycle(); final AsyncPool<AtomicBoolean> pool = new AsyncPoolImpl<AtomicBoolean>("object pool", lifecycle, POOL_SIZE, 100, _executor ); pool.start(); List<AtomicBoolean> objects = new ArrayList<AtomicBoolean>(CHECKOUT); for (int i = 0; i < CHECKOUT; i++) { FutureCallback<AtomicBoolean> cb = new FutureCallback<AtomicBoolean>(); pool.get(cb); try { AtomicBoolean o = cb.get(); Assert.assertNotNull(o); objects.add(o); } catch (Exception e) { Assert.fail("unexpected error", e); } } FutureCallback<None> shutdown = new FutureCallback<None>(); pool.shutdown(shutdown); for (AtomicBoolean o : objects) { Assert.assertFalse(shutdown.isDone(), "Pool shutdown with objects checked out"); pool.put(o); } try { shutdown.get(); } catch (Exception e) { Assert.fail("unexpected error", e); } <START> } <END></code><technical_language>change type <Object> <AtomicBoolean>? This winds making unnecessary changes a bunch of other test cases. If do need AtomicBooleans, this a SynchronousLifecycle<T> care continue Object pool AtomicBoolean pool</technical_language>

Target:
public void testShutdown() { final int POOL_SIZE = 25; final int CHECKOUT = POOL_SIZE; SynchronousLifecycle lifecycle = new SynchronousLifecycle(); final AsyncPool<Object> pool = new AsyncPoolImpl<Object>("object pool", lifecycle, POOL_SIZE, 100, _executor ); pool.start(); List<Object> objects = new ArrayList<Object>(CHECKOUT); for (int i = 0; i < CHECKOUT; i++) { FutureCallback<Object> cb = new FutureCallback<Object>(); pool.get(cb); try { Object o = cb.get(); Assert.assertNotNull(o); objects.add(o); } catch (Exception e) { Assert.fail("unexpected error", e); } } FutureCallback<None> shutdown = new FutureCallback<None>(); pool.shutdown(shutdown); for (Object o : objects) { Assert.assertFalse(shutdown.isDone(), "Pool shutdown with objects checked out"); pool.put(o); } try { shutdown.get(); } catch (Exception e) { Assert.fail("unexpected error", e); } }
Source:
<code>HdfsConfiguration createHdfsConfiguration(HiveClientConfig config) { S3ConfigurationUpdater s3Config = new PrestoS3ConfigurationUpdater(new HiveS3Config() .setS3AwsAccessKey(awsAccessKey) .setS3AwsSecretKey(awsSecretKey)); <START> return new HiveHdfsConfiguration(new HdfsConfigurationUpdater(config, s3Config), emptySet()); <END> }</code><technical_language>nit: ImmutableSet.of() for consistency</technical_language>

Target:
HdfsConfiguration createHdfsConfiguration(HiveClientConfig config) { S3ConfigurationUpdater s3Config = new PrestoS3ConfigurationUpdater(new HiveS3Config() .setS3AwsAccessKey(awsAccessKey) .setS3AwsSecretKey(awsSecretKey)); return new HiveHdfsConfiguration(new HdfsConfigurationInitializer(config, s3Config, ignored -> {}), ImmutableSet.of()); }
Source:
<code><START> private static byte[] generateData(int len) { <END> byte[] bytes = new byte[len]; new Random().nextBytes(bytes); return bytes; }</code><technical_language>nit: this reused in other places, ChannelStateSerializerImplTest#getData(int len), ChannelStateSerializerTest#randomBytes</technical_language>

Target:
static byte[] generateData(int len) { byte[] bytes = new byte[len]; new Random().nextBytes(bytes); return bytes; }