auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void setup() throws IOException, URISyntaxException { canReadFileName = this.getClass().getResource("small_file.txt").toURI().toASCIIString().replaceAll("file:", ""); System.setProperty("org.ovirt.engine.mime.types", <START> this.getClass().getResource("mime.types").toURI().toASCIIString().replaceAll("file:", "")); <END> }</code><technical_language>set this pom.xml effect tests</technical_language>

Target:
public void setup() throws IOException, URISyntaxException { canReadFileName = this.getClass().getResource("small_file.txt").toURI().toASCIIString().replaceAll("file:", ""); }
Source:
<code>private void completeSnapshotTransfer(LogReplicationEntry message) { <START> topologyConfigId = message.getMetadata().getTopologyConfigId(); <END> logReplicationMetadataManager.setLastSnapshotTransferCompleteTimestamp(topologyConfigId, message.getMetadata().getSnapshotTimestamp()); }</code><technical_language>need update topologyConfigId here</technical_language>

Target:
private void completeSnapshotTransfer(LogReplicationEntry message) { logReplicationMetadataManager.setLastSnapshotTransferCompleteTimestamp(topologyConfigId, message.getMetadata().getSnapshotTimestamp()); }
Source:
<code>public void theReplaceKeysResponseShouldBeReturned(final Map<String, String> responseParameters) throws Throwable { final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID); final Map<String, String> extendedParameters = SettingsHelper.addDefault(responseParameters, PlatformKeys.KEY_CORRELATION_UID, correlationUid); try { final ReplaceKeysAsyncRequest replaceKeysAsyncRequest = ReplaceKeysRequestFactory .fromParameterMapAsync(extendedParameters); final ReplaceKeysResponse response = this.smartMeteringConfigurationClient .getReplaceKeysResponse(replaceKeysAsyncRequest); final String expectedResult = responseParameters.get(PlatformKeys.KEY_RESULT); assertNotNull("Result", response.getResult()); <START> assertEquals("Result", expectedResult, response.getResult().name()); <END> } catch (final Exception exception) { ScenarioContext.current().put(PlatformKeys.RESPONSE, exception); } }</code><technical_language>this code deals cases of a regular response a fault response, asserting result in response storing exception. code (including step in feature) is clearer if scenarios treated separately (as done in other similar cases I think). Some of step data feature seems, exception occurs assertions compare results data steps</technical_language>

Target:
public void theReplaceKeysResponseShouldBeReturned(final Map<String, String> responseParameters) throws Throwable { final String correlationUid = (String) ScenarioContext.current().get(PlatformKeys.KEY_CORRELATION_UID); final Map<String, String> extendedParameters = SettingsHelper.addDefault(responseParameters, PlatformKeys.KEY_CORRELATION_UID, correlationUid); final ReplaceKeysAsyncRequest replaceKeysAsyncRequest = ReplaceKeysRequestFactory .fromParameterMapAsync(extendedParameters); final ReplaceKeysResponse response = this.smartMeteringConfigurationClient .getReplaceKeysResponse(replaceKeysAsyncRequest); final String expectedResult = responseParameters.get(PlatformKeys.KEY_RESULT); assertNotNull("Result", response.getResult()); assertEquals("Result", expectedResult, response.getResult().name()); }
Source:
<code>private void processResponse(String responseText) throws LIRCResponseException { String[] parts = responseText.split("\n"); String command = parts[0]; boolean success = true; int dataLength = 0; String[] data = null; if (parts.length > 1) { <START> <END> if ("SUCCESS".equals(parts[1]) || "ERROR".equals(parts[1])) { success = "SUCCESS".equals(parts[1]); } else { throw new LIRCResponseException("Malformed response"); } } if (parts.length > 2) { if ("DATA".equals(parts[2]) && parts.length > 3) { dataLength = Integer.parseInt(parts[3]); } else { throw new LIRCResponseException("Malformed response"); } } if (parts.length > 4) { data = Arrays.copyOfRange(parts, 4, parts.length); if (data.length != dataLength) { throw new LIRCResponseException(String .format("Data does not match expected length. Expected: %s, Got: %s", dataLength, data.length)); } } LIRCResponse response = new LIRCResponse(); response.setCommand(command); response.setSuccess(success); response.setData(data); connector.sendMessageToListeners(response); }</code><technical_language>blank line</technical_language>

Target:
private void processResponse(String responseText) throws LIRCResponseException { String[] parts = responseText.split("\n"); String command = parts[0]; boolean success = true; int dataLength = 0; String[] data = null; if (parts.length > 1) { if ("SUCCESS".equals(parts[1]) || "ERROR".equals(parts[1])) { success = "SUCCESS".equals(parts[1]); } else { throw new LIRCResponseException("Malformed response"); } } if (parts.length > 2) { if ("DATA".equals(parts[2]) && parts.length > 3) { dataLength = Integer.parseInt(parts[3]); } else { throw new LIRCResponseException("Malformed response"); } } if (parts.length > 4) { data = Arrays.copyOfRange(parts, 4, parts.length); if (data.length != dataLength) { throw new LIRCResponseException(String .format("Data does not match expected length. Expected: %s, Got: %s", dataLength, data.length)); } } LIRCResponse response = new LIRCResponse(command, success, data); connector.sendMessageToListeners(response); }
Source:
<code><START> public String[] getComputerNames() { <END> return getActive().stream().map(a -> a.getSimpleName()).collect(Collectors.toList()) .toArray(new String[computers.size()]); }</code><technical_language>getComputerOpNames()</technical_language>

Target:
public String[] getComputerNames() { return getActiveComputers().stream().map(a -> a.getSimpleName()).collect(Collectors.toList()) .toArray(new String[computers.size()]); }
Source:
<code>private File removeDuplicatesFromJar(File in, List<String> duplicates) { String target = project.getBuild().getOutputDirectory(); <START> File tmp = new File(target, "unpacked-wembedded-jars"); <END> tmp.mkdirs(); File out = new File(tmp, in.getName()); if (out.exists()) { return out; } else { try { out.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } FileOutputStream fos = null; ZipOutputStream jos = null; try { fos = new FileOutputStream(out); jos = new ZipOutputStream(fos); } catch (FileNotFoundException e1) { getLog().error("Cannot remove duplicates : the output file " + out.getAbsolutePath() + " does not found"); return null; } ZipFile inZip = null; try { inZip = new ZipFile(in); Enumeration< ? extends ZipEntry> entries = inZip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (! duplicates.contains(entry.getName())) { jos.putNextEntry(entry); InputStream currIn = inZip.getInputStream(entry); copyStreamWithoutClosing(currIn, jos); currIn.close(); jos.closeEntry(); } } } catch (IOException e) { getLog().error("Cannot removing duplicates : " + e.getMessage()); return null; } try { if (inZip != null) { inZip.close(); } jos.close(); fos.close(); jos = null; fos = null; } catch (IOException e) { } getLog().info(in.getName() + " rewritten without duplicates : " + out.getAbsolutePath()); return out; }</code><technical_language>is this a typo</technical_language>

Target:
private File removeDuplicatesFromJar(File in, List<String> duplicates) { String target = project.getBuild().getOutputDirectory(); File tmp = new File(target, "unpacked-embedded-jars"); tmp.mkdirs(); File out = new File(tmp, in.getName()); if (out.exists()) { return out; } else { try { out.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } FileOutputStream fos = null; ZipOutputStream jos = null; try { fos = new FileOutputStream(out); jos = new ZipOutputStream(fos); } catch (FileNotFoundException e1) { getLog().error("Cannot remove duplicates : the output file " + out.getAbsolutePath() + " does not found"); return null; } ZipFile inZip = null; try { inZip = new ZipFile(in); Enumeration< ? extends ZipEntry> entries = inZip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (! duplicates.contains(entry.getName())) { jos.putNextEntry(entry); InputStream currIn = inZip.getInputStream(entry); copyStreamWithoutClosing(currIn, jos); currIn.close(); jos.closeEntry(); } } } catch (IOException e) { getLog().error("Cannot removing duplicates : " + e.getMessage()); return null; } try { if (inZip != null) { inZip.close(); } jos.close(); fos.close(); jos = null; fos = null; } catch (IOException e) { } getLog().info(in.getName() + " rewritten without duplicates : " + out.getAbsolutePath()); return out; }
Source:
<code>private Properties getJobConfFromFile(RunningJob runningJob) { Properties jobConfProperties = new Properties(); try { log.info("RunningJob Configuration File location: " + runningJob.getJobFile()); Path path = new Path(runningJob.getJobFile()); Configuration conf = new Configuration(false); FileSystem fileSystem = FileSystem.get(new Configuration()); InputStream inputStream = fileSystem.open(path); conf.addResource(inputStream); for (Map.Entry<String, String> entry : conf) { if (entry.getKey().equals("pig.script")) { String script = StringUtils.newStringUtf8(Base64.decodeBase64(entry.getValue())); int lineCounter = 1; script = "<div class=\"jobScript\" id=\"scriptLine" + lineCounter + "\">" + "<span class=\"lineNumber\">" + lineCounter + "</span>" + script; while (script.contains("\n")) { lineCounter++; script = script.replaceFirst("\n", "</div><div class=\"jobScript\" id=\"scriptLine" + lineCounter + "\">" + "<span class=\"lineNumber\">" + lineCounter + "</span>"); } <START> jobConfProperties.setProperty(entry.getKey(), script + "</div>"); <END> } else if (entry.getKey().equals("pig.mapPlan") || entry.getKey().equals("pig.reducePlan")) { jobConfProperties.setProperty(entry.getKey(), ObjectSerializer.deserialize(entry.getValue()).toString()); } else { jobConfProperties.setProperty(entry.getKey(), entry.getValue()); } } } catch (FileNotFoundException e) { log.error("Configuration File Not Found"); } catch (IOException e) { e.printStackTrace(); } return jobConfProperties; }</code><technical_language>listener generating html. done Ambrose UI</technical_language>

Target:
private Properties getJobConfFromFile(RunningJob runningJob) { Properties jobConfProperties = new Properties(); try { log.info("RunningJob Configuration File location: " + runningJob.getJobFile()); Path path = new Path(runningJob.getJobFile()); Configuration conf = new Configuration(false); FileSystem fileSystem = FileSystem.get(new Configuration()); InputStream inputStream = fileSystem.open(path); conf.addResource(inputStream); for (Map.Entry<String, String> entry : conf) { if (entry.getKey().equals("pig.mapPlan") || entry.getKey().equals("pig.reducePlan")) { jobConfProperties.setProperty(entry.getKey(), ObjectSerializer.deserialize(entry.getValue()).toString()); } else { jobConfProperties.setProperty(entry.getKey(), entry.getValue()); } } } catch (FileNotFoundException e) { log.warn("Configuration file not found for old jobsflows."); } catch (IOException e) { log.warn("Error occurred when retrieving configuration info.", e); } return jobConfProperties; }
Source:
<code>public synchronized Collection<ModuleDeploymentStatus> getResults() throws InterruptedException { long now = System.currentTimeMillis(); long expiryTime = now + deploymentTimeout.get(); while (pending.size() > 0 && now < expiryTime) { wait(expiryTime - now); now = System.currentTimeMillis(); } for (ContainerModuleKey key : pending) { results.put(key, new ModuleDeploymentStatus(key.container, Integer.valueOf(key.moduleSequence), key.moduleDescriptorKey, ModuleDeploymentStatus.State.failed, String.format("Deployment of module '%s' to container '%s' timed out after %d ms", <START> key.moduleDescriptorKey, key.container, deploymentTimeout))); <END> } return results.values(); }</code><technical_language>deploymentTimeout.get() string format is expecting a number</technical_language>

Target:
public synchronized Collection<ModuleDeploymentStatus> getResults() throws InterruptedException { long now = System.currentTimeMillis(); long expiryTime = now + deploymentTimeout; while (pending.size() > 0 && now < expiryTime) { wait(expiryTime - now); now = System.currentTimeMillis(); } for (ContainerModuleKey key : pending) { results.put(key, new ModuleDeploymentStatus(key.container, Integer.valueOf(key.moduleSequence), key.moduleDescriptorKey, ModuleDeploymentStatus.State.failed, String.format("Deployment of module '%s' to container '%s' timed out after %d ms", key.moduleDescriptorKey, key.container, deploymentTimeout))); } return results.values(); }
Source:
<code>protected JsonNode createPostRequest(GHMRequest ghRequest, Collection<String> outArraysList) { ObjectNode requestJson = objectMapper.createObjectNode(); if (ghRequest.identicalLists) { putPoints(requestJson, "points", ghRequest.getFromPoints()); putStrings(requestJson, "point_hints", ghRequest.getFromPointHints()); putStrings(requestJson, "curbsides", ghRequest.getFromCurbsides()); } else { putPoints(requestJson, "from_points", ghRequest.getFromPoints()); putStrings(requestJson, "from_point_hints", ghRequest.getFromPointHints()); putPoints(requestJson, "to_points", ghRequest.getToPoints()); putStrings(requestJson, "to_point_hints", ghRequest.getToPointHints()); putStrings(requestJson, "from_curbsides", ghRequest.getFromCurbsides()); putStrings(requestJson, "to_curbsides", ghRequest.getToCurbsides()); } putStrings(requestJson, "snap_preventions", ghRequest.getSnapPreventions()); putStrings(requestJson, "out_arrays", outArraysList); requestJson.put("vehicle", ghRequest.getVehicle()); requestJson.put("fail_fast", ghRequest.getFailFast()); Map<String, Object> hintsMap = ghRequest.getHints().toMap(); for (String hintKey : hintsMap.keySet()) { if (ignoreSet.contains(hintKey)) continue; Object hint = hintsMap.get(hintKey); <START> requestJson.put(hintKey, hint.toString()); <END> } return requestJson; }</code><technical_language>do turn this a string here? object? cases want add actual object json tree instead of converting a string? Hm, this requires object-to-json serialization create a (sub)JsonNode</technical_language>

Target:
protected JsonNode createPostRequest(GHMRequest ghRequest, Collection<String> outArraysList) { ObjectNode requestJson = objectMapper.createObjectNode(); if (ghRequest.identicalLists) { putPoints(requestJson, "points", ghRequest.getFromPoints()); putStrings(requestJson, "point_hints", ghRequest.getFromPointHints()); putStrings(requestJson, "curbsides", ghRequest.getFromCurbsides()); } else { putPoints(requestJson, "from_points", ghRequest.getFromPoints()); putStrings(requestJson, "from_point_hints", ghRequest.getFromPointHints()); putPoints(requestJson, "to_points", ghRequest.getToPoints()); putStrings(requestJson, "to_point_hints", ghRequest.getToPointHints()); putStrings(requestJson, "from_curbsides", ghRequest.getFromCurbsides()); putStrings(requestJson, "to_curbsides", ghRequest.getToCurbsides()); } putStrings(requestJson, "snap_preventions", ghRequest.getSnapPreventions()); putStrings(requestJson, "out_arrays", outArraysList); requestJson.put("vehicle", ghRequest.getVehicle()); requestJson.put("fail_fast", ghRequest.getFailFast()); Map<String, Object> hintsMap = ghRequest.getHints().toMap(); for (String hintKey : hintsMap.keySet()) { if (ignoreSet.contains(hintKey)) continue; Object hint = hintsMap.get(hintKey); if (hint instanceof String) requestJson.put(hintKey, (String) hint); else requestJson.putPOJO(hintKey, hint); } return requestJson; }
Source:
<code><START> public PlacementResult(T result, boolean adhering) { <END> this.result = result; this.adhering = adhering; }</code><technical_language>making constructor private making class 'final' ? open extensions future if needed</technical_language>

Target:
private PlacementResult(T result, boolean adhering) { this.result = result; this.adhering = adhering; }
Source:
<code>public void sourceEntriesEndPointTestNonExistingWithNonExistingVariant() throws URISyntaxException { String url = "/v2/variants/100:0:C:T/sources?species=mmusculus&assembly=grcm38"; ResponseEntity<QueryResponse<QueryResult<VariantSourceEntryWithSampleNames>>> sources = restTemplate. exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<QueryResponse< QueryResult<VariantSourceEntryWithSampleNames>>>() { }); assertEquals(HttpStatus.NOT_FOUND, sources.getStatusCode()); <START> assertTrue(sources.getBody().getResponse().get(0).getResult().size() == 0); <END> }</code><technical_language>suggestion assertTrue(sources.getBody().getResponse().get(0).getResult().isEmpty());</technical_language>

Target:
public void sourceEntriesEndPointTestNonExistingWithNonExistingVariant() throws URISyntaxException { String url = "/v2/variants/100:0:C:T/sources?species=mmusculus&assembly=grcm38"; ResponseEntity<QueryResponse<QueryResult<VariantSourceEntryWithSampleNames>>> sources = restTemplate. exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<QueryResponse< QueryResult<VariantSourceEntryWithSampleNames>>>() { }); assertEquals(HttpStatus.NOT_FOUND, sources.getStatusCode()); assertTrue(sources.getBody().getResponse().get(0).getResult().isEmpty()); }
Source:
<code>public void purge(AutoGenerationOption delegate, RequestContext context) throws ResponseException { <START> throw new ResourceDoesNotSupportOperationException("Purging of AutoGenerationOption is not supported"); <END> }</code><technical_language>do support purging</technical_language>

Target:
public void purge(AutoGenerationOption delegate, RequestContext context) throws ResponseException { Context.getService(IdentifierSourceService.class).purgeAutoGenerationOption(delegate); }
Source:
<code>public void impl(@Nonnull CorfuRuntime runtime) throws OutrankedException, ExecutionException, InterruptedException { runtime.invalidateLayout(); newLayout = runtime.getLayoutView().getLayout(); if (newLayout.getAllActiveServers().contains(request.endpoint)) { for (int i = 0; i < newLayout.getSegments().size() - 1; i++) { <START> StateTransfer.transfer(newLayout, Collections.singleton(request.getEndpoint()), <END> runtime, newLayout.getSegments().get(i)); } final int stripeIndex = 0; runtime.getLayoutManagementView() .addLogUnitReplica( new Layout(newLayout), request.getEndpoint(), stripeIndex); runtime.invalidateLayout(); newLayout = runtime.getLayoutView().getLayout(); } else { throw new IllegalStateException("RestoreRedundancy: " + "Node to be added marked unresponsive."); } }</code><technical_language>please pass StateTransfer a dependency</technical_language>

Target:
public void impl(@Nonnull CorfuRuntime runtime) throws OutrankedException, ExecutionException, InterruptedException { runtime.invalidateLayout(); newLayout = runtime.getLayoutView().getLayout(); if (newLayout.getAllActiveServers().contains(request.endpoint)) { for (int i = 0; i < newLayout.getSegments().size() - 1; i++) { transfer(newLayout, Collections.singleton(request.getEndpoint()), runtime, newLayout.getSegments().get(i)); } final int stripeIndex = 0; runtime.getLayoutManagementView() .addLogUnitReplica( new Layout(newLayout), request.getEndpoint(), stripeIndex); runtime.invalidateLayout(); newLayout = runtime.getLayoutView().getLayout(); } else { throw new IllegalStateException("RestoreRedundancy: " + "Node to be added marked unresponsive."); } }
Source:
<code>private void makeRandomDefaultDir() { File f = new File(RedissonRuntimeEnvironment.tempDir + File.separator + UUID.randomUUID()); if (f.exists()) { makeRandomDefaultDir(); } else { System.out.println("REDIS RUNNER: Making directory " + f.getAbsolutePath()); f.mkdirs(); this.defaultDir = f.getAbsolutePath(); if (RedissonRuntimeEnvironment.isWindows) { <START> defaultDir = "\"" + defaultDir.replace("\\", "\\\\") + "\""; <END> } } }</code><technical_language>do need change it</technical_language>

Target:
private void makeRandomDefaultDir() { File f = new File(RedissonRuntimeEnvironment.tempDir + File.separator + UUID.randomUUID()); if (f.exists()) { makeRandomDefaultDir(); } else { System.out.println("REDIS RUNNER: Making directory " + f.getAbsolutePath()); f.mkdirs(); this.defaultDir = f.getAbsolutePath(); if (RedissonRuntimeEnvironment.isWindows) { defaultDir = defaultDir.replace("\\", "\\\\"); } } }
Source:
<code>public void updateInPerspective(@NotNull ActionEvent event) { <START> CurrentProject prj = appContext.getCurrentProject(); <END> event.getPresentation().setVisible(prj != null); event.getPresentation().setEnabled(prj != null && prj.getProjectDescription().getMixins().contains(OPENSHIFT_PROJECT_TYPE_ID)); }</code><technical_language>prj is a good name for variable</technical_language>

Target:
public void updateInPerspective(@NotNull ActionEvent event) { CurrentProject currentProject = appContext.getCurrentProject(); event.getPresentation().setVisible(currentProject != null); event.getPresentation().setEnabled(currentProject != null && currentProject.getProjectDescription().getMixins().contains(OPENSHIFT_PROJECT_TYPE_ID)); }
Source:
<code>@Test public void testTouchId() { try { driver.touchId(true); driver.touchId(false); assertEquals(true, true); } catch(Exception e){ <START> assertEquals(true, false); <END> } }</code><technical_language>@dpgraham I is more senseful throw exception. Otherwice a risk produce invalid build react server changes</technical_language>

Target:
@Test public void testTouchId() { try { driver.performTouchID(true); driver.performTouchID(false); assertEquals(true, true); } catch (Exception e) { throw e; } }
Source:
<code>public static MetadataManager createTestMetadataManager(CatalogManager catalogManager, FeaturesConfig featuresConfig) { TypeManager typeManager = new TypeRegistry(ImmutableSet.of(), featuresConfig); return new MetadataManager( featuresConfig, typeManager, new BlockEncodingManager(typeManager), new SessionPropertyManager(), new SchemaPropertyManager(), new TablePropertyManager(), new ColumnPropertyManager(), <START> InMemoryTransactionManager.createTestTransactionManager(catalogManager)); <END> }</code><technical_language>this static imported</technical_language>

Target:
public static MetadataManager createTestMetadataManager(CatalogManager catalogManager, FeaturesConfig featuresConfig) { TypeManager typeManager = new TypeRegistry(ImmutableSet.of(), featuresConfig); return new MetadataManager( featuresConfig, typeManager, new BlockEncodingManager(typeManager), new SessionPropertyManager(), new SchemaPropertyManager(), new TablePropertyManager(), new ColumnPropertyManager(), createTestTransactionManager(catalogManager)); }
Source:
<code>public String checkOptionalAuth(@Auth Optional<Principal> principalOpt) { <START> return "principal was " + ((principalOpt.isPresent()) ? "" : "not ") + "present"; <END> }</code><technical_language>I guess omit parentheses principalOpt.isPresent</technical_language>

Target:
public String checkOptionalAuth(@Auth Optional<Principal> principalOpt) { return "principal was " + (principalOpt.isPresent() ? "" : "not ") + "present"; }
Source:
<code>private TextAnalyticsPagedResponse<AnalyzeSentimentResult> toTextAnalyticsPagedResponse( SimpleResponse<SentimentResponse> response) { final SentimentResponse sentimentResponse = response.getValue(); final List<AnalyzeSentimentResult> analyzeSentimentResults = new ArrayList<>(); for (DocumentSentiment documentSentiment : sentimentResponse.getDocuments()) { analyzeSentimentResults.add(convertToAnalyzeSentimentResult(documentSentiment)); } for (DocumentError documentError : sentimentResponse.getErrors()) { <START> analyzeSentimentResults.add(new AnalyzeSentimentResultImpl(documentError.getId(), null, <END> toTextAnalyticsError(documentError.getError()), null)); } return new TextAnalyticsPagedResponse<>( response.getRequest(), response.getStatusCode(), response.getHeaders(), analyzeSentimentResults, null, sentimentResponse.getModelVersion(), sentimentResponse.getStatistics() == null ? null : toBatchStatistics(sentimentResponse.getStatistics())); }</code><technical_language>sure, I AnalyzeSentimentResultImpl a generated class implementation.models package</technical_language>

Target:
private TextAnalyticsPagedResponse<AnalyzeSentimentResult> toTextAnalyticsPagedResponse( SimpleResponse<SentimentResponse> response) { final SentimentResponse sentimentResponse = response.getValue(); final List<AnalyzeSentimentResult> analyzeSentimentResults = new ArrayList<>(); for (DocumentSentiment documentSentiment : sentimentResponse.getDocuments()) { analyzeSentimentResults.add(convertToAnalyzeSentimentResult(documentSentiment)); } for (DocumentError documentError : sentimentResponse.getErrors()) { if (documentError.getId().isEmpty()) { throw logger.logExceptionAsError( new HttpResponseException(documentError.getError().getInnererror().getMessage(), getEmptyErrorIdHttpResponse(response), documentError.getError().getInnererror().getCode())); } analyzeSentimentResults.add(new AnalyzeSentimentResult(documentError.getId(), null, toTextAnalyticsError(documentError.getError()), null)); } return new TextAnalyticsPagedResponse<>( response.getRequest(), response.getStatusCode(), response.getHeaders(), analyzeSentimentResults, null, sentimentResponse.getModelVersion(), sentimentResponse.getStatistics() == null ? null : toBatchStatistics(sentimentResponse.getStatistics())); }
Source:
<code>static Long selectNextRetryTime(final Long ttlInSeconds) { final long aDay = 60 * 60 * 24L; <START> final long min = Math.min(ttlInSeconds / 2, aDay); <END> final long aSecond = 1L; return Math.max(min, aSecond); }</code><technical_language>call minimum avoid confusion minutes</technical_language>

Target:
static Long selectNextRetryTime(final Long ttlInSeconds) { final long aDay = 60 * 60 * 24L; final long minimum = Math.min(ttlInSeconds / 2, aDay); final long aSecond = 1L; return Math.max(minimum, aSecond); }
Source:
<code><START> protected void updateDiskSizeByQcowImageInfo(DiskImage diskImage, Guid storageId) { <END> if (storageId != null) { super.updateDiskSizeByQcowImageInfo(diskImage, storageId); return; } List<DiskImage> diskVolumes = diskImageDao.getAllSnapshotsForImageGroup(diskImage.getId()); Iterator<DiskImage> diskVolumesIterator = diskVolumes.iterator(); if (!diskVolumesIterator.hasNext()) { log.warn("found a disk with no volume {}, skipping", diskImage.getId()); return; } DiskImage diskImageFromDatabase = diskVolumesIterator.next(); Iterator<Guid> storageIdsIterator = diskImageFromDatabase.getStorageIds().iterator(); if (!storageIdsIterator.hasNext()) { log.warn("found an image with no storage domain {}, skipping", diskImageFromDatabase.getImageId()); return; } super.updateDiskSizeByQcowImageInfo(diskImage, storageIdsIterator.next()); }</code><technical_language>good. fine silently skip 'invalid' images execute phase for now? want in validation, is crucial in this flow</technical_language>

Target:
protected void updateDiskSizeByQcowImageInfo(DiskImage diskImage, Guid storageId) { if (!Guid.isNullOrEmpty(storageId)) { super.updateDiskSizeByQcowImageInfo(diskImage, storageId); return; } List<DiskImage> diskVolumes = diskImageDao.getAllSnapshotsForImageGroup(diskImage.getId()); Iterator<DiskImage> diskVolumesIterator = diskVolumes.iterator(); if (!diskVolumesIterator.hasNext()) { log.warn("found a disk with no volume {}, skipping", diskImage.getId()); return; } DiskImage diskImageFromDatabase = diskVolumesIterator.next(); Iterator<Guid> storageIdsIterator = diskImageFromDatabase.getStorageIds().iterator(); if (!storageIdsIterator.hasNext()) { log.warn("found an image with no storage domain {}, skipping", diskImageFromDatabase.getImageId()); return; } super.updateDiskSizeByQcowImageInfo(diskImage, storageIdsIterator.next()); }
Source:
<code>public static String argsToList(final List<Arguments> arguments) { final StringBuilder stringBuilder = new StringBuilder(); <START> for (int i = 0; i < arguments.size(); i++) { <END> stringBuilder.append(uncapFirst(arguments.get(i).getName())); if (i < arguments.size() - 1) { stringBuilder.append(", "); } } return stringBuilder.toString(); }</code><technical_language>String.join method introduced in java 8 do this</technical_language>

Target:
public static String argsToList(final List<Arguments> arguments) { return arguments.stream().map(i -> uncapFirst(i.getName())).collect(Collectors.joining(", ")); }
Source:
<code>public void manageTopology() throws TopologyRuntimeManagementException, TMasterException, PackingException { String topologyName = Context.topologyName(config); String statemgrClass = Context.stateManagerClass(config); IStateManager statemgr; try { statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new TopologyRuntimeManagementException(String.format( "Failed to instantiate state manager class '%s'", statemgrClass), e); } try { statemgr.initialize(config); SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000); <START> boolean foundData = validateRuntimeManage(adaptor, topologyName); <END> LOG.log(Level.FINE, "Topology: {0} to be {1}ed", new Object[]{topologyName, command}); Config runtime = Config.newBuilder() .put(Key.TOPOLOGY_NAME, Context.topologyName(config)) .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor) .build(); ISchedulerClient schedulerClient = getSchedulerClient(runtime); callRuntimeManagerRunner(runtime, schedulerClient, foundData); } finally { SysUtils.closeIgnoringExceptions(statemgr); } }</code><technical_language>foundData - sound a good name. other choices</technical_language>

Target:
public void manageTopology() throws TopologyRuntimeManagementException, TMasterException, PackingException { String topologyName = Context.topologyName(config); String statemgrClass = Context.stateManagerClass(config); IStateManager statemgr; try { statemgr = ReflectionUtils.newInstance(statemgrClass); } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new TopologyRuntimeManagementException(String.format( "Failed to instantiate state manager class '%s'", statemgrClass), e); } try { statemgr.initialize(config); SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000); boolean hasExecutionData = validateRuntimeManage(adaptor, topologyName); LOG.log(Level.FINE, "Topology: {0} to be {1}ed", new Object[]{topologyName, command}); Config runtime = Config.newBuilder() .put(Key.TOPOLOGY_NAME, Context.topologyName(config)) .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor) .build(); ISchedulerClient schedulerClient = getSchedulerClient(runtime); callRuntimeManagerRunner(runtime, schedulerClient, !hasExecutionData); } finally { SysUtils.closeIgnoringExceptions(statemgr); } }
Source:
<code>public void synchronizeQueueWithPrimaryInvokedAfterProcessEachRegionQueue() { addToMessagesList(); <START> Iterator iterator = messagesList.iterator(); <END> InternalDistributedMember sender = mock(InternalDistributedMember.class); doReturn(sender).when(queueRemovalMessage).getSender(); queueRemovalMessage.processRegionQueues(cache, iterator); verify(queueRemovalMessage).processRegionQueue(iterator, regionName1, region1EventSize, regionQueue1); verify(regionQueue1).synchronizeQueueWithPrimary(sender, cache); verify(queueRemovalMessage).processRegionQueue(iterator, regionName2, region2EventSize, regionQueue2); verify(regionQueue2).synchronizeQueueWithPrimary(sender, cache); verify(queueRemovalMessage).removeQueueEvent(regionName1, regionQueue1, eventID1); verify(queueRemovalMessage).removeQueueEvent(regionName2, regionQueue2, eventID2); verify(queueRemovalMessage).removeQueueEvent(regionName2, regionQueue2, eventID3); }</code><technical_language>IDE warning for raw of parameterized class removed Iterator<Object> here</technical_language>

Target:
public void synchronizeQueueWithPrimaryInvokedAfterProcessEachRegionQueue() { addToMessagesList(); Iterator<Object> iterator = messagesList.iterator(); InternalDistributedMember sender = mock(InternalDistributedMember.class); doReturn(sender).when(queueRemovalMessage).getSender(); queueRemovalMessage.processRegionQueues(cache, iterator); verify(queueRemovalMessage).processRegionQueue(iterator, regionName1, region1EventSize, regionQueue1); verify(regionQueue1).synchronizeQueueWithPrimary(sender, cache); verify(queueRemovalMessage).processRegionQueue(iterator, regionName2, region2EventSize, regionQueue2); verify(regionQueue2).synchronizeQueueWithPrimary(sender, cache); verify(queueRemovalMessage).removeQueueEvent(regionName1, regionQueue1, eventID1); verify(queueRemovalMessage).removeQueueEvent(regionName2, regionQueue2, eventID2); verify(queueRemovalMessage).removeQueueEvent(regionName2, regionQueue2, eventID3); }
Source:
<code>@Override public JsonWriter endObject() throws IOException { <START> promoteValueToNameFailureToken = null; <END> return close(EMPTY_OBJECT, NONEMPTY_OBJECT, "}"); }</code><technical_language>Is this a boolean</technical_language>

Target:
@Override public JsonWriter endObject() throws IOException { promoteValueToName = false; return close(EMPTY_OBJECT, NONEMPTY_OBJECT, "}"); }
Source:
<code>private void writeVmMetadata() { writer.setPrefix(OVIRT_VM_PREFIX, OVIRT_VM_URI); writer.writeStartElement(OVIRT_VM_URI, "vm"); writer.writeNamespace(OVIRT_VM_PREFIX, OVIRT_VM_URI); if (volatileRun) { writer.writeStartElement(OVIRT_VM_URI, "destroy_on_reboot"); writer.writeAttributeString("type", "bool"); writer.writeRaw("True"); writer.writeEndElement(); <START> } <END> writer.writeEndElement(); }</code><technical_language>VDSM's settings equivalent set "<on_reboot>destroy</on_reboot>" in domain xml</technical_language>

Target:
private void writeVmMetadata() { writer.setPrefix(OVIRT_VM_PREFIX, OVIRT_VM_URI); writer.writeStartElement(OVIRT_VM_URI, "vm"); writer.writeNamespace(OVIRT_VM_PREFIX, OVIRT_VM_URI); writer.writeEndElement(); }
Source:
<code>protected final void startZoomThread(long startTime, long endTime) { try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:ZoomThreadCreated").setCategory(getViewId()).build()) { long clampedStartTime = (fStartTime == Long.MAX_VALUE ? startTime : Math.min(Math.max(startTime, fStartTime), fEndTime)); long clampedEndTime = (fEndTime == Long.MIN_VALUE ? endTime : Math.max(Math.min(endTime, fEndTime), fStartTime)); fDirty.incrementAndGet(); boolean restart = false; if (fZoomThread != null) { fZoomThread.cancel(); if (fZoomThread.fZoomStartTime == clampedStartTime && fZoomThread.fZoomEndTime == clampedEndTime) { restart = true; } } long resolution = Math.max(1, (clampedEndTime - clampedStartTime) / fDisplayWidth); <START> fZoomThread = createZoomThread(clampedStartTime, clampedEndTime, resolution, restart, log.getId()); <END> if (fZoomThread != null) { synchronized (fZoomThreadResultLock) { fZoomThread.start(); } } else { fDirty.decrementAndGet(); } } }</code><technical_language>is do: fZoomThread.setScopeId(log.getId());</technical_language>

Target:
protected final void startZoomThread(long startTime, long endTime) { try (FlowScopeLog log = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:ZoomThreadCreated").setCategory(getViewId()).build()) { long clampedStartTime = (fStartTime == Long.MAX_VALUE ? startTime : Math.min(Math.max(startTime, fStartTime), fEndTime)); long clampedEndTime = (fEndTime == Long.MIN_VALUE ? endTime : Math.max(Math.min(endTime, fEndTime), fStartTime)); fDirty.incrementAndGet(); boolean restart = false; ZoomThread zoomThread = fZoomThread; if (zoomThread != null) { zoomThread.cancel(); if (zoomThread.fZoomStartTime == clampedStartTime && zoomThread.fZoomEndTime == clampedEndTime) { restart = true; } } long resolution = Math.max(1, (clampedEndTime - clampedStartTime) / fDisplayWidth); zoomThread = createZoomThread(clampedStartTime, clampedEndTime, resolution, restart); fZoomThread = zoomThread; if (zoomThread != null) { zoomThread.setScopeId(log.getId()); synchronized (fZoomThreadResultLock) { zoomThread.start(); } } else { fDirty.decrementAndGet(); } } }
Source:
<code>public Object clone() throws CloneNotSupportedException { HashPartition hash = (HashPartition) super.clone(); if (columns != null) { hash.columns = new ColumnReferenceExpr[columns.length]; for (int i = 0; i < columns.length; i++) { hash.columns[i] = (ColumnReferenceExpr) columns[i].clone(); } } hash.quantity = quantity; if (specifiers != null) { hash.specifiers = new ArrayList<>(); <START> hash.specifiers.addAll(specifiers.stream().collect(Collectors.toList())); <END> } return hash; }</code><technical_language>in a case this, I sufficient more clear. java hash.specifiers.addAll(specifiers); more simply, java hash.specifiers = new ArrayList<>(specifiers); Anyway, I stream matter. is simple shallow copy, ways</technical_language>

Target:
public Object clone() throws CloneNotSupportedException { HashPartition hash = (HashPartition) super.clone(); if (columns != null) { hash.columns = new ColumnReferenceExpr[columns.length]; for (int i = 0; i < columns.length; i++) { hash.columns[i] = (ColumnReferenceExpr) columns[i].clone(); } } hash.quantity = quantity; if (specifiers != null) { hash.specifiers = new ArrayList<>(specifiers); } return hash; }
Source:
<code>public void testProject() { PlanNode project = project("project", tableScan("ts", "orderkey"), "string", new Cast(new SymbolReference("orderkey"), "STRING")); Map<String, PlanNodeCostEstimate> costs = ImmutableMap.of("ts", cpuCost(1000)); Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of("project", statsEstimate(4000), "ts", statsEstimate(1000)); assertCost( project, costs, stats) .cpu(1000 + 4000) .memory(0) .network(0); assertCostEstimatedExchanges( project, costs, stats) <START> .cpu(1000 + 4000) <END> .memory(0) .network(0); assertCostHasUnknownComponentsForUnknownStats(project); }</code><technical_language>memory network costs</technical_language>

Target:
public void testProject() { TableScanNode tableScan = tableScan("ts", "orderkey"); PlanNode project = project("project", tableScan, "string", new Cast(new SymbolReference("orderkey"), "STRING")); Map<String, PlanNodeCostEstimate> costs = ImmutableMap.of("ts", cpuCost(1000)); Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of( "project", statsEstimate(project, 4000), "ts", statsEstimate(tableScan, 1000)); assertCost(project, costs, stats) .cpu(1000 + 4000) .memory(0) .network(0); assertCostEstimatedExchanges(project, costs, stats) .cpu(1000 + 4000) .memory(0) .network(0); assertCostHasUnknownComponentsForUnknownStats(project); }
Source:
<code>public void testGetIntermediateStreamProperties() { Map<String, String> config = new HashMap<>(); KafkaSystemFactory factory = new KafkaSystemFactory(); Map<String, Properties> properties = JavaConversions.mapAsJavaMap( factory.getIntermediateStreamProperties(new MapConfig(config))); assertTrue(properties.isEmpty()); config.put("streams.test.samza.intermediate", "true"); config.put("streams.test.compression.type", "lz4"); config.put(ApplicationConfig.APP_MODE, ApplicationConfig.ApplicationMode.BATCH.name()); <START> <END> KafkaSystemAdmin admin = createSystemAdmin(SYSTEM(), config); StreamSpec spec = new StreamSpec("test", "test", SYSTEM(), config); KafkaStreamSpec kspec = admin.toKafkaSpec(spec); Properties prop = kspec.getProperties(); assertEquals(prop.getProperty("retention.ms"), String.valueOf(KafkaConfig.DEFAULT_RETENTION_MS_FOR_BATCH())); assertEquals(prop.getProperty("compression.type"), "lz4"); }</code><technical_language>I lines able stay here, filtered out kafkaStreamSpec</technical_language>

Target:
public void testGetIntermediateStreamProperties() { Map<String, String> config = new HashMap<>(); KafkaSystemFactory factory = new KafkaSystemFactory(); Map<String, Properties> properties = JavaConversions.mapAsJavaMap( factory.getIntermediateStreamProperties(new MapConfig(config))); assertTrue(properties.isEmpty()); config.put("streams.test.samza.intermediate", "true"); config.put("streams.test.compression.type", "lz4"); properties = JavaConversions.mapAsJavaMap( factory.getIntermediateStreamProperties(new MapConfig(config))); assertTrue(properties.isEmpty()); config.put(ApplicationConfig.APP_MODE, ApplicationConfig.ApplicationMode.BATCH.name()); KafkaSystemAdmin admin = createSystemAdmin(SYSTEM(), config); StreamSpec spec = new StreamSpec("test", "test", SYSTEM(), Collections.singletonMap("replication.factor", "1")); KafkaStreamSpec kspec = admin.toKafkaSpec(spec); Properties prop = kspec.getProperties(); assertEquals(prop.getProperty("retention.ms"), String.valueOf(KafkaConfig.DEFAULT_RETENTION_MS_FOR_BATCH())); assertEquals(prop.getProperty("compression.type"), "lz4"); assertEquals(kspec.getReplicationFactor(), 1); assertNull(prop.getProperty("replication.factor")); }
Source:
<code>public boolean aggregate(KeyType key, int keyHash) { final ByteBuffer keyBuffer = keySerde.toByteBuffer(key); if (keyBuffer == null) { return false; } if (keyBuffer.remaining() != keySize) { throw new IAE( "keySerde.toByteBuffer(key).remaining[%s] != keySerde.keySize[%s], buffer was the wrong size?!", keyBuffer.remaining(), keySize ); } int bucket = hashTable.findBucketWithAutoGrowth(keyBuffer, keyHash); if (bucket < 0) { return false; } final int bucketStartOffset = hashTable.getOffsetForBucket(bucket); final boolean bucketWasUsed = hashTable.isBucketUsed(bucket); final ByteBuffer tableBuffer = hashTable.getTableBuffer(); if (!bucketWasUsed) { hashTable.initializeNewBucketKey(bucket, keyBuffer, keyHash); for (int i = 0; i < aggregators.length; i++) { aggregators[i].init(tableBuffer, bucketStartOffset + aggregatorOffsets[i]); } <START> <END> newBucketHook(bucketStartOffset); } if (canSkipAggregate(bucketWasUsed, bucketStartOffset)) { return true; } for (int i = 0; i < aggregators.length; i++) { aggregators[i].aggregate(tableBuffer, bucketStartOffset + aggregatorOffsets[i]); } afterAggregateHook(bucketStartOffset); return true; }</code><technical_language>nit: interesting encapsulate placing key a method hashTable aggregates updated directly. approach for both</technical_language>

Target:
public AggregateResult aggregate(KeyType key, int keyHash) { final ByteBuffer keyBuffer = keySerde.toByteBuffer(key); if (keyBuffer == null) { return DICTIONARY_FULL; } if (keyBuffer.remaining() != keySize) { throw new IAE( "keySerde.toByteBuffer(key).remaining[%s] != keySerde.keySize[%s], buffer was the wrong size?!", keyBuffer.remaining(), keySize ); } int bucket = hashTable.findBucketWithAutoGrowth(keyBuffer, keyHash); if (bucket < 0) { return HASHTABLE_FULL; } final int bucketStartOffset = hashTable.getOffsetForBucket(bucket); final boolean bucketWasUsed = hashTable.isBucketUsed(bucket); final ByteBuffer tableBuffer = hashTable.getTableBuffer(); if (!bucketWasUsed) { hashTable.initializeNewBucketKey(bucket, keyBuffer, keyHash); for (int i = 0; i < aggregators.length; i++) { aggregators[i].init(tableBuffer, bucketStartOffset + aggregatorOffsets[i]); } newBucketHook(bucketStartOffset); } if (canSkipAggregate(bucketWasUsed, bucketStartOffset)) { return AggregateResult.ok(); } for (int i = 0; i < aggregators.length; i++) { aggregators[i].aggregate(tableBuffer, bucketStartOffset + aggregatorOffsets[i]); } afterAggregateHook(bucketStartOffset); return AggregateResult.ok(); }
Source:
<code>public IAdaptable createElement(IMemento memento) { long branchUuid = 0; if (Strings.isValid(memento.getString(BRANCH_KEY))) { branchUuid = Long.valueOf(memento.getString(BRANCH_KEY)); <START> } <END> Long artUuid = Long.parseLong(memento.getString(ART_KEY_AS_LONG)); String title = memento.getString(TITLE); return new SMAEditorInput(branchUuid, artUuid == null ? 0 : artUuid, title); }</code><technical_language>want check if string is valid converting Long. Also, if this key/value valid, check ART_KEY/value for compatibility</technical_language>

Target:
public IAdaptable createElement(IMemento memento) { long branchUuid = 0; if (Strings.isValid(memento.getString(BRANCH_KEY))) { branchUuid = Long.valueOf(memento.getString(BRANCH_KEY)); } String artKeyAsLong = memento.getString(ART_KEY_AS_LONG); if (Strings.isValid(artKeyAsLong)) { Long artUuid = Long.parseLong(artKeyAsLong); String title = memento.getString(TITLE); return new SMAEditorInput(branchUuid, artUuid == null ? 0 : artUuid, title); } else { throw new OseeCoreException("Did not get valid ART KEY from memento"); } }
Source:
<code>protected void checkWithFailDropStrategy(CoreEvent event) throws FlowBackPressureException { if (!abstractPipeline.getProcessingStrategy().checkBackpressureEmitting(event)) { FlowBackPressureException exception = new FlowBackPressureException(abstractPipeline.getName()); <START> throw exception; <END> } }</code><technical_language>inline</technical_language>

Target:
protected void checkWithFailDropStrategy(CoreEvent event) throws FlowBackPressureException { if (!abstractPipeline.getProcessingStrategy().checkBackpressureEmitting(event)) { throw new FlowBackPressureException(abstractPipeline.getName()); } }
Source:
<code>private void addILeappReportToReports(Path iLeappOutputDir, Case currentCase) { List<String> allIndexFiles = new ArrayList<>(); try (Stream<Path> walk = Files.walk(iLeappOutputDir)) { allIndexFiles = walk.map(x -> x.toString()) .filter(f -> f.toLowerCase().endsWith("index.html")).collect(Collectors.toList()); <START> if (allIndexFiles.get(0).length() > 2) { <END> currentCase.addReport(allIndexFiles.get(0), MODULE_NAME, Bundle.ILeappAnalyzerIngestModule_report_name()); } } catch (IOException | TskCoreException ex) { logger.log(Level.WARNING, String.format("Error finding index file in path %s", iLeappOutputDir.toString()), ex); } }</code><technical_language>condition check empty</technical_language>

Target:
private void addILeappReportToReports(Path iLeappOutputDir, Case currentCase) { List<String> allIndexFiles = new ArrayList<>(); try (Stream<Path> walk = Files.walk(iLeappOutputDir)) { allIndexFiles = walk.map(x -> x.toString()) .filter(f -> f.toLowerCase().endsWith("index.html")).collect(Collectors.toList()); if (!allIndexFiles.isEmpty()) { currentCase.addReport(allIndexFiles.get(0), MODULE_NAME, Bundle.ILeappAnalyzerIngestModule_report_name()); } } catch (IOException | UncheckedIOException | TskCoreException ex) { logger.log(Level.WARNING, String.format("Error finding index file in path %s", iLeappOutputDir.toString()), ex); } }
Source:
<code>public PregelConfiguration build() { <START> return new PregelConfiguration(this); <END> }</code><technical_language>Passing ingredient a builder. need get methods in Builder class</technical_language>

Target:
public PregelConfiguration build() { return new PregelConfiguration(computationClass, vertexCodecClass, dataParserClass, messageCodecClass, userParamList); }