auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void writeToDSTFile(File dstFile) throws IOException { <START> FileOutputStream fileStream = new FileOutputStream(dstFile); writeHeader(fileStream); writeStitchPoints(fileStream); writeEnd(fileStream); fileStream.flush(); fileStream.close(); <END> }</code><technical_language>public void writeToDSTFile(File dstFile) throws IOException { try (FileOutputStream fileStream = new FileOutputStream(dstFile)) { writeHeader(fileStream); writeStitchPoints(fileStream); writeEnd(fileStream); } }</technical_language>

Target:
public void writeToDSTFile(File dstFile) throws IOException { try (FileOutputStream fileStream = new FileOutputStream(dstFile)) { stream.getHeader().appendToStream(fileStream); writeStitchPoints(fileStream); fileStream.write(DSTFileConstants.FILE_END); } }
Source:
<code>private Long getRegistrationMillis(String playerName) { <START> if (!isRegistered(playerName.toLowerCase())) { <END> return null; } PlayerAuth auth = playerCache.getAuth(playerName); if (auth == null) { auth = dataSource.getAuth(playerName); } if (auth != null) { return auth.getRegistrationDate(); } return null; }</code><technical_language>I this check avoided check if auth != null</technical_language>

Target:
private Long getRegistrationMillis(String playerName) { PlayerAuth auth = playerCache.getAuth(playerName); if (auth == null) { auth = dataSource.getAuth(playerName); } if (auth != null) { return auth.getRegistrationDate(); } return null; }
Source:
<code>public void triggerRedeploy() { if (this.userCanDeployProject()) { <START> if(workspaceProjectContext.getActiveModule().get().getPom().getGav().isSnapshot()) { <END> this.buildExecutor.triggerRedeploy(); } } }</code><technical_language>This blow runtime if getActiveModule() returns empty optional</technical_language>

Target:
public void triggerRedeploy() { if (deployEnabled && redeployEnabled) { this.buildExecutor.triggerRedeploy(); } }
Source:
<code>public IncrementableEntryVersion increment(IncrementableEntryVersion initialVersion) { if (initialVersion instanceof NumericVersion) { NumericVersion old = (NumericVersion) initialVersion; long counter = old.getVersion() + 1; return createNumericVersion(counter); } <START> throw new IllegalArgumentException( <END> "Unexpected initial version type (only NumericVersion instances supported): " + initialVersion.getClass().getName()); }</code><technical_language>i18n please</technical_language>

Target:
public IncrementableEntryVersion increment(IncrementableEntryVersion initialVersion) { if (initialVersion instanceof NumericVersion) { NumericVersion old = (NumericVersion) initialVersion; long counter = old.getVersion() + 1; return createNumericVersion(counter); } throw log.unexpectedInitialVersion(initialVersion.getClass().getName()); }
Source:
<code>public static String getContainerId(int index) { <START> return "" + index; <END> }</code><technical_language>return Integer.toString(index); is more idiomatic</technical_language>

Target:
public static String getContainerId(int index) { return Integer.toString(index); }
Source:
<code>public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) throws Exception { <START> LOG.debug("in transform start :" + input.get("name")); <END> Schema outputSchema = getOutputSchema(input.getSchema()); StructuredRecord.Builder builder = createOutputRecords(input, outputSchema); StructuredRecord ss = builder.build(); LOG.debug("in transform end :" + ss.get("designationName")); emitter.emit(ss); }</code><technical_language>Remove</technical_language>

Target:
public void transform(StructuredRecord input, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(getOutputSchema(input.getSchema())); for (Schema.Field sourceField : input.getSchema().getFields()) { String sourceFieldName = sourceField.getName(); if (mappingValues.containsKey(sourceFieldName)) { ValueMapping mapping = mappingValues.get(sourceFieldName); String sourceVal = input.get(sourceFieldName); if (sourceVal == null || sourceVal.isEmpty()) { if (mapping.getDefaultValue() != null) { builder.set(mapping.getTargetField(), mapping.getDefaultValue()); } else { builder.set(mapping.getTargetField(), sourceVal); } } else { Lookup<String> valueMapperLookUp = lookupTableCache.get(mapping.getLookupTableName()); String lookupValue = valueMapperLookUp.lookup(sourceVal); if (lookupValue != null && !lookupValue.isEmpty()) { builder.set(mapping.getTargetField(), lookupValue); } else { builder.set(mapping.getTargetField(), mapping.getDefaultValue()); } } } else { builder.set(sourceFieldName, input.get(sourceFieldName)); } } emitter.emit(builder.build()); }
Source:
<code><START> public void setInstalledLineNumber(int line) throws CoreException { <END> int existingValue = ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1); if (line != existingValue) { this.getMarker().setAttribute(MOVE_BACK_BREAKPOINT, Boolean.TRUE); setAttribute(IMarker.LINE_NUMBER, line); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } }</code><technical_language>moment this method is called else in CDT source code (use show Call Hierarchy find where, in UI code, I recall exactly). call anymore breakpoint is installed editing properties</technical_language>

Target:
public void setInstalledLineNumber(int line) throws CoreException { int existingValue = ensureMarker().getAttribute(IMarker.LINE_NUMBER, -1); if (line != existingValue) { this.getMarker().setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute(IMarker.LINE_NUMBER, line); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } }
Source:
<code>public static Collection<StateBackend> data() { <START> int fileStateSizeThreshold = 1024; <END> return Arrays.asList( new FsStateBackend(new Path("file:/ new RocksDBStateBackend( (StateBackend) new FsStateBackend(new Path("file:/ ) ); }</code><technical_language>constants static final</technical_language>

Target:
public static Collection<StateBackend> data() { return Arrays.asList( new FsStateBackend(new Path("file:/ new RocksDBStateBackend( (StateBackend) new FsStateBackend(new Path("file:/ ) ); }
Source:
<code>public ActionResult execute() { Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); String regkey = getNonNullRequestParamValue(Const.ParamsNames.REGKEY); boolean isValid = true; boolean isLoggedIn = userInfo != null; if (intent == Intent.STUDENT_SUBMISSION || intent == Intent.STUDENT_RESULT) { StudentAttributes student = logic.getStudentForRegistrationKey(regkey); <START> if (!StringHelper.isEmpty(student.googleId)) { <END> if (isLoggedIn) { isValid = student.googleId.equals(userInfo.id); } else { isValid = false; } } return new JsonResult(new RegkeyValidityData(isValid, isLoggedIn)); } return new JsonResult(new RegkeyValidityData(false, isLoggedIn)); }</code><technical_language>result in NPE regkey is valid</technical_language>

Target:
public ActionResult execute() { Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); String regkey = getNonNullRequestParamValue(Const.ParamsNames.REGKEY); if (intent == Intent.STUDENT_SUBMISSION || intent == Intent.STUDENT_RESULT) { boolean isValid = false; StudentAttributes student = logic.getStudentForRegistrationKey(regkey); if (student != null) { if (StringHelper.isEmpty(student.googleId)) { isValid = true; } else { isValid = userInfo != null && student.googleId.equals(userInfo.id); } } return new JsonResult(new RegkeyValidityData(isValid)); } return new JsonResult(new RegkeyValidityData(false)); }
Source:
<code>public void setDistanceTolerance(int distanceTolerance) { <START> if (distanceTolerance < MIN_DISTANCE_TOLERANCE) { <END> this.distanceTolerance = MIN_DISTANCE_TOLERANCE; } else { this.distanceTolerance = distanceTolerance; } }</code><technical_language>this.distanceTolerance = distanceTolerance < MIN_DISTANCE_TOLERANCE ? MIN_DISTANCE_TOLERANCE : distanceTolerance</technical_language>

Target:
public void setDistanceTolerance(int distanceTolerance) { if (distanceTolerance < MIN_DISTANCE_TOLERANCE_IN_METERS) { this.distanceTolerance = distanceTolerance; LOGGER.debug( "Admin supplied distance tolerance is too low. Defaulting to the minimum of meter", MIN_DISTANCE_TOLERANCE_IN_METERS); } else { this.distanceTolerance = distanceTolerance; } }
Source:
<code>private String convertLink(String link) { <START> return link.replace("mandate", "agreement"); <END> }</code><technical_language>Is this a safer including delimiters equals sign whatever</technical_language>

Target:
private String convertLink(String link) { return link.replace("&mandate_", "&agreement_"); }
Source:
<code>public MergedSelectionSet collectFields(FieldCollectorParameters parameters, MergedField mergedField) { Map<String, MergedField> subFields = new LinkedHashMap<>(); <START> Set<String> visitedFragments = new HashSet<>(); <END> for (Field field : mergedField.getFields()) { if (field.getSelectionSet() == null) { continue; } this.collectFields(parameters, field.getSelectionSet(), visitedFragments, subFields); } return newMergedSelectionSet().subFields(subFields).build(); }</code><technical_language>LinkedHashSet predictable debugging easier</technical_language>

Target:
public MergedSelectionSet collectFields(FieldCollectorParameters parameters, MergedField mergedField) { Map<String, MergedField> subFields = new LinkedHashMap<>(); Set<String> visitedFragments = new LinkedHashSet<>(); for (Field field : mergedField.getFields()) { if (field.getSelectionSet() == null) { continue; } this.collectFields(parameters, field.getSelectionSet(), visitedFragments, subFields); } return newMergedSelectionSet().subFields(subFields).build(); }
Source:
<code>public WUQueryResponse workUnitUQuery(String wuid, String jobname, String cluster, String type, String sortby, String state, String endDate, String startDate, Long pageStartFrom, Long pageSize, Integer count, String owner, String appName, String appKey, String appData) throws Exception { WUQueryResponse wuQueryResponse = null; if (wsWorkunitsServiceSoapProxy == null) throw new Exception("wsWorkunitsServiceSoapProxy not available"); else { WUQuery request = new WUQuery(); if (cluster != null) request.setCluster(cluster); if (type != null) request.setType(type); if (sortby != null) request.setSortby(sortby); if (pageStartFrom != null) request.setPageStartFrom(pageStartFrom); if (pageSize != null) request.setPageSize(pageSize); if (state != null) request.setState(state); if (startDate != null) request.setStartDate(startDate); if (endDate != null) request.setEndDate(endDate); if (wuid != null) request.setWuid(wuid); if (jobname != null) request.setJobname(jobname); if (count != null) request.setCount(count); if (owner != null) request.setOwner(owner); <START> ApplicationValue applicationValue[] = {new ApplicationValue(appKey,appName,appData)}; <END> request.setApplicationValues(applicationValue); wuQueryResponse = wsWorkunitsServiceSoapProxy.WUQuery(request); ArrayOfEspException arrayOfEspException = wuQueryResponse.getExceptions(); if (arrayOfEspException != null) { throwWsWUExceptions(arrayOfEspException, "Error in WU query"); } } return wuQueryResponse; }</code><technical_language>do a version accepts appvalues</technical_language>

Target:
public WUQueryResponse workUnitUQuery(String wuid, String jobname, String cluster, String type, String sortby, String state, String endDate, String startDate, Long pageStartFrom, Long pageSize, Integer count, String owner, String appName, String appKey, String appData) throws Exception { ApplicationValue[] applicationValues = {new ApplicationValue(appKey,appName,appData)}; return this.workUnitUQuery(wuid, jobname, cluster, type, sortby, state, endDate, startDate, pageStartFrom, pageSize, count, owner, applicationValues); }
Source:
<code>protected String getSignatureInfo(OperationInfo op, boolean isInput) { <START> List<String> signature = op.getSignature(); <END> if (signature == null || signature.isEmpty()) { return "void"; } List<String> result = new ArrayList<>(); for (int i = (isInput ? 0 : 1); i < signature.size(); i += 2) { result.add(signature.get(i)); } return StringUtils.join(result, ", "); }</code><technical_language>StringUtils.isEmpty used</technical_language>

Target:
protected String getSignatureInfo(OperationInfo op, boolean isInput) { List<String> signature = op.getSignature(); if (signature == null || signature.isEmpty()) { return "void"; } List<String> result = new ArrayList<>(); for (int i = (isInput ? 0 : 1); i < signature.size(); i += 2) { result.add(signature.get(i)); } return String.join(", ", result); }
Source:
<code>public Response handle() throws JSONException { Date expiry = null; SelendroidLogger.log("set cookie to a session command"); String url = getSelendroidDriver().getCurrentUrl(); <START> JSONObject payload = getPayload(); <END> String name = payload.getJSONObject("cookie").get("name").toString(); String value = payload.getJSONObject("cookie").get("value").toString(); if (payload.getJSONObject("cookie").has("expiry")) { expiry = new Date(new Long(payload.getJSONObject("cookie").get("expiry").toString()).longValue()); } Cookie cookie = new Cookie(name, value, "/" ,expiry); getSelendroidDriver().addCookie(url,cookie); return new SelendroidResponse(getSessionId(),""); }</code><technical_language>change this to: JSONObject cookie = getPayload().getJSONObject("cookie"); change references cookie</technical_language>

Target:
public Response handle() throws JSONException { Date expiry = null; SelendroidLogger.log("set cookie to a session command"); String url = getSelendroidDriver().getCurrentUrl(); JSONObject cookie = getPayload().getJSONObject("cookie"); String name = cookie.get("name").toString(); String value = cookie.get("value").toString(); if (cookie.getJSONObject("cookie").has("expiry")) { expiry = new Date(new Long(cookie.get("expiry").toString()).longValue()); } Cookie cookie1 = new Cookie(name, value, "/" ,expiry); getSelendroidDriver().addCookie(url,cookie1); return new SelendroidResponse(getSessionId(),""); }
Source:
<code>public Tuple2<List<T>, List<T>> splitAt(int n) { List<T> head = Nil.instance(); List<T> tail = this; while (n > 0 && !tail.isEmpty()) { head = head.prepend(tail.head()); tail = tail.tail(); n--; } return Tuple.of(head.reverse(), tail); <START> } <END></code><technical_language>great, do it</technical_language>

Target:
public Tuple2<List<T>, List<T>> splitAt(int n) { List<T> init = Nil.instance(); List<T> tail = this; while (n > 0 && !tail.isEmpty()) { init = init.prepend(tail.head()); tail = tail.tail(); n--; } return Tuple.of(init.reverse(), tail); }
Source:
<code>private Response processResponse(Response connectorResponse) { try { SearchRefundsResponse searchResponse = connectorResponse.readEntity(SearchRefundsResponse.class); List<RefundForSearchRefundsResult> results = searchResponse.getRefunds() .stream() <START> .map(refund -> RefundForSearchRefundsResult.valueOf(refund, <END> publicApiUriGenerator.getPaymentURI(refund.getChargeId()), publicApiUriGenerator.getRefundsURI(refund.getChargeId(), refund.getRefundId()))) .collect(Collectors.toList()); HalRepresentation.HalRepresentationBuilder halRepresentation = HalRepresentation .builder() .addProperty("results", results); return Response.ok().entity( paginationDecorator.decoratePagination(halRepresentation, searchResponse, REFUNDS_PATH).build().toString()) .build(); } catch (ProcessingException ex) { throw new SearchRefundsException(ex); } }</code><technical_language>This needs addressed</technical_language>

Target:
private Response processResponse(Response connectorResponse) { SearchRefundsResponse searchResponse; try { searchResponse = connectorResponse.readEntity(SearchRefundsResponse.class); } catch (ProcessingException ex) { throw new SearchRefundsException(ex); } List<RefundForSearchRefundsResult> results = searchResponse.getRefunds() .stream() .map(refund -> RefundForSearchRefundsResult.valueOf(refund, publicApiUriGenerator.getPaymentURI(refund.getChargeId()), publicApiUriGenerator.getRefundsURI(refund.getChargeId(), refund.getRefundId()))) .collect(Collectors.toList()); HalRepresentation.HalRepresentationBuilder halRepresentation = HalRepresentation .builder() .addProperty("results", results); return Response.ok().entity( paginationDecorator.decoratePagination(halRepresentation, searchResponse, REFUNDS_PATH).build().toString()) .build(); }
Source:
<code>public List<SubmitRecord> canSubmit(ReviewDb db, PatchSet.Id patchSetId) { if (change.getGroupKey() == null) { return canSubmitAlone(db, patchSetId); <START> } else { <END> ResultSet<Change> groupChanges = null; try { groupChanges = db.changes().byGroupKey(change.getGroupKey()); } catch (OrmException err) { return logRuleError("Cannot read group for change " + change.getChangeId(), err); } final List<SubmitRecord> allOutcomes = new ArrayList<SubmitRecord>(); boolean someChangesUnsubmittable = false; try { for (ChangeControl ctl : factory.controlsFor(groupChanges)) { final List<SubmitRecord> submitOutcome = ctl.canSubmitAlone(db, ctl.change.currentPatchSetId()); allOutcomes.addAll(submitOutcome); for (SubmitRecord sr : submitOutcome) { if (sr.status != SubmitRecord.Status.OK && sr.status != SubmitRecord.Status.CLOSED) { someChangesUnsubmittable = true; } } } } catch (NoSuchChangeException err) { return logRuleError("Not all changes returned by group key were valid"); } if (someChangesUnsubmittable) { for (SubmitRecord sr : allOutcomes) { if (sr.status == SubmitRecord.Status.OK) { sr.status = SubmitRecord.Status.GROUP_NOT_READY; } } } return allOutcomes; } }</code><technical_language>I bother else if returning in if</technical_language>

Target:
public List<SubmitRecord> canSubmit(ReviewDb db, PatchSet.Id patchSetId) { if (change.getGroupKey() == null) { return canSubmitAlone(db, patchSetId); } ResultSet<Change> groupChanges = null; try { groupChanges = db.changes().byGroupKey(change.getGroupKey()); } catch (OrmException err) { return logRuleError( "Cannot read group " + change.getGroupKey().toString() + " for change " + change.getChangeId(), err); } final List<SubmitRecord> allSubmitRecords = new ArrayList<SubmitRecord>(); boolean groupNotReady = false; try { for (ChangeControl ctl : factory.controlsFor(groupChanges)) { final List<SubmitRecord> submitRecords = ctl.canSubmitAlone(db, ctl.change.currentPatchSetId()); allSubmitRecords.addAll(submitRecords); for (SubmitRecord sr : submitRecords) { if (sr.status != SubmitRecord.Status.OK && sr.status != SubmitRecord.Status.CLOSED) { groupNotReady = true; } } } } catch (NoSuchChangeException err) { return logRuleError("You may not have permissions to all the changes in the group"); } if (groupNotReady) { for (SubmitRecord sr : allSubmitRecords) { if (sr.status == SubmitRecord.Status.OK) { sr.status = SubmitRecord.Status.GROUP_NOT_READY; } } } return allSubmitRecords; }
Source:
<code>public static Properties getProxySettings() throws FileNotFoundException, IOException { Properties properties = new Properties(); File iniFile = getIniFile(); if (iniFile == null) { <START> properties.put(RuntimeFieldEditor.PROXYHOST, System.getProperty(RuntimeFieldEditor.PROXYHOST)); <END> properties.put(RuntimeFieldEditor.PROXYPORT, System.getProperty(RuntimeFieldEditor.PROXYPORT)); properties.put(RuntimeFieldEditor.PROXYNONHOSTS, System.getProperty(RuntimeFieldEditor.PROXYNONHOSTS)); } else { BufferedReader bR = new BufferedReader(new FileReader(iniFile)); String line = null; while( (line = bR.readLine()) != null ) { if (line.matches(".*D" + RuntimeFieldEditor.PROXYHOST + ".*")) { String proxyHost = line.split("=")[1].trim(); properties.put(RuntimeFieldEditor.PROXYHOST, proxyHost); } if (line.matches(".*D" + RuntimeFieldEditor.PROXYPORT + ".*")) { String proxyPort = line.split("=")[1].trim(); properties.put(RuntimeFieldEditor.PROXYPORT, proxyPort); } if (line.matches(".*D" + RuntimeFieldEditor.PROXYNONHOSTS + ".*")) { String proxyNonHosts = line.split("=")[1].trim(); proxyNonHosts = proxyNonHosts.replaceAll(PROXYQUOTES, ""); properties.put(RuntimeFieldEditor.PROXYNONHOSTS, proxyNonHosts); } } bR.close(); } return properties; }</code><technical_language>I hope I understood correctly, means * System properties returned for Proxy-configuration if is ini-file present * configured proxy-condigurations read ini file if present? if proxy configuration set in ini-file. Does't for callers of getProxySettings() is proxy-configuration? do returning system properties if ini file doen't proxy-configuration? if system Properties set either</technical_language>

Target:
public static Properties getProxySettings() throws FileNotFoundException, IOException { Properties properties = new Properties(); File iniFile = getIniFile(); if (iniFile == null) { String host = System.getProperty(RuntimeFieldEditor.PROXYHOST); if (host != null) { properties.put(RuntimeFieldEditor.PROXYHOST, host); } String port = System.getProperty(RuntimeFieldEditor.PROXYPORT); if (port != null) { properties.put(RuntimeFieldEditor.PROXYPORT, port); } String nonHosts = System.getProperty(RuntimeFieldEditor.PROXYNONHOSTS); if (nonHosts != null) { properties.put(RuntimeFieldEditor.PROXYNONHOSTS, nonHosts); } } else { BufferedReader bR = new BufferedReader(new FileReader(iniFile)); String line = null; while( (line = bR.readLine()) != null ) { if (line.matches(".*D" + RuntimeFieldEditor.PROXYHOST + ".*")) { String proxyHost = line.split("=")[1].trim(); properties.put(RuntimeFieldEditor.PROXYHOST, proxyHost); } if (line.matches(".*D" + RuntimeFieldEditor.PROXYPORT + ".*")) { String proxyPort = line.split("=")[1].trim(); properties.put(RuntimeFieldEditor.PROXYPORT, proxyPort); } if (line.matches(".*D" + RuntimeFieldEditor.PROXYNONHOSTS + ".*")) { String proxyNonHosts = line.split("=")[1].trim(); proxyNonHosts = proxyNonHosts.replaceAll(PROXYQUOTES, ""); properties.put(RuntimeFieldEditor.PROXYNONHOSTS, proxyNonHosts); } } bR.close(); } return properties; }
Source:
<code>public MergedSelectionSet collectFields(FieldCollectorParameters parameters, SelectionSet selectionSet) { Map<String, MergedField> subFields = new LinkedHashMap<>(); <START> Set<String> visitedFragments = new HashSet<>(); <END> this.collectFields(parameters, selectionSet, visitedFragments, subFields); return newMergedSelectionSet().subFields(subFields).build(); }</code><technical_language>above: LinkedHashSet predictable debugging easier</technical_language>

Target:
public MergedSelectionSet collectFields(FieldCollectorParameters parameters, SelectionSet selectionSet) { Map<String, MergedField> subFields = new LinkedHashMap<>(); Set<String> visitedFragments = new LinkedHashSet<>(); this.collectFields(parameters, selectionSet, visitedFragments, subFields); return newMergedSelectionSet().subFields(subFields).build(); }
Source:
<code>public int hashCode() { final int prime = 31; int result = super.hashCode(); <START> result = prime * result + ((this.helper == null) ? 0 : this.helper.hashCode()); <END> return result; }</code><technical_language>java.util.Objects.hashcode instead of checking for null</technical_language>

Target:
public int hashCode() { return super.hashCode() + Objects.hash(this.helper); }
Source:
<code>protected String getPath(String filename) throws IOException { <START> return super.getPath("checks"+File.separator+"whitespace"+File.separator+"nolinewrap"+File.separator+filename); <END> }</code><technical_language>@divsidhu-26 line 100 chars. <LINK_0> a whitespace concatenation operator</technical_language>

Target:
protected String getPath(String filename) throws IOException { return super.getPath("checks" + File.separator + "whitespace" + File.separator + "noLineWrap" + File.separator + filename); }
Source:
<code>public static StageExecutionDescriptor dynamicLifespanScheduleGroupedExecution(List<PlanNodeId> capableScanNodes) { requireNonNull(capableScanNodes, "capableScanNodes is null"); <START> checkArgument(!capableScanNodes.isEmpty()); <END> return new StageExecutionDescriptor(DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, ImmutableSet.copyOf(capableScanNodes)); }</code><technical_language>Add a message in case fails</technical_language>

Target:
public static StageExecutionDescriptor dynamicLifespanScheduleGroupedExecution(List<PlanNodeId> capableScanNodes) { requireNonNull(capableScanNodes, "capableScanNodes is null"); checkArgument(!capableScanNodes.isEmpty(), "capableScanNodes cannot be empty if stage execution strategy is grouped execution"); return new StageExecutionDescriptor(DYNAMIC_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, ImmutableSet.copyOf(capableScanNodes)); }
Source:
<code>public static StageExecutionDescriptor fixedLifespanScheduleGroupedExecution(List<PlanNodeId> capableScanNodes) { requireNonNull(capableScanNodes, "capableScanNodes is null"); <START> checkArgument(!capableScanNodes.isEmpty()); <END> return new StageExecutionDescriptor(FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, ImmutableSet.copyOf(capableScanNodes)); }</code><technical_language>Add a message in case fails</technical_language>

Target:
public static StageExecutionDescriptor fixedLifespanScheduleGroupedExecution(List<PlanNodeId> capableScanNodes) { requireNonNull(capableScanNodes, "capableScanNodes is null"); checkArgument(!capableScanNodes.isEmpty(), "capableScanNodes cannot be empty if stage execution strategy is grouped execution"); return new StageExecutionDescriptor(FIXED_LIFESPAN_SCHEDULE_GROUPED_EXECUTION, ImmutableSet.copyOf(capableScanNodes)); }
Source:
<code>public synchronized void close() { if (status == TrackerStatus.CLOSED) { <START> log.error("TimestampTracker was previously closed!"); <END> return; } status = TrackerStatus.CLOSED; timer.cancel(); closeZkNode(); }</code><technical_language>change this log error instead of throw exception? Stack traces useful</technical_language>

Target:
public synchronized void close() { Preconditions.checkState(status != TrackerStatus.CLOSED, "tracker already closed"); status = TrackerStatus.CLOSED; timer.cancel(); closeZkNode(); }
Source:
<code>public EList<Diff> getDifferences() { <START> return new BasicEList<Diff>(this.diffs); <END> }</code><technical_language>Please create a new list call of getDifferences(), create list once, e.g., call, return instance. want UnmodifiableEList instead, fail early, if modify it</technical_language>

Target:
public EList<Diff> getDifferences() { return this.diffs; }
Source:
<code>private void startRootElement(String uri, String localName, String qName, Attributes attributes) { elementStack.push(localName); if ("feed".equals(localName)) { delegate = new AtomHandler(url, elementStack, strict); } else if ("rss".equals(localName)) { <START> return; END> } else if ("channel".equals(localName)) { delegate = new RSSHandler(url, elementStack, strict); } else if ("sitemapindex".equals(localName)) { delegate = new XMLIndexHandler(url, elementStack, strict); } else if ("urlset".equals(localName)) { delegate = new XMLHandler(url, elementStack, strict); } else { LOG.debug("Skipped unknown root element <{}> in {}", localName, url); return; } delegate.setStrictNamespace(isStrictNamespace()); delegate.setAcceptedNamespaces(acceptedNamespaces); if (isStrictNamespace()) { if (delegate instanceof AtomHandler || delegate instanceof RSSHandler) { return; } if (!isAcceptedNamespace(uri) && uri.startsWith("/")) { try { URL u = new URL(url, uri); uri = u.toString(); } catch (MalformedURLException e) { LOG.warn("Failed to resolve relative namespace URI in sitemap {}", uri, url); } } if (!isAcceptedNamespace(uri)) { String msg; if (!Namespace.isSupported(uri)) { msg = "Unsupported namespace <" + uri + ">"; } else { msg = "Namespace <" + uri + "> not accepted"; } setException(new UnknownFormatException(msg)); delegate = null; return; } } }</code><technical_language>Is this related improving namespace support</technical_language>

Target:
private void startRootElement(String uri, String localName, String qName, Attributes attributes) { elementStack.push(localName); if ("feed".equals(localName)) { delegate = new AtomHandler(url, elementStack, strict); } else if ("channel".equals(localName)) { delegate = new RSSHandler(url, elementStack, strict); } else if ("sitemapindex".equals(localName)) { delegate = new XMLIndexHandler(url, elementStack, strict); } else if ("urlset".equals(localName)) { delegate = new XMLHandler(url, elementStack, strict); } else { LOG.debug("Skipped unknown root element <{}> in {}", localName, url); return; } delegate.setStrictNamespace(isStrictNamespace()); delegate.setAcceptedNamespaces(acceptedNamespaces); if (isStrictNamespace()) { if (delegate instanceof AtomHandler || delegate instanceof RSSHandler) { return; } if (!isAcceptedNamespace(uri) && uri.startsWith("/")) { try { URL u = new URL(url, uri); uri = u.toString(); } catch (MalformedURLException e) { LOG.warn("Failed to resolve relative namespace URI in sitemap {}", uri, url); } } if (!isAcceptedNamespace(uri)) { String msg; if (!Namespace.isSupported(uri)) { msg = "Unsupported namespace <" + uri + ">"; } else { msg = "Namespace <" + uri + "> not accepted"; } setException(new UnknownFormatException(msg)); delegate = null; return; } } }
Source:
<code>public void testUsedPropertiesWithFailure() { Map<String, String> properties = new TreeMap<>(); properties.put("string-value", "some value"); properties.put("boolean-value", "invalid"); ConfigurationFactory configurationFactory = new ConfigurationFactory(properties, null, new TestMonitor()); configurationFactory.registerConfigurationClasses(ImmutableList.of(binder -> configBinder(binder).bindConfig(AnnotatedSetter.class))); List<Message> messages = configurationFactory.validateRegisteredConfigurationProvider(); assertEquals(messages.size(), 1); <START> assertEquals(configurationFactory.getUsedProperties(), ImmutableSet.of("string-value", "boolean-value")); <END> }</code><technical_language>part properties.keySet()</technical_language>

Target:
public void testUsedPropertiesWithFailure() { Map<String, String> properties = new TreeMap<>(); properties.put("string-value", "some value"); properties.put("boolean-value", "invalid"); ConfigurationFactory configurationFactory = new ConfigurationFactory(properties, null, new TestMonitor()); configurationFactory.registerConfigurationClasses(ImmutableList.of(binder -> configBinder(binder).bindConfig(AnnotatedSetter.class))); List<Message> messages = configurationFactory.validateRegisteredConfigurationProvider(); assertMessagesMatch(messages, ImmutableList.of(".*Invalid value 'invalid' for type boolean \\(property 'boolean-value'\\).*AnnotatedSetter.*")); assertEquals(configurationFactory.getUsedProperties(), properties.keySet()); }
Source:
<code>protected String searchTrace(String parentId, String traceId, String logic) { String json = null; String query = null; try { if (parentId != null) { Long.parseLong(parentId); } if (traceId != null) { Long.parseLong(traceId); } } catch (NumberFormatException e) { throw new RuntimeException("The passed parentId/traceId is not a number.", e); } <START> if (logic != null && (!logic.equals(LOGIC_AND) && !logic.equals(LOGIC_OR))) { <END> throw new RuntimeException("Wrong logical operator passed to the query. Only " + LOGIC_AND + "," + LOGIC_OR + " are allowed."); } if (parentId != null && traceId != null) { query = "SELECT * FROM " + TRACING_TABLE + " WHERE parent_id=" + parentId + " " + logic + " trace_id=" + traceId; } else if (parentId != null && traceId == null) { query = "SELECT * FROM " + TRACING_TABLE + " WHERE parent_id=" + parentId; } else if (parentId == null && traceId != null) { query = "SELECT * FROM " + TRACING_TABLE + " WHERE trace_id=" + traceId; } json = getResults(query); return getJson(json); }</code><technical_language>Parenthesis (!logic.equals(LOGIC_AND) && !logic.equals(LOGIC_OR)) unnecessary, please drop them</technical_language>

Target:
protected String searchTrace(String parentId, String traceId, String logic) { String json = null; String query = null; try { if (parentId != null) { Long.parseLong(parentId); } if (traceId != null) { Long.parseLong(traceId); } } catch (NumberFormatException e) { throw new RuntimeException("The passed parentId/traceId is not a number.", e); } if (logic != null && !logic.equals(LOGIC_AND) && !logic.equals(LOGIC_OR)) { throw new RuntimeException("Wrong logical operator passed to the query. Only " + LOGIC_AND + "," + LOGIC_OR + " are allowed."); } if (parentId != null && traceId != null) { query = "SELECT * FROM " + TRACING_TABLE + " WHERE parent_id=" + parentId + " " + logic + " trace_id=" + traceId; } else if (parentId != null && traceId == null) { query = "SELECT * FROM " + TRACING_TABLE + " WHERE parent_id=" + parentId; } else if (parentId == null && traceId != null) { query = "SELECT * FROM " + TRACING_TABLE + " WHERE trace_id=" + traceId; } json = getResults(query); return getJson(json); }
Source:
<code>public AS71Manager(IAS7ManagementDetails details) throws JBoss7ManangerException { try { this.details = details; Object timeout = details.getProperty(IAS7ManagementDetails.PROPERTY_TIMEOUT); <START> int timeout2 = timeout == null || !(timeout instanceof Integer) ? 5000 : ((Integer)timeout).intValue(); <END> this.client = ModelControllerClient.Factory.create( details.getHost(), details.getManagementPort(), getCallbackHandler(), null, timeout2); this.manager = ServerDeploymentManager.Factory.create(client); } catch(UnknownHostException uhe) { throw new JBoss7ManangerException(uhe); } }</code><technical_language>timeout == null is redundant !(timeout instanceof Integer)</technical_language>

Target:
public AS71Manager(IAS7ManagementDetails details) throws JBoss7ManangerException { try { this.details = details; Object timeout = details.getProperty(IAS7ManagementDetails.PROPERTY_TIMEOUT); int timeout2 = !(timeout instanceof Integer) ? DEFAULT_REQUEST_TIMEOUT : ((Integer)timeout).intValue(); this.client = ModelControllerClient.Factory.create( details.getHost(), details.getManagementPort(), getCallbackHandler(), null, timeout2); this.manager = ServerDeploymentManager.Factory.create(client); } catch(UnknownHostException uhe) { throw new JBoss7ManangerException(uhe); } }
Source:
<code>public SnapshotDataStoreVO findParent(DataStoreRole role, Long storeId, Long volumeId) { SearchCriteria<SnapshotDataStoreVO> sc = parentSnapshotSearch.create(); sc.setParameters("volume_id", volumeId); sc.setParameters("store_role", role.toString()); sc.setParameters("state", ObjectInDataStoreStateMachine.State.Ready.name()); sc.setParameters("store_id", storeId); <START> sc.setJoinParameters("snapshotVOSearch", "hypervisorType", Hypervisor.HypervisorType.XenServer); <END> List<SnapshotDataStoreVO> snapshotList = listBy(sc, new Filter(SnapshotDataStoreVO.class, "created", false, null, null)); if (snapshotList != null && snapshotList.size() != 0) { return snapshotList.get(0); } return null; }</code><technical_language>@niteshsarda confirm if XenServer is supported hypervisor valid parent snapshot ID for a snapshot ID? Instead of hardcoding hypervisor type, fetch hypervisor type categorically</technical_language>

Target:
public SnapshotDataStoreVO findParent(DataStoreRole role, Long storeId, Long volumeId) { if(isSnapshotChainingRequired(volumeId)) { SearchCriteria<SnapshotDataStoreVO> sc = parentSnapshotSearch.create(); sc.setParameters("volume_id", volumeId); sc.setParameters("store_role", role.toString()); sc.setParameters("state", ObjectInDataStoreStateMachine.State.Ready.name()); sc.setParameters("store_id", storeId); List<SnapshotDataStoreVO> snapshotList = listBy(sc, new Filter(SnapshotDataStoreVO.class, "created", false, null, null)); if (snapshotList != null && snapshotList.size() != 0) { return snapshotList.get(0); } } return null; }
Source:
<code>public synchronized void flush() throws InterruptedException { isFlushing.set(true); boolean performedWarning = false; while (true) { cleanupFinishedOperations(); if (pendingOperationsWithSize.isEmpty()) { break; } if (!performedWarning && requiresWarning()) { warn(); performedWarning = true; } wait(FINISH_WAIT_MILLIS); } <START> if (performedWarning) { <END> LOG.info("flush() completed"); } isFlushing.set(false); }</code><technical_language>performedWarning is false, "flush()" completed, correct</technical_language>

Target:
public void flush() throws InterruptedException { isFlushing.set(true); boolean performedWarning = false; while (true) { synchronized (pendingOperationsWithSize) { cleanupFinishedOperations(); if (pendingOperationsWithSize.isEmpty()) { break; } } if (!performedWarning && requiresWarning()) { warn(); performedWarning = true; } synchronized (this) { wait(FINISH_WAIT_MILLIS); } } if (performedWarning) { LOG.info("flush() completed. See the log for previous warnings."); } isFlushing.set(false); }
Source:
<code>public String getDescriptionUsage() { <START> return "Check the correctness of Attribute values under a specified Folder Artifact."; <END> }</code><technical_language>I agree this description based code reason terse it. ensure "correctness", simply helps spread commonly attribute value, correct</technical_language>

Target:
public String getDescriptionUsage() { return "Check the consitency of Attribute values under a specified Folder Artifact."; }
Source:
<code>public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String message, RecognitionException e) { Parser parser = (Parser) recognizer; ATN atn = parser.getATN(); ATNState currentState = atn.states.get(parser.getState()); Analyzer analyzer = new Analyzer(parser.getTokenStream(), atn, parser.getVocabulary(), specialRules, specialTokens, ignoredRules); Map<Integer, Set<String>> candidates = new HashMap<>(); analyzer.process(candidates, currentState, parser.getCurrentToken().getTokenIndex(), parser.getContext()); String expected = candidates.entrySet().stream() <START> .max(Comparator.comparing(Map.Entry::getKey)) <END> .get() .getValue().stream() .sorted() .collect(Collectors.joining(", ")); throw new ParsingException( String.format("mismatched input '%s'. Expecting: %s", ((Token) offendingSymbol).getText(), expected), e, line, charPositionInLine); }</code><technical_language>pre-seed candidates map 0 -> ensure get empty map</technical_language>

Target:
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String message, RecognitionException e) { try { Parser parser = (Parser) recognizer; ATN atn = parser.getATN(); ATNState currentState = atn.states.get(parser.getState()); Multimap<Integer, String> candidates = HashMultimap.create(); Analyzer analyzer = new Analyzer(atn, parser.getVocabulary(), specialRules, specialTokens, ignoredRules, parser.getTokenStream(), candidates); analyzer.process(currentState, parser.getCurrentToken().getTokenIndex(), parser.getContext()); String expected = candidates.asMap().entrySet().stream() .max(Comparator.comparing(Map.Entry::getKey)) .get() .getValue().stream() .sorted() .collect(Collectors.joining(", ")); message = String.format("mismatched input '%s'. Expecting: %s", ((Token) offendingSymbol).getText(), expected); } catch (Exception exception) { LOG.error(e, "Unexpected failure when handling parsing error. This is likely a bug in the implementation"); } throw new ParsingException(message, e, line, charPositionInLine); }
Source:
<code>public IndexDiffCacheEntry(Repository repository) { this.repository = repository; repository.getListenerList().addIndexChangedListener( new IndexChangedListener() { public void onIndexChanged(IndexChangedEvent event) { refreshIndexDelta(); } }); repository.getListenerList().addRefsChangedListener( new RefsChangedListener() { public void onRefsChanged(RefsChangedEvent event) { scheduleReloadJob("RefsChanged"); } }); scheduleReloadJob("IndexDiffCacheEntry construction"); createResourceChangeListener(); <START> if(!repository.isBare()) { <END> try { lastIndex = DirCache.read(repository); } catch(IOException ex) { Activator.error(String.format(CoreText.IndexDiffCacheEntry_failed_index_load, repository), ex); } } }</code><technical_language>Please add a space keywords parentheses. in rest of change</technical_language>

Target:
public IndexDiffCacheEntry(Repository repository) { this.repository = repository; repository.getListenerList().addIndexChangedListener( new IndexChangedListener() { public void onIndexChanged(IndexChangedEvent event) { refreshIndexDelta(); } }); repository.getListenerList().addRefsChangedListener( new RefsChangedListener() { public void onRefsChanged(RefsChangedEvent event) { scheduleReloadJob("RefsChanged"); } }); scheduleReloadJob("IndexDiffCacheEntry construction"); createResourceChangeListener(); if (!repository.isBare()) { try { lastIndex = repository.readDirCache(); } catch(IOException ex) { Activator.error(String.format(CoreText.IndexDiffCacheEntry_errorCalculatingIndexDelta, repository), ex); } } }
Source:
<code>public void run() { while (!context.executor.isShutdown()) { try { Thread.sleep(context.getProgressReporterSleepTime()); } catch (InterruptedException e) { LOG.warn("interrupt discarded"); } try { <START> for (ScheduledQueryExecutor worker : runningWorkers) { <END> worker.reportQueryProgress(); } } catch (Exception e) { LOG.error("ProgressReporter encountered exception ", e); } } }</code><technical_language>hit a concurrent modification exception if a worker finishes is deleted, while iterating here</technical_language>

Target:
public void run() { try (NamedThread namedThread = new NamedThread("Scheduled Query Progress Reporter")) { while (!context.executor.isShutdown()) { try { Thread.sleep(context.getProgressReporterSleepTime()); } catch (InterruptedException e) { LOG.warn("interrupt discarded"); } try { for (ScheduledQueryExecutor worker : runningExecutors) { worker.reportQueryProgress(); } } catch (Exception e) { LOG.error("ProgressReporter encountered exception ", e); } } } }
Source:
<code>public String reportProblemForSingle() { this.myDav.uploadFromHome(this.currentStep.getProcess()); serviceManager.getWorkflowService().setProblem(getProblem()); try { this.currentStep = serviceManager.getWorkflowService().reportProblem(this.currentStep, this.problemTask); } catch (DataException e) { <START> logger.error("Problem couldn't be reported: " + e); <END> } this.problem.setMessage(""); this.problemTask = ""; saveStep(); AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }</code><technical_language>2 things: 1) If a DataException is thrown is a good idea on? 2) this kind of error logging work casting exception object string message</technical_language>

Target:
public String reportProblemForSingle() { this.myDav.uploadFromHome(this.currentStep.getProcess()); serviceManager.getWorkflowService().setProblem(getProblem()); try { this.currentStep = serviceManager.getWorkflowService().reportProblem(this.currentStep, this.problemTask); saveStep(); } catch (DataException e) { logger.error("Problem couldn't be reported: " + e); } this.problem.setMessage(""); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
<code>public String lookupEntityName(EntityEnum entityType, String entityId) { <START> if (entityType != null && (!StringUtils.isEmpty(entityId))) { <END> IEntityNameFinder finder; if (entityType.isGroup()) { finder = EntityNameFinderService.instance().getNameFinder(IEntityGroup.class); } else { finder = EntityNameFinderService.instance().getNameFinder(entityType.getClazz()); } try { return finder.getName(entityId); } catch (Exception e) { log.warn("Couldn't find name for entity " + entityId, e); return null; } } return null; }</code><technical_language>art: Personally I lean a guard statement. java if (entityType == null || StringUtils.isBlank(entityId)) { return null } ..</technical_language>

Target:
public String lookupEntityName(EntityEnum entityType, String entityId) { if (entityType == null && (StringUtils.isBlank(entityId))) { return null; } IEntityNameFinder finder; if (entityType.isGroup()) { finder = EntityNameFinderService.instance().getNameFinder(IEntityGroup.class); } else { finder = EntityNameFinderService.instance().getNameFinder(entityType.getClazz()); } try { return finder.getName(entityId); } catch (Exception e) { log.warn("Couldn't find name for entity " + entityId, e); return null; } }
Source:
<code>public JsonObject toJson() { final JsonObject root = new JsonObject(); root.add("uuid", uuid); root.add("address", address); root.add("clientType", clientType); root.add("name", name); JsonObject labelsObject = Json.object(); for (String label : labels) { <START> labelsObject.add("label", label); <END> } root.add("labels", labelsObject); return root; }</code><technical_language>This serialization is correct. leads duplicate keys in JSON: { "labels": { "label": "firstLabel-hzclient-1", "label": "secondLabel-hzclient-1" } } array of strings used, result be: { "labels": [ "firstLabel-hzclient-1", "secondLabel-hzclient-1" ] }</technical_language>

Target:
public JsonObject toJson() { final JsonObject root = Json.object(); root.add("uuid", uuid); root.add("address", address); root.add("clientType", clientType); root.add("name", name); JsonArray labelsObject = Json.array(); for (String label : labels) { labelsObject.add(label); } root.add("labels", labelsObject); return root; }
Source:
<code>public static void unzipFile(File zipFile, File unzipDirectory, boolean deleteZip) throws IOException { ZipFile zipFileActual = new ZipFile(zipFile); zipFileActual.stream().forEach((ZipEntry zipEntry) -> { if (!zipEntry.isDirectory()) { String fileName = zipEntry.getName(); File newFile = new File(unzipDirectory, fileName); try { newFile.getParentFile().mkdirs(); FileUtils.copyInputStreamToFile(zipFileActual.getInputStream(zipEntry), newFile); } catch (IOException e) { throw new RuntimeException(e); } } }); <START> if (deleteZip) { <END> FileUtils.deleteQuietly(zipFile); } }</code><technical_language>this in a finally? If exception is thrown line 57, this code get executed</technical_language>

Target:
public static void unzipFile(File zipFile, File unzipDirectory, boolean deleteZip) throws IOException { try (ZipFile zipFileActual = new ZipFile(zipFile)) { zipFileActual.stream().forEach((ZipEntry zipEntry) -> { if (!zipEntry.isDirectory()) { String fileName = zipEntry.getName(); File newFile = new File(unzipDirectory, fileName); try { newFile.getParentFile().mkdirs(); FileUtils.copyInputStreamToFile(zipFileActual.getInputStream(zipEntry), newFile); } catch (IOException e) { throw new RuntimeException(e); } finally { if (deleteZip) { FileUtils.deleteQuietly(zipFile); } } } }); } }
Source:
<code>public static void sortSummarizedCoursesByCourseName(List<CourseSummaryBundle> courses) { courses.sort((CourseSummaryBundle obj1, CourseSummaryBundle obj2) -> { String courseName1 = obj1.course.getName(); String courseName2 = obj2.course.getName(); courseName1 = SanitizationHelper.desanitizeIfHtmlSanitized(courseName1); <START> courseName2 = SanitizationHelper.desanitizeFromHtml(courseName2); <END> return courseName1.compareTo(courseName2); }); }</code><technical_language>fault, cases SanitizationHelper.desanitizeIfHtmlSanitized. change it, this block transformed a one-line lambda</technical_language>

Target:
public static void sortSummarizedCoursesByCourseName(List<CourseSummaryBundle> courses) { courses.sort(Comparator.comparing(obj -> SanitizationHelper.desanitizeFromHtml(obj.course.getName()))); }