auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private void fillLicenseList(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { <END> List<LicenseNameWithText> lts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); XWPFRun licenseHeaderRun = document.createParagraph().createRun(); addFormattedText(licenseHeaderRun, "License texts", FONT_SIZE + 2, true); addNewLines(document.createParagraph().createRun(), 0); lts.forEach(lt -> { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle(STYLE_HEADING); String licenseName = lt.isSetLicenseName() ? lt.getLicenseName() : UNKNOWN_LICENSE_NAME; addBookmark(licenseParagraph, licenseName, licenseName); setText(document.createParagraph().createRun(), nullToEmptyString(lt.getLicenseText())); addNewLines(document.createParagraph().createRun(), 1); }); }</code><technical_language>instead of one</technical_language>

Target:
private void fillLicenseList(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> licenseNameWithTexts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); XWPFRun licenseHeaderRun = document.createParagraph().createRun(); addFormattedText(licenseHeaderRun, "License texts", FONT_SIZE + 2, true); addNewLines(document, 0); for (LicenseNameWithText licenseNameWithText : licenseNameWithTexts) { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle(STYLE_HEADING); String licenseName = licenseNameWithText.isSetLicenseName() ? licenseNameWithText.getLicenseName() : UNKNOWN_LICENSE_NAME; addBookmark(licenseParagraph, licenseName, licenseName); setText(document.createParagraph().createRun(), nullToEmptyString(licenseNameWithText.getLicenseText())); addNewLines(document, 1); } }
Source:
<code>private static String readUmask() { Process p; try { <START> p = Runtime.getRuntime().exec( <END> new String[] { "sh", "-c", "umask" }, null, null); try (BufferedReader lineRead = new BufferedReader( new InputStreamReader(p.getInputStream(), Charset .defaultCharset().name()))) { p.waitFor(); return lineRead.readLine(); } } catch (Exception e) { return null; } }</code><technical_language>FS_POSIX.runInShell() instead</technical_language>

Target:
private static String readUmask() { return FS.readPipe(null, new String[] { "sh", "-c", "umask" }, System.getProperty("file.encoding")); }
Source:
<code>public void createOrUpdateNonRDFResource(final String path, final InputStream content, final String contentType) { <START> LOGGER.info("createOrUpdateNonRDFResource: " + path + ", " + contentType); <END> final String ocflObject = objFromPath(path); final String ocflFilename = filenameFromPath(path); final File stagingObj = new File(stagingRoot, ocflObject); if (!stagingObj.exists() && !stagingObj.mkdirs()) { throw new RuntimeException("Unable to create staging object: " + stagingObj); } final File stagingFile = new File(stagingObj, ocflFilename); try { if (!stagingFile.createNewFile()) { LOGGER.debug("File already exists, {}", stagingFile); } } catch (IOException e) { throw new RuntimeException(e); } try { final FileOutputStream outputStream = new FileOutputStream(stagingFile, false); try { IOUtils.copy(content, outputStream); } catch (IOException e) { throw new RuntimeException(e); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }</code><technical_language>Minor... change this to: LOGGER.debug("createOrUpdateNonRDFResource: {}, {}", path, contentType);</technical_language>

Target:
public void createOrUpdateNonRDFResource(final String path, final InputStream content, final String contentType) { LOGGER.debug("createOrUpdateNonRDFResource: {}, {}", path, contentType); final String ocflObject = objFromPath(path); final String ocflFilename = filenameFromPath(path); final File stagingObj = new File(stagingRoot, ocflObject); if (!stagingObj.exists() && !stagingObj.mkdirs()) { throw new RuntimeException("Unable to create staging object: " + stagingObj); } final File stagingFile = new File(stagingObj, ocflFilename); try { if (!stagingFile.createNewFile()) { LOGGER.debug("File already exists, {}", stagingFile); } } catch (IOException e) { throw new RuntimeException(e); } try { final FileOutputStream outputStream = new FileOutputStream(stagingFile, false); try { IOUtils.copy(content, outputStream); } catch (IOException e) { throw new RuntimeException(e); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
Source:
<code>public JsonNode get(String name) { <START> return JsonNodeUtils.fromGsonElement(jsonObject.get(name)); <END> }</code><technical_language>jsonObject.get(name) return null if element [not exist ](<LINK_0>, want ensure causing NPE in JsonNodeUtils</technical_language>

Target:
public JsonNode get(String name) { JsonElement jsonElement = jsonObject.get(name); return (jsonElement == null) ? null : JsonNodeUtils.fromGsonElement(jsonElement); }
Source:
<code>public InstallerImpl(String id, String name, String version, String description, List<String> dependencies, Map<String, String> properties, String script, Map<String, ? extends ServerConfig> servers) { <START> Version.validate(version); <END> this.id = id; this.name = name; this.version = version; this.description = description; this.dependencies = dependencies; this.properties = properties; this.script = script; if (servers != null) { this.servers = servers.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> new InstallerServerConfigImpl(e.getValue()))); } }</code><technical_language>is OK do validation here. do InstallerRegistry, InstallerService workspace api workspace validation? WorkspaceValidator</technical_language>

Target:
public InstallerImpl( String id, String name, String version, String description, List<String> dependencies, Map<String, String> properties, String script, Map<String, ? extends ServerConfig> servers) { this.id = id; this.name = name; this.version = version; this.description = description; this.dependencies = dependencies; this.properties = properties; this.script = script; if (servers != null) { this.servers = servers .entrySet() .stream() .collect( Collectors.toMap( Map.Entry::getKey, e -> new InstallerServerConfigImpl(e.getValue()))); } }
Source:
<code>public static int trimTrailingWhitespace(byte[] raw, int start, int end) { <START> while (end > start && isWhitespace(raw[end - 1])) <END> end--; return end; }</code><technical_language>a hard time groking end > start. typical pattern is start < end, easier visualize. I drop out a subtraction instruction loop if a bit smarter handle bounds: int ptr = end - 1; while (start <= ptr && isWhitespace(raw[ptr])) ptr--; return ptr + 1;</technical_language>

Target:
public static int trimTrailingWhitespace(byte[] raw, int start, int end) { int ptr = end - 1; while (start <= ptr && isWhitespace(raw[ptr])) ptr--; return ptr + 1; }
Source:
<code>public double overlapPercentWith(StatisticRange other) { if (this.equals(other)) { return 1.0; } if (isEmpty() || other.isEmpty()) { return 0.0; } double lengthOfIntersect = min(high, other.high) - max(low, other.low); if (isInfinite(lengthOfIntersect)) { if (isFinite(this.distinctValues) && isFinite(other.distinctValues)) { return min(other.distinctValues / this.distinctValues, 1); } return INFINITE_TO_INFINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect == 0) { return 1 / max(distinctValues, 1); } if (lengthOfIntersect < 0) { return 0; <START> } <END> if (isInfinite(length()) && isFinite(lengthOfIntersect)) { return INFINITE_TO_FINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect > 0) { return lengthOfIntersect / length(); } return NaN; }</code><technical_language>nit: get rid of this prefix here, add other times fields referenced</technical_language>

Target:
public double overlapPercentWith(StatisticRange other) { requireNonNull(other, "other is null"); if (this.equals(other)) { return 1.0; } if (this.isEmpty() || other.isEmpty()) { return 0.0; } double lengthOfIntersect = min(this.high, other.high) - max(this.low, other.low); if (isInfinite(lengthOfIntersect)) { if (isFinite(this.distinctValues) && isFinite(other.distinctValues)) { return min(other.distinctValues / this.distinctValues, 1); } return INFINITE_TO_INFINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect == 0) { return 1 / max(this.distinctValues, 1); } if (lengthOfIntersect < 0) { return 0; } if (isInfinite(length()) && isFinite(lengthOfIntersect)) { return INFINITE_TO_FINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect > 0) { return lengthOfIntersect / length(); } return NaN; }
Source:
<code>public void setDisabledRules(Set<String> disabledRuleNames) { ctx.rulesFilter(rulesSet -> { List<RelOptRule> newSet = new ArrayList<>(); for (RelOptRule r : rulesSet) { <START> if (!disabledRuleNames.contains(r.toString())) <END> newSet.add(r); } return RuleSets.ofList(newSet); }); }</code><technical_language>rule name more clear ? i.e. \w+ only? possibly case insensitive too</technical_language>

Target:
public void setDisabledRules(Set<String> disabledRuleNames) { ctx.rulesFilter(rulesSet -> { List<RelOptRule> newSet = new ArrayList<>(); for (RelOptRule r : rulesSet) { if (!disabledRuleNames.contains(shortRuleName(r.toString()))) newSet.add(r); } return RuleSets.ofList(newSet); }); }
Source:
<code>public void setTopics(List<String> topics) throws IOException { <START> Requester requester = root.retrieve().method("POST"); <END> requester.with("names", topics); requester.method("PUT").withPreview(MERCY).withUrlPath(getApiTailUrl("topics")).to(); }</code><technical_language>redundant method("POST")</technical_language>

Target:
public void setTopics(List<String> topics) throws IOException { root.createRequest() .method("PUT") .with("names", topics) .withPreview(MERCY) .withUrlPath(getApiTailUrl("topics")) .send(); }
Source:
<code>public static short zCrystalMove(short item) { <START> if (item < 3000 || item > 3028) { <END> return 0; } return zMoves[item - 3000]; }</code><technical_language>change item > 3028 item > 4000 change code new Z-Crystals added (the Windows Client same)</technical_language>

Target:
public static short zCrystalMove(short item) { if (item < 3000 || item >= 4000) { return 0; } return zMoves[item - 3000]; }
Source:
<code>public void allBindingsChanged(BindingProvider provider) { <START> logger.debug("Plex all bindings changed"); <END> if (provider instanceof PlexBindingProvider) { PlexBindingProvider plexProvider = (PlexBindingProvider) provider; setInitialState(plexProvider); } }</code><technical_language>please decrease TRACE</technical_language>

Target:
public void allBindingsChanged(BindingProvider provider) { logger.trace("Plex all bindings changed"); if (provider instanceof PlexBindingProvider) { PlexBindingProvider plexProvider = (PlexBindingProvider) provider; setInitialState(plexProvider); } }
Source:
<code>public boolean isExternalVm() { <START> return VmActionByVmOriginValidator.isExternalVm(getOrigin()); <END> }</code><technical_language>I do is part of responsibility of validator - is benefit of moving check validator</technical_language>

Target:
public boolean isExternalVm() { return OriginType.EXTERNAL.equals(getOrigin()); }
Source:
<code>void expireLocks() { try { int c = autoCommit((handle, dao) -> { if (isEmbededDatabase()) { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < :expireTime" ) .bind("expireTime", Instant.now().getEpochSecond()) .execute(); } else { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < " + statementUnixTimestampSql() ) .execute(); } }); if (c > 0) { logger.warn("{} task locks are expired. Tasks will be retried.", c); } } catch (Throwable t) { logger.error("An uncaught exception is ignored. This lock expiration thread will be restarted.", t); errorReporter.reportUncaughtError(t); <START> metrics.increment(Category.DEFAULT, "uncaughtErrors"); <END> } }</code><technical_language>is default category? a bit confusing definition. this component is "agent" "database" for task queuing :-) of change later</technical_language>

Target:
void expireLocks() { try { int c = autoCommit((handle, dao) -> { if (isEmbededDatabase()) { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < :expireTime" ) .bind("expireTime", Instant.now().getEpochSecond()) .execute(); } else { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < " + statementUnixTimestampSql() ) .execute(); } }); if (c > 0) { logger.warn("{} task locks are expired. Tasks will be retried.", c); } } catch (Throwable t) { logger.error("An uncaught exception is ignored. This lock expiration thread will be restarted.", t); errorReporter.reportUncaughtError(t); metrics.increment(Category.DB, "uncaughtErrors"); } }
Source:
<code>public boolean isConstantExpression(IASTNode point) { return allConstantExpressions(fArguments, point) <START> && (getOverload(point) == null || getOverload(point).isConstexpr()); <END> }</code><technical_language>Avoid calling getOverload twice</technical_language>

Target:
public boolean isConstantExpression(IASTNode point) { return areAllConstantExpressions(fArguments, point) && isConstexprFuncOrNull(getOverload(point)); }
Source:
<code>public boolean parseArguments(List<String> argsList) throws Exception { ParametersParser parser = new ParametersParser( CoreUtil.loadProperties(getClass(), "arguments.properties"), <START> CoreUtil.loadProperties(getClass(), "defaults.properties") <END> ); args = parser.parse(argsList); return args.containsKey("help"); }</code><technical_language>understand defaults</technical_language>

Target:
public void parseArguments(List<String> argsList) throws Exception { args = new ParametersParser( CoreUtil.loadProperties(getClass(), "arguments.properties") ).parse(argsList); }
Source:
<code>public ManagementNodeSyncRecord apply(@Nullable ManagementNodeSyncRecord input) { if (input == null) return null; <START> if (isHeartbeatOk(input, currentTimeMillis())) return input; <END> return BasicManagementNodeSyncRecord.builder() .from(input) .status(ManagementNodeState.FAILED) .build(); }</code><technical_language>I this replace a TERMINATED state a FAILED state. want do that</technical_language>

Target:
public ManagementNodeSyncRecord apply(@Nullable ManagementNodeSyncRecord input) { if (input == null) return null; if (!(input.getStatus() == ManagementNodeState.STANDBY || input.getStatus() == ManagementNodeState.MASTER)) return input; if (isHeartbeatOk(input, currentTimeMillis())) return input; return BasicManagementNodeSyncRecord.builder() .from(input) .status(ManagementNodeState.FAILED) .build(); }
Source:
<code>protected void doHealthCheck(Builder builder) throws Exception { CosmosDatabaseResponse response = this.cosmosClient.getDatabase(dbName).read(); if (response != null) { LOGGER.info("The health indicator cost RUs, cosmos uri: {}, dbName: {}", response.getRequestCharge(), uri, dbName); } if (response == null) { builder.down(); } else { builder.up().withDetail("database", response.getProperties().getId()); <START> } <END> }</code><technical_language>double check, is this ID ID of database</technical_language>

Target:
protected void doHealthCheck(Builder builder) throws Exception { CosmosDatabaseResponse response = this.cosmosAsyncClient.getDatabase(dbName).read().block(); if (response != null) { LOGGER.info("The health indicator cost RUs, cosmos uri: {}, dbName: {}", response.getRequestCharge(), uri, dbName); } if (response == null) { builder.down(); } else { builder.up().withDetail("database", response.getProperties().getId()); } }
Source:
<code>private StoppableCheck performCustomInstanceCheck(String clusterId, String instanceName, String baseUrl, Map<String, String> customPayLoads) throws IOException { LOG.info("Perform instance level client side health checks for {}/{}", clusterId, instanceName); try { return new StoppableCheck( _customRestClient.getInstanceStoppableCheck(baseUrl, customPayLoads), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (HttpHostConnectException ex) { <START> String msg = "Custom client side instance level health check for {}/{} failed " <END> + "because of connection refused."; LOG.error(msg, clusterId, instanceName, ex); return new StoppableCheck(false, Arrays.asList(instanceName), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (IOException e) { LOG.error("Failed to perform custom client side instance level health checks for {}/{}", clusterId, instanceName, e); throw e; } }</code><technical_language>This is time for this String. Dont create a separate object</technical_language>

Target:
private StoppableCheck performCustomInstanceCheck(String clusterId, String instanceName, String baseUrl, Map<String, String> customPayLoads) { LOG.info("Perform instance level client side health checks for {}/{}", clusterId, instanceName); try { return new StoppableCheck( _customRestClient.getInstanceStoppableCheck(baseUrl, customPayLoads), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (IOException ex) { LOG.error("Custom client side instance level health check for {}/{} failed.", clusterId, instanceName, ex); return new StoppableCheck(false, Arrays.asList(instanceName), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } }
Source:
<code>public RangedBeacon(Beacon beacon) { try { Constructor cons = BeaconManager.getRssiFilterImplClass().getConstructors()[0]; filter = (RssiFilter)cons.newInstance(); } catch (Exception e) { <START> e.printStackTrace(); <END> } updateBeacon(beacon); }</code><technical_language>do a LogManager.e</technical_language>

Target:
public RangedBeacon(Beacon beacon) { try { Constructor cons = BeaconManager.getRssiFilterImplClass().getConstructors()[0]; filter = (RssiFilter)cons.newInstance(); if ((filter != null) && (filter instanceof RunningAverageRssiFilter)) ((RunningAverageRssiFilter)filter).setSampleExpirationMilliseconds(sampleExpirationMilliseconds); } catch (Exception e) { LogManager.e(TAG, "Could not construct RssiFilterImplClass %s", BeaconManager.getRssiFilterImplClass().getName()); } updateBeacon(beacon); }
Source:
<code>Mono<Response<SearchIndex>> createWithResponse(SearchIndex index, RequestOptions requestOptions, Context context) { <START> Objects.requireNonNull(index, "'Index' cannot be null"); <END> try { return restClient.indexes() .createWithRestResponseAsync(index, requestOptions, context) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }</code><technical_language>continue this monoError(logger, new NullPointerException("'index' null."); This throw rhater return mono error want</technical_language>

Target:
Mono<Response<SearchIndex>> createWithResponse(SearchIndex index, RequestOptions requestOptions, Context context) { Objects.requireNonNull(index, "'Index' cannot be null"); try { return restClient .createWithRestResponseAsync(index, requestOptions, context) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public void testListContainerMarker() throws InterruptedException { String containerName = getContainerName(); try { addAlphabetUnderRoot(containerName); PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1)); assert container.getNextMarker() != null; assertEquals(container.size(), 1); String marker = container.getNextMarker(); container = view.getBlobStore().list(containerName, afterMarker(marker)); assertEquals(container.getNextMarker(), null); assert container.size() == 25 : String.format("size should have been 25, but was %d: %s", container.size(), container); assert container.getNextMarker() == null; container = view.getBlobStore().list(containerName, afterMarker("z")); <START> assert container.getNextMarker() == null; <END> } finally { returnContainer(containerName); } }</code><technical_language>write this assertThat(container.getNextMarker()).isNull() for a more informative error message</technical_language>

Target:
public void testListContainerMarker() throws InterruptedException { String containerName = getContainerName(); try { addAlphabetUnderRoot(containerName); PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1)); assert container.getNextMarker() != null; assertEquals(container.size(), 1); String marker = container.getNextMarker(); container = view.getBlobStore().list(containerName, afterMarker(marker)); assertEquals(container.getNextMarker(), null); assert container.size() == 25 : String.format("size should have been 25, but was %d: %s", container.size(), container); assert container.getNextMarker() == null; container = view.getBlobStore().list(containerName, afterMarker("z")); assertThat(container.getNextMarker()).isNull(); } finally { returnContainer(containerName); } }
Source:
<code>public String getWorkDir() { <START> return _workDir == null ? "./" : _workDir; <END> }</code><technical_language>Is default "./" unneeded for new specification? I this logic simple. return _workDir; // null allowed</technical_language>

Target:
public String getWorkDir() { return _workDir; }
Source:
<code><START> protected String locateSql(final Handle h) <END> { return h.getConfig(SqlObjects.class).getSqlLocator().locate(sqlObjectType, method); }</code><technical_language>Meh: methods package private</technical_language>

Target:
String locateSql(final Handle h) { return h.getConfig(SqlObjects.class).getSqlLocator().locate(sqlObjectType, method); }
Source:
<code>void doExecute(GitFlowRepository gfRepo, final String startCommitSha1, Shell activeShell) { InputDialog inputDialog = new StartDialog( activeShell, UIText.ReleaseStartHandler_provideReleaseName, UIText.ReleaseStartHandler_provideANameForTheNewRelease, "", new ReleaseNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return; } final String releaseName = inputDialog.getValue(); ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation( gfRepo, startCommitSha1, releaseName); JobUtil.scheduleUserWorkspaceJob(releaseStartOperation, UIText.ReleaseStartHandler_startingNewRelease, JobFamilies.GITFLOW_FAMILY); BranchOperationUI.handleSingleRepositoryCheckoutOperationResult( gfRepo.getRepository(), <START> releaseStartOperation.getCheckoutResult(), <END> gfRepo.getConfig().getFullReleaseBranchName(releaseName)); }</code><technical_language>operation runs in a background thread; this access get checkout result work</technical_language>

Target:
void doExecute(GitFlowRepository gfRepo, final String startCommitSha1, Shell activeShell) { InputDialog inputDialog = new StartDialog( activeShell, UIText.ReleaseStartHandler_provideReleaseName, UIText.ReleaseStartHandler_provideANameForTheNewRelease, "", new ReleaseNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return; } final String releaseName = inputDialog.getValue(); ReleaseStartOperation operation = new ReleaseStartOperation( gfRepo, startCommitSha1, releaseName); String fullBranchName = gfRepo.getConfig() .getFullReleaseBranchName(releaseName); JobUtil.scheduleUserWorkspaceJob(operation, UIText.ReleaseStartHandler_startingNewRelease, JobFamilies.GITFLOW_FAMILY, new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation)); }
Source:
<code>public String getDisplayString() { <START> if (branch.ref().startsWith("refs/heads/")) { <END> return branch.ref().substring( branch.ref().indexOf("refs/heads/") + "refs/heads/".length()); } return branch.ref(); }</code><technical_language>a final string refsHeads = "refs/heads/" for length</technical_language>

Target:
public String getDisplayString() { final String refsHeads = "refs/heads/"; if (branch.ref().startsWith(refsHeads)) { return branch.ref().substring(refsHeads.length()); } return branch.ref(); }
Source:
<code>public void copyFile(File file) { File tmp = null; try { tmp = File.createTempFile("jenkins-acceptance-tests", "dir"); ZipUtil.pack(file, tmp); byte[] archive = IOUtils.toByteArray(new FileInputStream(tmp)); if (SystemUtils.IS_OS_WINDOWS) { if (!(controller instanceof LocalController)) { throw new AssumptionViolatedException("Copying files in Windows is only supported if a LocalController is in use. Test will be skipped."); } <START> addBatchStep("xcopy " + file.getAbsolutePath() + " %cd% /E /Y"); <END> } else { addShellStep(String.format( "base64 --decode << ENDOFFILE > archive.zip && unzip -o archive.zip \n%s\nENDOFFILE", new String(Base64.encodeBase64Chunked(archive)) )); } } catch (IOException e) { throw new AssertionError(e); } finally { if (tmp != null) { tmp.delete(); } } }</code><technical_language>sense extract /E /Y constant reuse kind of WINDOWS_XCOPY_OPTIONS for other occurrence in line well? add a parameterized xcopy method in places</technical_language>

Target:
public void copyFile(File file) { File tmp = null; try { tmp = File.createTempFile("jenkins-acceptance-tests", "dir"); ZipUtil.pack(file, tmp); byte[] archive = IOUtils.toByteArray(new FileInputStream(tmp)); if (SystemUtils.IS_OS_WINDOWS) { if (!(controller instanceof LocalController)) { throw new AssumptionViolatedException("Copying files in Windows is only supported if a LocalController is in use. Test will be skipped."); } addBatchStep(xCopy(file.getAbsolutePath(), "%cd%")); } else { addShellStep(String.format( "base64 --decode << ENDOFFILE > archive.zip && unzip -o archive.zip \n%s\nENDOFFILE", new String(Base64.encodeBase64Chunked(archive)) )); } } catch (IOException e) { throw new AssertionError(e); } finally { if (tmp != null) { tmp.delete(); } } }
Source:
<code>protected AuthoritativeResource fetchAuthoritativeResource(String sourceName) throws IOException { final AuthoritativeResource authoritativeResource = new AuthoritativeResourceJsonLoader(LOGGER).load( <START> OBJECT_MAPPER.readValue( <END> client.target(baseUrl) .path("/rsng-stat/stat/rirstats") .request() .get(String.class), JsonNode.class) ); LOGGER.info("Downloaded {}; asn: {}, ipv4: {}, ipv6: {}", sourceName, authoritativeResource.getNrAutNums(), authoritativeResource.getNrInetnums(), authoritativeResource.getNrInet6nums()); return authoritativeResource; }</code><technical_language>explicit ObjectMapper, creating a domain class for response (and JAX-RS handle automatically)</technical_language>

Target:
protected AuthoritativeResource fetchAuthoritativeResource(String sourceName) throws IOException { final AuthoritativeResource authoritativeResource = new AuthoritativeResourceJsonLoader(LOGGER).load( OBJECT_MAPPER.readValue( client.target(rsngBaseUrl) .path("/rsng-stat/stat/rirstats") .request() .get(String.class), JsonNode.class) ); LOGGER.info("Downloaded {}; asn: {}, ipv4: {}, ipv6: {}", sourceName, authoritativeResource.getNrAutNums(), authoritativeResource.getNrInetnums(), authoritativeResource.getNrInet6nums()); return authoritativeResource; }
Source:
<code>public Map<String, Integer> getInstanceCapacityMap() { Map<String, String> capacityData = _record.getMapField(InstanceConfigProperty.INSTANCE_CAPACITY_MAP.name()); Map<String, Integer> capacityDataMap = new HashMap<>(); if (capacityData != null && !capacityData.isEmpty()) { <START> for (String key: capacityData.keySet()) { <END> capacityDataMap.put(key, Integer.parseInt(capacityData.get(key))); } } return capacityDataMap; }</code><technical_language>Hexli format style need a space ":"? I good lint/format code Helix plugin</technical_language>

Target:
public Map<String, Integer> getInstanceCapacityMap() { Map<String, String> capacityData = _record.getMapField(InstanceConfigProperty.INSTANCE_CAPACITY_MAP.name()); if (capacityData != null) { return capacityData.entrySet().stream().collect( Collectors.toMap(entry -> entry.getKey(), entry -> Integer.parseInt(entry.getValue()))); } return Collections.emptyMap(); }
Source:
<code>private void setAlarmVolume(float volume) { try { if (BuildConfig.DEBUG) { Log.d(TAG, "Setting volume to "+volume); } itsPlayerService.SetVolume(volume); } catch (Exception e) { <START> Log.e(TAG, "Couldn't set volume "+e); <END> } }</code><technical_language>If is a failure means service is dead terribly wrong. play system sound in cases. This done a separate PR improvements I asked in #600</technical_language>

Target:
private void setAlarmVolume(float volume) throws RemoteException { if (BuildConfig.DEBUG) { Log.d(TAG, "Setting volume to " + volume); } if (itsPlayerService.isPlaying()) { itsPlayerService.SetVolume(volume); } }
Source:
<code>public int compareTo(LfsPointer o) { int x = getOid().compareTo(o.getOid()); <START> if (x != 0) { <END> return 0; } return (int) (getSize() - o.getSize()); }</code><technical_language>do return 0 if oids equal ? return x in this case</technical_language>

Target:
public int compareTo(LfsPointer o) { int x = getOid().compareTo(o.getOid()); if (x != 0) { return x; } return (int) (getSize() - o.getSize()); }
Source:
<code>private void updateClusterMapInHelix() { info("Initializing admins and possibly adding cluster in Helix (if non-existent)"); maybeAddCluster(); info("Initialized"); info("Populating resources and partitions set"); <START> info("Populated resources and partitions set"); <END> populateInstancesAndPartitionsMap(); for (Datacenter dc : staticClusterMap.hardwareLayout.getDatacenters()) { info("\n=======Starting datacenter: {}=========\n", dc.getName()); Map<String, Set<String>> partitionsToInstancesInDc = new HashMap<>(); addUpdateInstances(dc.getName(), partitionsToInstancesInDc); info( "Done adding all instances in {}, now scanning resources in Helix and ensuring instance set for partitions are the same.", dc.getName()); addUpdateResources(dc.getName(), partitionsToInstancesInDc); } }</code><technical_language>info is supposed happen populateInstancesAndPartitionsMap()</technical_language>

Target:
private void updateClusterMapInHelix() { info("Initializing admins and possibly adding cluster in Helix (if non-existent)"); maybeAddCluster(); info("Initialized"); info("Populating resources and partitions set"); populateInstancesAndPartitionsMap(); info("Populated resources and partitions set"); for (Datacenter dc : staticClusterMap.hardwareLayout.getDatacenters()) { info("\n=======Starting datacenter: {}=========\n", dc.getName()); Map<String, Set<String>> partitionsToInstancesInDc = new HashMap<>(); addUpdateInstances(dc.getName(), partitionsToInstancesInDc); info( "Done adding all instances in {}, now scanning resources in Helix and ensuring instance set for partitions are the same.", dc.getName()); addUpdateResources(dc.getName(), partitionsToInstancesInDc); } }
Source:
<code>private String adjustDebuggerPath(String path) { IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); <START> return (breakpoints instanceof MIBreakpoints) ? ((MIBreakpoints)breakpoints).adjustDebuggerPath(path) : path; <END> }</code><technical_language>IMIBreakpointPathAdjuster MIBreakpoints</technical_language>

Target:
private String adjustDebuggerPath(String path) { IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); return (breakpoints instanceof IMIBreakpointPathAdjuster) ? ((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(path) : path; }
Source:
<code><START> public static String getStudentProfile(String userId) { <END> Map<String, String[]> params = new HashMap<>(); params.put(Const.ParamsNames.STUDENT_ID, new String[] { userId }); return executeGetRequest(Const.ResourceURIs.STUDENT_PROFILE, params).responseBody; }</code><technical_language>return this StudentProfileAttributes</technical_language>

Target:
public static StudentProfileAttributes getStudentProfile(String userId) { Map<String, String[]> params = new HashMap<>(); params.put(Const.ParamsNames.STUDENT_ID, new String[] { userId }); JSONObject jsonObj = new JSONObject(executeGetRequest(Const.ResourceURIs.STUDENT_PROFILE, params).responseBody); return JsonUtils.fromJson(jsonObj.getJSONObject("studentProfile").toString(), StudentProfileAttributes.class); }
Source:
<code>public void init(Map<String, String> options, ConfigurationSource cfg) { super.initCfg(cfg); FormattingPreferences prefs = new FormattingPreferences(); String maxLineLength = options.get("maxLineLength"); String wrapLongLines = options.get("wrapLongLines"); String tabInsteadOfSpaces = options.get("tabInsteadOfSpaces"); String tabWidth = options.get("tabWidth"); String splitMultiAttrs = options.get("splitMultiAttrs"); prefs.setMaxLineLength(maxLineLength != null ? Integer.valueOf(maxLineLength) : null); prefs.setTabWidth(tabWidth != null ? Integer.valueOf(tabWidth) : null); prefs.setWrapLongLines(wrapLongLines != null ? Boolean.valueOf(wrapLongLines) : null); prefs.setTabInsteadOfSpaces(tabInsteadOfSpaces != null ? Boolean.valueOf(tabInsteadOfSpaces) : null); prefs.setSplitMultiAttrs(splitMultiAttrs != null ? Boolean.valueOf(splitMultiAttrs) : null); <START> this.formatter = new XmlDocumentFormatter(options.getOrDefault("lineending", System.lineSeparator()), prefs); <END> }</code><technical_language>@jam01 Is 'lineending' case sensitive needs 'lineEnding'? Is put order of strings match order of preference loading? review a bit easier :)</technical_language>

Target:
public void init(Map<String, String> options, ConfigurationSource cfg) { super.initCfg(cfg); FormattingPreferences prefs = new FormattingPreferences(); String maxLineLength = options.get("maxLineLength"); String wrapLongLines = options.get("wrapLongLines"); String tabInsteadOfSpaces = options.get("tabInsteadOfSpaces"); String tabWidth = options.get("tabWidth"); String splitMultiAttrs = options.get("splitMultiAttrs"); prefs.setMaxLineLength(maxLineLength != null ? Integer.valueOf(maxLineLength) : null); prefs.setWrapLongLines(wrapLongLines != null ? Boolean.valueOf(wrapLongLines) : null); prefs.setTabInsteadOfSpaces(tabInsteadOfSpaces != null ? Boolean.valueOf(tabInsteadOfSpaces) : null); prefs.setTabWidth(tabWidth != null ? Integer.valueOf(tabWidth) : null); prefs.setSplitMultiAttrs(splitMultiAttrs != null ? Boolean.valueOf(splitMultiAttrs) : null); this.formatter = new XmlDocumentFormatter(options.getOrDefault("lineending", System.lineSeparator()), prefs); }
Source:
<code><START> private void initAlerts() { <END> hostOptionChangeAlert = new AlertWithIcon(AlertType.INFO, constants.hostOptionChangeInfo(), PatternflyConstants.PFICON_INFO); }</code><technical_language>need this if provided=true</technical_language>

Target:
private void initAlerts() { hostOptionChangeAlert = new AlertWithIcon(AlertType.INFO); }
Source:
<code>public void followPeergos() throws Exception { UserContext u1 = PeergosNetworkUtils.ensureSignedUp("peergos", "testpassword", network, crypto); UserContext u2 = PeergosNetworkUtils.ensureSignedUp("w", "w", network, crypto); List<FollowRequestWithCipherText> u1Requests = u1.processFollowRequests().get(); assertTrue("Receive a follow request", u1Requests.size() > 0); String feedback = "Here's some constructive feedback!"; CompletableFuture<Boolean> testFeedbackSubmission = u2.submitFeedback(feedback); assertTrue("Feedback submission was successful!", testFeedbackSubmission.get() == true); Path filePath = Paths.get(u1.username, "feedback"); Optional<FileWrapper> feedbackFile = u1.getByPath(filePath).get(); assertTrue("Feedback file present", feedbackFile.isPresent()); AsyncReader inputStream = feedbackFile .get() .getInputStream(u1.network, u1.crypto.random, l -> {}) .get(); byte[] fileContents = Serialize.readFully(inputStream, feedbackFile.get().getFileProperties().size).get(); <START> assertTrue("Feedback file contents correct", feedback.getBytes() == fileContents); <END> }</code><technical_language>need Arrays.equals comparing object identity</technical_language>

Target:
public void followPeergos() throws Exception { UserContext u1 = PeergosNetworkUtils.ensureSignedUp("peergos", "testpassword", network, crypto); UserContext u2 = PeergosNetworkUtils.ensureSignedUp("w", "w", network, crypto); List<FollowRequestWithCipherText> u1Requests = u1.processFollowRequests().get(); assertTrue("Receive a follow request", u1Requests.size() > 0); }
Source:
<code>public void dropView(String view) { try { super.run("DROP VIEW " + view); <START> } catch (Exception e) { <END> } }</code><technical_language>I log least</technical_language>

Target:
public void dropView(String view) { try { super.run("DROP VIEW " + view); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } }
Source:
<code>public void nodeDelete(String vdc, String nodeName, String token) throws NodeExecutionException { log.info("deleting node"); <START> try { <END> puppetDelete(vdc, nodeName, token); chefClientDelete(vdc, nodeName, token); } catch (Exception e) { try { chefClientDelete(vdc, nodeName, token); } catch (Exception e2) { throw new NodeExecutionException(e2); } } List<ProductInstance> productInstances = null; String hostname = nodeName.split("\\.")[0]; try { productInstances = productInstanceDao.findByHostname(nodeName); for (int i = 0; i < productInstances.size(); i++) { productInstanceDao.remove(productInstances.get(i)); } } catch (EntityNotFoundException enfe) { String errorMsg = "The hostname " + hostname + " does not have products installed " + enfe.getMessage(); log.warn(errorMsg); } }</code><technical_language>I do understand this process, delete puppet chef time, if error (no idea produce this error) try delete chef client</technical_language>

Target:
public void nodeDelete(String vdc, String nodeName, String token) throws NodeExecutionException { log.info("deleting node"); boolean error = false; try { puppetDelete(vdc, nodeName, token); } catch (Exception e) { log.warn("The node cannot be deleted in Puppet master"); error = true; } try { chefClientDelete(vdc, nodeName, token); } catch (Exception e2) { log.warn("The node cannot be deleted in Chef-server"); error = true; } List<ProductInstance> productInstances = null; String hostname = nodeName.split("\\.")[0]; try { productInstances = productInstanceDao.findByHostname(nodeName); for (int i = 0; i < productInstances.size(); i++) { productInstanceDao.remove(productInstances.get(i)); } } catch (EntityNotFoundException enfe) { String errorMsg = "The hostname " + hostname + " does not have products installed " + enfe.getMessage(); log.warn(errorMsg); } if (error) { throw new NodeExecutionException ("Error to delete the node"); } }
Source:
<code><START> protected LinkedHashSet<ArtifactCoordinatesValidator> versionValidators() <END> { return new LinkedHashSet<>(versionValidators); }</code><technical_language>Out of curiousity, protected</technical_language>

Target:
LinkedHashSet<ArtifactCoordinatesValidator> versionValidators() { return new LinkedHashSet<>(versionValidators); }
Source:
<code>void raiseIssue(CallExpressionTree tree) { String functionName = ((IdentifierTree) tree.callee()).name(); <START> addIssue(tree.callee(), String.format(MESSAGE, functionName, functionName)); <END> }</code><technical_language>@vilchik-elena add a secondary location function declaration (or a list of secondary locations more function declarations depending execution path...)</technical_language>

Target:
void raiseIssue(CallExpressionTree tree) { String functionName = "this function"; if (tree.callee().is(IDENTIFIER_REFERENCE)) { functionName = "\"" + ((IdentifierTree) tree.callee()).name() + "\""; } addIssue(tree.callee(), String.format(MESSAGE, functionName, functionName)); }
Source:
<code>public void nextTerminal() { if (terminals_.terminalCount() > 0 && activeTerminalHandle_ != null) { boolean foundCurrent = false; for (final String handle : terminals_) { if (foundCurrent == true) { <START> eventBus_.fireEvent(new SwitchToTerminalEvent(handle)); <END> } if (activeTerminalHandle_.equals(handle)) { foundCurrent = true; } } } }</code><technical_language>this fire event for terminal handle current one</technical_language>

Target:
public void nextTerminal() { if (terminals_.terminalCount() > 0 && activeTerminalHandle_ != null) { boolean foundCurrent = false; for (final String handle : terminals_) { if (foundCurrent == true) { eventBus_.fireEvent(new SwitchToTerminalEvent(handle)); return; } if (activeTerminalHandle_.equals(handle)) { foundCurrent = true; } } } }
Source:
<code>public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { Logger.LOGGER.deprecatedRegionFactory(this.getClass().getName(), this.getClass().getSuperclass().getSuperclass().getName(), SHARED, this.shared); <START> properties.put(SHARED, this.shared); <END> super.start(settings, properties); }</code><technical_language>purpose of this change? do thing</technical_language>

Target:
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { Logger.LOGGER.deprecatedRegionFactory(this.getClass().getName(), this.getClass().getSuperclass().getSuperclass().getName(), SHARED, this.shared); properties.setProperty(SHARED, this.shared); super.start(settings, properties); }
Source:
<code>public void testContinuousQueryFilterDeploymentFailed() throws Exception { startGrids(2).cluster().state(ClusterState.ACTIVE); grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)); ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); Class<Factory<CacheEntryEventFilter<Integer, Integer>>> remoteFilterFactoryCls = (Class<Factory<CacheEntryEventFilter<Integer, Integer>>>)getExternalClassLoader() .loadClass(EXT_FILTER_FACTORY_CLS); <START> Factory<CacheEntryEventFilter<Integer, Integer>> remoteFilterFactory = remoteFilterFactoryCls.newInstance(); <END> qry.setRemoteFilterFactory(remoteFilterFactory); spi(grid(1)).blockMessages((node, msg) -> msg instanceof GridDeploymentRequest); assertThrowsAnyCause( log, () -> grid(0).cache(DEFAULT_CACHE_NAME).query(qry), CacheException.class, "Failed to start continuous query." ); assertEquals(0, grid(0).context().systemView().view(CQ_SYS_VIEW).size()); assertEquals(0, grid(1).context().systemView().view(CQ_SYS_VIEW).size()); }</code><technical_language>a shortened form rmt</technical_language>

Target:
public void testContinuousQueryFilterDeploymentFailed() throws Exception { startGrids(NODES_CNT - 1); IgniteEx cli = startClientGrid(NODES_CNT - 1); IgniteCache<Integer, Integer> cache = cli.createCache(DEFAULT_CACHE_NAME); ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); Class<Factory<CacheEntryEventFilter<Integer, Integer>>> rmtFilterFactoryCls = (Class<Factory<CacheEntryEventFilter<Integer, Integer>>>)getExternalClassLoader() .loadClass("org.apache.ignite.tests.p2p.CacheDeploymentEntryEventFilterFactory"); qry.setRemoteFilterFactory(rmtFilterFactoryCls.newInstance()); spi(grid(1)).blockMessages((node, msg) -> msg instanceof GridDeploymentRequest); assertThrowsWithCause(() -> cache.query(qry), CacheException.class); assertTrue(stopRoutineLatch.await(getTestTimeout(), MILLISECONDS)); assertTrue(allGrids().stream().allMatch(g -> ((IgniteEx)g).context().systemView().view(CQ_SYS_VIEW).size() == 0)); }
Source:
<code><START> public LeaderInformation(@Nullable UUID leaderSessionID, @Nullable String leaderAddress) { <END> this.leaderSessionID = leaderSessionID; this.leaderAddress = leaderAddress; }</code><technical_language>this private introduce factory methods known(String, UUID) empty()</technical_language>

Target:
private LeaderInformation(@Nullable UUID leaderSessionID, @Nullable String leaderAddress) { this.leaderSessionID = leaderSessionID; this.leaderAddress = leaderAddress; }
Source:
<code>public int hashCode() { int bits = 1; bits = 31 * bits + this.type.ordinal(); bits = 31 * bits + getToX(); bits = 31 * bits + getToY(); bits = 31 * bits + getToZ(); <START> return bits; <END> }</code><technical_language>Please replace bits ^ (bits >> 31)</technical_language>

Target:
public int hashCode() { int bits = 1; bits = 31 * bits + this.type.ordinal(); bits = 31 * bits + getToX(); bits = 31 * bits + getToY(); bits = 31 * bits + getToZ(); return bits ^ (bits >> 31); }
Source:
<code>public Object[][] configurationFiles() { return new Object[][] { <START> {"configs/unified/7.0.S"}, <END> {"configs/unified/7.1.xml"}, {"configs/unified/7.2.xml"}, {"configs/unified/8.0.xml"}, {"configs/unified/8.1.xml"}, {"configs/unified/8.2.xml"}, {"configs/unified/9.0.xml"}, {"configs/unified/9.1.xml"}, {"configs/unified/9.2.xml"} }; }</code><technical_language>oops!</technical_language>

Target:
public Object[][] configurationFiles() { return new Object[][] { {"configs/unified/7.0.xml"}, {"configs/unified/7.1.xml"}, {"configs/unified/7.2.xml"}, {"configs/unified/8.0.xml"}, {"configs/unified/8.1.xml"}, {"configs/unified/8.2.xml"}, {"configs/unified/9.0.xml"}, {"configs/unified/9.1.xml"}, {"configs/unified/9.2.xml"} }; }
Source:
<code>public ChargeEntity lockChargeForProcessing(String chargeId, OperationType operationType) { return chargeDao.findByExternalId(chargeId).map(chargeEntity -> { try { chargeEntity.setStatus(operationType.getLockingStatus()); } catch (InvalidStateTransitionException e) { logger.warn("Could not transition charge from status to status - exception is {}", chargeEntity.getId(), chargeEntity.getStatus(), operationType.getLockingStatus(), e.getMessage()); if (chargeEntity.hasStatus(operationType.getLockingStatus())) { throw new OperationAlreadyInProgressRuntimeException(operationType.getValue(), chargeEntity.getExternalId()); } throw new IllegalStateRuntimeException(chargeEntity.getExternalId()); } return chargeEntity; <START> }).orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); <END> }</code><technical_language>happy this line in this method side effect chargeEntity itself</technical_language>

Target:
public ChargeEntity lockChargeForProcessing(String chargeId, OperationType operationType) { return chargeDao.findByExternalId(chargeId).map(chargeEntity -> { try { chargeEntity.setStatus(operationType.getLockingStatus()); } catch (InvalidStateTransitionException e) { if (chargeEntity.hasStatus(operationType.getLockingStatus())) { throw new OperationAlreadyInProgressRuntimeException(operationType.getValue(), chargeEntity.getExternalId()); } throw new IllegalStateRuntimeException(chargeEntity.getExternalId()); } return chargeEntity; }).orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); }