auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
Span buildSpan(Message<?> message) { if (!hasHeader(message, Trace.TRACE_ID_NAME) || !hasHeader(message, Trace.SPAN_ID_NAME)) { return null; } long spanId = hasHeader(message, Trace.SPAN_ID_NAME) ? getHeader(message, Trace.SPAN_ID_NAME, Long.class) : new Random().nextLong(); long traceId = getHeader(message, Trace.TRACE_ID_NAME, Long.class); MilliSpan.MilliSpanBuilder span = MilliSpan.builder().traceId(traceId).spanId(spanId); Long parentId = getHeader(message, Trace.PARENT_ID_NAME, Long.class); if (message.getHeaders().containsKey(Trace.NOT_SAMPLED_NAME)) { span.exportable(false); } String processId = getHeader(message, Trace.PROCESS_ID_NAME); String spanName = getHeader(message, Trace.SPAN_NAME_NAME); if (spanName != null) { span.name(spanName); } if (processId != null) { span.processId(processId); } if (parentId != null) { span.parent(parentId); } span.remote(true); return span.build(); }

Target:
Span buildSpan(Message<?> message) { if (!hasHeader(message, Trace.TRACE_ID_NAME) || !hasHeader(message, Trace.SPAN_ID_NAME)) { return null; } long spanId = hasHeader(message, Trace.SPAN_ID_NAME) ? getHeader(message, Trace.SPAN_ID_NAME, Long.class) : random.nextLong(); long traceId = getHeader(message, Trace.TRACE_ID_NAME, Long.class); MilliSpan.MilliSpanBuilder span = MilliSpan.builder().traceId(traceId).spanId(spanId); Long parentId = getHeader(message, Trace.PARENT_ID_NAME, Long.class); if (message.getHeaders().containsKey(Trace.NOT_SAMPLED_NAME)) { span.exportable(false); } String processId = getHeader(message, Trace.PROCESS_ID_NAME); String spanName = getHeader(message, Trace.SPAN_NAME_NAME); if (spanName != null) { span.name(spanName); } if (processId != null) { span.processId(processId); } if (parentId != null) { span.parent(parentId); } span.remote(true); return span.build(); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/ambientocclusionpasses"); if (renderingConfig.isSsao()) { sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); ssaoBlurredFBO = frameBuffersManager.getFBO("ssaoBlurred"); ssaoFBO = frameBuffersManager.getFBO("ssao"); generateSSAO(); generateBlurredSSAO(); } PerformanceMonitor.endActivity(); }

Target:
public void process() { if (renderingConfig.isSsao()) { PerformanceMonitor.startActivity("rendering/ambientocclusionpasses"); sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); ssaoBlurredFBO = frameBuffersManager.getFBO("ssaoBlurred"); ssaoFBO = frameBuffersManager.getFBO("ssao"); generateSSAO(); generateBlurredSSAO(); PerformanceMonitor.endActivity(); } }
Source:
protected boolean filterInitiator(String variableName, String variableValue, String initiator) { if (variableName.equals("initiator") && variableValue.equals(initiator)) { return true; } return false; }

Target:
protected boolean filterInitiator(String variableName, String variableValue, String initiator) { return variableName.equals("initiator") && variableValue.equals(initiator); }
Source:
private boolean isConstraintFromObjectDomain(@Nullable Constraint constraint) { return constraint != null && constraint.getClass().isAssignableFrom(ObjectConstraint.class); }

Target:
private boolean isConstraintFromObjectDomain(@Nullable Constraint constraint) { return constraint instanceof ObjectConstraint; }
Source:
public void beginRequest(HttpClientRequestImpl req) { synchronized (conn) { if (request != null) { throw new IllegalStateException("Already writing a request"); } if (conn.requestInProgress != this) { throw new IllegalStateException("Connection is already writing another request"); } request = req; if (conn.metrics != null) { Object reqMetric = conn.metrics.requestBegin(conn.endpointMetric, conn.metric(), conn.localAddress(), conn.remoteAddress(), request); request.metric(reqMetric); } VertxTracer tracer = context.tracer(); if (tracer != null) { List<Map.Entry<String, String>> tags = new ArrayList<>(); tags.add(new AbstractMap.SimpleEntry<>("http.url", req.absoluteURI())); tags.add(new AbstractMap.SimpleEntry<>("http.method", req.method().name())); BiConsumer<String, String> headers = (key, val) -> req.headers().add(key, val); trace = tracer.sendRequest(request.stream.getContext(), request, request.method.name(), headers, tags); } } }

Target:
public void beginRequest(HttpClientRequestImpl req) { synchronized (conn) { if (request != null) { throw new IllegalStateException("Already writing a request"); } if (conn.requestInProgress != this) { throw new IllegalStateException("Connection is already writing another request"); } request = req; if (conn.metrics != null) { Object reqMetric = conn.metrics.requestBegin(conn.endpointMetric, conn.metric(), conn.localAddress(), conn.remoteAddress(), request); request.metric(reqMetric); } VertxTracer tracer = context.tracer(); if (tracer != null) { List<Map.Entry<String, String>> tags = new ArrayList<>(); tags.add(new AbstractMap.SimpleEntry<>("http.url", req.absoluteURI())); tags.add(new AbstractMap.SimpleEntry<>("http.method", req.method().name())); BiConsumer<String, String> headers = (key, val) -> req.headers().add(key, val); trace = tracer.sendRequest(request.stream.getContext(), request, request.method.name(), headers, HttpUtils.CLIENT_REQUEST_TAG_EXTRACTOR); } } }
Source:
public void close(Handler<AsyncResult<Void>> completionHandler) { super.close(ar1 -> { if (server != null) { server.close(ar -> { if (ar.failed()) { log.error("Failed to close server", ar.cause()); } for (ConnectionHolder holder: connections.values()) { holder.close(); } completionHandler.handle(ar); }); } else { completionHandler.handle(ar1); } }); }

Target:
public void close(Handler<AsyncResult<Void>> completionHandler) { super.close(ar1 -> { if (server != null) { server.close(ar -> { if (ar.failed()) { log.error("Failed to close server", ar.cause()); } for (ConnectionHolder holder: connections.values()) { holder.close(); } if (completionHandler != null) { completionHandler.handle(ar); } }); } else { if (completionHandler != null) { completionHandler.handle(ar1); } } }); }
Source:
DirectlyDerivedClassesMarker(@Nonnull List<JDefinedClass> directlyDerivedClasses) { this.directlyDerivedClasses = Collections.unmodifiableList( new ArrayList<>(directlyDerivedClasses)); }

Target:
DirectlyDerivedClassesMarker(@Nonnull List<JDefinedClass> directlyDerivedClasses) { this.directlyDerivedClasses = Jack.getUnmodifiableCollections().getUnmodifiableList( new ArrayList<>(directlyDerivedClasses)); }
Source:
public Quat4f getOrientation() { return new Quat4f(from(viewingAxis), viewingAngle); }

Target:
public Quat4f getOrientation() { return new Quat4f(JomlUtil.from(viewingAxis), viewingAngle); }
Source:
public Builder charSet( String charset ) { bundle.setCharset( charset ); return this; }

Target:
public Builder charSet( String charset ) { bundle.setCharSet( charset ); return this; }
Source:
private String addLinkToDescription(final PostsCreator postsCreator, final String description) throws MalformedURLException { final String url = "<LINK_0>"; String text = description + " <LINK_0>"; postsCreator.addDescriptionWith(new URL(url)); return text; }

Target:
private String addLinkToDescription(final PostsCreator postsCreator, final String description) throws MalformedURLException { String text = description + " " + WIKIA_URL; postsCreator.addDescriptionWith(new URL(WIKIA_URL)); return text; }
Source:
public Set<TopicPartition> getTopicPartitions() { return Collections.unmodifiableSet(_topicPartitions); }

Target:
public Map<String, Set<Integer>> getTopicPartitions() { return Collections.unmodifiableMap(_topicPartitions); }
Source:
private static Map<MethodDescriptor<?, ?>, Predicate<?>> createMethodRetryMap() { Predicate<MutateRowRequest> retryMutationsWithTimestamps = new Predicate<MutateRowRequest>() { @Override public boolean apply(@Nullable MutateRowRequest mutateRowRequest) { return mutateRowRequest != null && !hasMissingTimeStamp(mutateRowRequest.getMutationsList()); } }; Predicate<CheckAndMutateRowRequest> retryCheckAndMutateWithTimestamps = new Predicate<CheckAndMutateRowRequest>() { @Override public boolean apply(@Nullable CheckAndMutateRowRequest checkAndMutateRowRequest) { return checkAndMutateRowRequest != null && !hasMissingTimeStamp(checkAndMutateRowRequest.getTrueMutationsList()) && !hasMissingTimeStamp(checkAndMutateRowRequest.getFalseMutationsList()); } }; return ImmutableMap.<MethodDescriptor<?, ?>, Predicate<?>>builder() .put(BigtableServiceGrpc.METHOD_MUTATE_ROW, retryMutationsWithTimestamps) .put(BigtableServiceGrpc.METHOD_CHECK_AND_MUTATE_ROW, retryCheckAndMutateWithTimestamps) .build(); }

Target:
private static Map<MethodDescriptor<?, ?>, Predicate<?>> createMethodRetryMap() { Predicate<MutateRowRequest> retryMutationsWithTimestamps = new Predicate<MutateRowRequest>() { @Override public boolean apply(@Nullable MutateRowRequest mutateRowRequest) { return mutateRowRequest != null && allCellsHaveTimestamps(mutateRowRequest.getMutationsList()); } }; Predicate<CheckAndMutateRowRequest> retryCheckAndMutateWithTimestamps = new Predicate<CheckAndMutateRowRequest>() { @Override public boolean apply(@Nullable CheckAndMutateRowRequest checkAndMutateRowRequest) { return checkAndMutateRowRequest != null && allCellsHaveTimestamps(checkAndMutateRowRequest.getTrueMutationsList()) && allCellsHaveTimestamps(checkAndMutateRowRequest.getFalseMutationsList()); } }; return ImmutableMap.<MethodDescriptor<?, ?>, Predicate<?>>builder() .put(BigtableServiceGrpc.METHOD_MUTATE_ROW, retryMutationsWithTimestamps) .put(BigtableServiceGrpc.METHOD_CHECK_AND_MUTATE_ROW, retryCheckAndMutateWithTimestamps) .build(); }
Source:
private boolean getDirectTestFlag(String fileName, String property) { boolean directTestFlag = false; String directTestingFlag = getDirectTestingParam(fileName, property); if (directTestingFlag.equals("true")) { directTestFlag = true; } return directTestFlag; }

Target:
private boolean getDirectTestFlag(String fileName, String property) { boolean directTestFlag = false; String directTestingFlag = getDirectTestingParam(fileName, property); if (directTestingFlag != null && !directTestingFlag.isEmpty() && directTestingFlag.equals("true")) { directTestFlag = true; } return directTestFlag; }
Source:
public static ZipFileApplicationDetails getAppDetails(File applicationFile) throws ApplicationServiceException { ZipFile appZip = null; try { appZip = new ZipFile(applicationFile); logger.debug("Extracting version and application name from zipfile {}.", applicationFile.getAbsolutePath()); ZipEntry featureFileEntry = getFeatureFile(appZip); ZipFileApplicationDetails details = getAppDetailsFromFeature(appZip, featureFileEntry); return details; } catch (ZipException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } catch (IOException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } catch (ParserConfigurationException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } catch (SAXException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } finally { try { IOUtils.close(appZip); } catch (IOException e) { logger.warn("Unable to close zip stream.", e); } } }

Target:
public static ZipFileApplicationDetails getAppDetails(File applicationFile) throws ApplicationServiceException { ZipFile appZip = null; try { appZip = new ZipFile(applicationFile); logger.debug("Extracting version and application name from zipfile {}.", applicationFile.getAbsolutePath()); ZipEntry featureFileEntry = getFeatureFile(appZip); ZipFileApplicationDetails details = getAppDetailsFromFeature(appZip, featureFileEntry); return details; } catch (ZipException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } catch (IOException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } catch (ParserConfigurationException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } catch (SAXException e) { throw new ApplicationServiceException( "Could not get application details of the provided zipfile.", e); } finally { IOUtils.closeQuietly(appZip); } }
Source:
public String toString() { return "ActorMapping{" + "actors=" + actors + '}'; }

Target:
public String toString() { return new ToStringBuilder(this) .append("actors", actors) .toString(); }
Source:
public long getRetainedSizeInBytes() { long retainedSizeInBytes = 0; if (booleanStatistics != null) { retainedSizeInBytes += booleanStatistics.getRetainedSizeInBytes(); } if (integerStatistics != null) { retainedSizeInBytes += integerStatistics.getRetainedSizeInBytes(); } if (doubleStatistics != null) { retainedSizeInBytes += doubleStatistics.getRetainedSizeInBytes(); } if (stringStatistics != null) { retainedSizeInBytes += stringStatistics.getRetainedSizeInBytes(); } if (dateStatistics != null) { retainedSizeInBytes += dateStatistics.getRetainedSizeInBytes(); } if (decimalStatistics != null) { retainedSizeInBytes += decimalStatistics.getRetainedSizeInBytes(); } if (binaryStatistics != null) { retainedSizeInBytes += binaryStatistics.getRetainedSizeInBytes(); } if (bloomFilter != null) { retainedSizeInBytes += bloomFilter.getRetainedSizeInBytes(); } return retainedSizeInBytes + INSTANCE_SIZE; }

Target:
public long getRetainedSizeInBytes() { long retainedSizeInBytes = INSTANCE_SIZE; if (booleanStatistics != null) { retainedSizeInBytes += booleanStatistics.getRetainedSizeInBytes(); } if (integerStatistics != null) { retainedSizeInBytes += integerStatistics.getRetainedSizeInBytes(); } if (doubleStatistics != null) { retainedSizeInBytes += doubleStatistics.getRetainedSizeInBytes(); } if (stringStatistics != null) { retainedSizeInBytes += stringStatistics.getRetainedSizeInBytes(); } if (dateStatistics != null) { retainedSizeInBytes += dateStatistics.getRetainedSizeInBytes(); } if (decimalStatistics != null) { retainedSizeInBytes += decimalStatistics.getRetainedSizeInBytes(); } if (binaryStatistics != null) { retainedSizeInBytes += binaryStatistics.getRetainedSizeInBytes(); } if (bloomFilter != null) { retainedSizeInBytes += bloomFilter.getRetainedSizeInBytes(); } return retainedSizeInBytes; }
Source:
public GithubUrl parse(String url) { Matcher matcher = GITHUB_PATTERN.matcher(url); if (!matcher.matches()) { throw new IllegalArgumentException( String.format( "The given github url %s is not a valid URL github url. It should start with <LINK_0><user>/<repo>", url)); } String repoUser = matcher.group("repoUser"); String repoName = matcher.group("repoName"); if (repoName.matches("[\\w-][\\w.-]*?.git$")) { repoName = repoName.substring(0, repoName.length() - 4); } String branchName = matcher.group("branchName"); String pullRequestId = matcher.group("pullRequestId"); if (pullRequestId != null) { String prData = this.urlFetcher.fetchSafely(url); Matcher prMatcher = PR_DATA_PATTERN.matcher(prData); if (prMatcher.matches()) { String prState = prMatcher.group("prState"); if (!"open".equalsIgnoreCase(prState)) { throw new IllegalArgumentException( String.format( "The given Pull Request url %s is not Opened, (found %s), thus it can't be opened as branch may have been removed.", url, prState)); } repoUser = prMatcher.group("prRepoUser"); repoName = prMatcher.group("prRepoName"); branchName = prMatcher.group("prBranch"); } else { throw new IllegalArgumentException( String.format( "The given Pull Request github url %s is not a valid Pull Request URL github url. Unable to extract the data", url)); } } return new GithubUrl() .withUsername(repoUser) .withRepository(repoName) .withBranch(branchName) .withSubfolder(matcher.group("subFolder")) .withDevfileFilename("devfile.yaml") .withFactoryFilename(".factory.json"); }

Target:
public GithubUrl parse(String url) { Matcher matcher = GITHUB_PATTERN.matcher(url); if (!matcher.matches()) { throw new IllegalArgumentException( String.format( "The given github url %s is not a valid URL github url. It should start with <LINK_0><user>/<repo>", url)); } String repoUser = matcher.group("repoUser"); String repoName = matcher.group("repoName"); if (repoName.matches("^[\\w-][\\w.-]*?\\.git$")) { repoName = repoName.substring(0, repoName.length() - 4); } String branchName = matcher.group("branchName"); String pullRequestId = matcher.group("pullRequestId"); if (pullRequestId != null) { String prData = this.urlFetcher.fetchSafely(url); Matcher prMatcher = PR_DATA_PATTERN.matcher(prData); if (prMatcher.matches()) { String prState = prMatcher.group("prState"); if (!"open".equalsIgnoreCase(prState)) { throw new IllegalArgumentException( String.format( "The given Pull Request url %s is not Opened, (found %s), thus it can't be opened as branch may have been removed.", url, prState)); } repoUser = prMatcher.group("prRepoUser"); repoName = prMatcher.group("prRepoName"); branchName = prMatcher.group("prBranch"); } else { throw new IllegalArgumentException( String.format( "The given Pull Request github url %s is not a valid Pull Request URL github url. Unable to extract the data", url)); } } return new GithubUrl() .withUsername(repoUser) .withRepository(repoName) .withBranch(branchName) .withSubfolder(matcher.group("subFolder")) .withDevfileFilename("devfile.yaml") .withFactoryFilename(".factory.json"); }
Source:
private void addSearchView(Menu menu) { MenuItem searchAction = menu.add(0, Menu.NONE, Menu.NONE, getString(R.string.search_hint)); MenuItemCompat.setShowAsAction(searchAction , MenuItemCompat.SHOW_AS_ACTION_ALWAYS); SearchView searchView = new SearchView(getActivity()); searchView.setFocusable(true); searchView.requestFocusFromTouch(); SearchViewCompat.setOnQueryTextListener(searchView, searchQueryListener); SearchViewCompat.setOnCloseListener(searchView, searchCloseListener); SearchViewCompat.setIconified(searchView, false); SearchViewCompat.setInputType(searchView, EditorInfo.TYPE_CLASS_TEXT); SearchViewCompat.setImeOptions(searchView, EditorInfo.IME_ACTION_GO); SearchViewCompat.setSubmitButtonEnabled(searchView, true); SearchViewCompat.setQueryHint(searchView, getString(R.string.search_hint)); if (TextUtils.getTrimmedLength(lastSearchedText) > 0) { SearchViewCompat.setQuery(searchView, lastSearchedText, false); } MenuItemCompat.setActionView(searchAction, searchView); }

Target:
private void addSearchView(Menu menu) { MenuItem searchAction = menu.add(0, Menu.NONE, Menu.NONE, getString(R.string.search_hint)); MenuItemCompat.setShowAsAction(searchAction , MenuItemCompat.SHOW_AS_ACTION_ALWAYS); SearchView searchView = new SearchView(getActivity()); searchView.setFocusable(true); searchView.requestFocusFromTouch(); searchView.setOnQueryTextListener(searchQueryListener); searchView.setOnCloseListener(searchCloseListener); searchView.setIconified(false); searchView.setInputType(EditorInfo.TYPE_CLASS_TEXT); searchView.setImeOptions(EditorInfo.IME_ACTION_GO); searchView.setSubmitButtonEnabled(true); searchView.setQueryHint(getString(R.string.search_hint)); if (isValidQuery(lastSearchedText)) { searchView.setQuery(lastSearchedText, false); } MenuItemCompat.setActionView(searchAction, searchView); }
Source:
public void afterCommit( TransactionData data, Object state ) { try { List<BinaryLatch> completions = new ArrayList<>(); for ( WritableFulltext nodeIndex : fulltextProvider.writableNodeIndices() ) { Map<Long,Map<String,Object>> nodeMap = ((Map<Long,Map<String,Object>>[]) state)[0]; completions.add( applier.removePropertyData( data.removedNodeProperties(), nodeMap, nodeIndex ) ); completions.add( applier.updatePropertyData( nodeMap, nodeIndex ) ); } for ( WritableFulltext relationshipIndex : fulltextProvider.writableRelationshipIndices() ) { Map<Long,Map<String,Object>> relationshipMap = ((Map<Long,Map<String,Object>>[]) state)[1]; completions.add( applier.removePropertyData( data.removedRelationshipProperties(), relationshipMap, relationshipIndex ) ); completions.add( applier.updatePropertyData( relationshipMap, relationshipIndex ) ); } for ( BinaryLatch completion : completions ) { completion.await(); } } catch ( IOException e ) { log.error( "Unable to update fulltext index", e ); } }

Target:
public void afterCommit( TransactionData data, Object state ) { try { List<AsyncFulltextIndexOperation> completions = new ArrayList<>(); Map<Long,Map<String,Object>> nodeMap = ((Map<Long,Map<String,Object>>[]) state)[0]; Map<Long,Map<String,Object>> relationshipMap = ((Map<Long,Map<String,Object>>[]) state)[1]; for ( WritableFulltext nodeIndex : fulltextProvider.writableNodeIndices() ) { completions.add( applier.removePropertyData( data.removedNodeProperties(), nodeMap, nodeIndex ) ); completions.add( applier.updatePropertyData( nodeMap, nodeIndex ) ); } for ( WritableFulltext relationshipIndex : fulltextProvider.writableRelationshipIndices() ) { completions.add( applier.removePropertyData( data.removedRelationshipProperties(), relationshipMap, relationshipIndex ) ); completions.add( applier.updatePropertyData( relationshipMap, relationshipIndex ) ); } for ( AsyncFulltextIndexOperation completion : completions ) { completion.awaitCompletion(); } } catch ( IOException e ) { log.error( "Unable to update fulltext index", e ); } }
Source:
public static Expression values(DataType type, Collection<? extends Object> values) { switch (type) { case STRING: return matchAny(Fields.STRING_VALUE, Iterables.filter(values, String.class)); case INTEGER: return matchAnyInt(Fields.INTEGER_VALUE, FluentIterable.from(values).filter(Integer.class).toSet()); case DECIMAL: return matchAnyDecimal(Fields.DECIMAL_VALUE, FluentIterable.from(values).filter(BigDecimal.class).toSet()); default: throw new UnsupportedOperationException("Unsupported data type when filtering by values, " + type); } }

Target:
public static Expression values(DataType type, Collection<? extends Object> values) { switch (type) { case STRING: return matchAny(Fields.STRING_VALUE, FluentIterable.from(values).filter(String.class).toSet()); case INTEGER: return matchAnyInt(Fields.INTEGER_VALUE, FluentIterable.from(values).filter(Integer.class).toSet()); case DECIMAL: return matchAnyDecimal(Fields.DECIMAL_VALUE, FluentIterable.from(values).filter(BigDecimal.class).toSet()); default: throw new UnsupportedOperationException("Unsupported data type when filtering by values, " + type); } }
Source:
public void scenario(Scenario scenario) { logDiv("Scenario: " + scenario.getName(), "scenario"); }

Target:
public void scenario(Scenario scenario) { logDiv(scenario.getKeyword(), scenario.getName(), "scenario"); }
Source:
public void drain(Duration optionalTimeout, boolean includePrimary, boolean throwFirstError) { try { dstJob.join(includePrimary, optionalTimeout); } catch (InterruptedException e) { Throwables.propagate(e); } if (throwFirstError) { if (isError()) getUnchecked(); for (Task<?> t: getQueue()) if (t.isError() && !TaskTags.isInessential(t)) t.getUnchecked(); } }

Target:
public void drain(Duration optionalTimeout, boolean includePrimary, boolean throwFirstError) { try { dstJob.join(includePrimary, optionalTimeout); } catch (InterruptedException e) { throw Exceptions.propagate(e); } if (throwFirstError) { if (isError()) getUnchecked(); for (Task<?> t: getQueue()) if (t.isError() && !TaskTags.isInessential(t)) t.getUnchecked(); } }
Source:
public Set<ConfigOption<?>> optionalOptions() { final Set<ConfigOption<?>> options = new HashSet<>(); options.add(PROPS_GROUP_ID); options.add(SCAN_STARTUP_MODE); options.add(SCAN_STARTUP_SPECIFIC_OFFSETS); options.add(SCAN_STARTUP_TIMESTAMP_MILLIS); options.add(SINK_PARTITIONER); return options; }

Target:
public Set<ConfigOption<?>> optionalOptions() { final Set<ConfigOption<?>> options = super.optionalOptions(); options.remove(SINK_SEMANTIC); return options; }
Source:
public static String createActionBlocker(ZooKeeper zk, String node, CreateMode mode, VoltLogger hostLog, String request) { ZooKeeperLock lock = new ZooKeeperLock(zk, VoltZK.actionBlockers, "lock"); try { lock.acquireLock(); return setActionBlocker(zk, node, mode, hostLog, request); } catch (IOException e) { VoltDB.crashLocalVoltDB("Unable to create action blocker " + node, true, e); } finally { try { lock.releaseLock(); } catch (IOException e) } return null; }

Target:
public static String createActionBlocker(ZooKeeper zk, String node, CreateMode mode, VoltLogger hostLog, String request) { ZooKeeperLock zklock = new ZooKeeperLock(zk, VoltZK.actionLock, "lock"); String lockingMessage = null; try { if(!zklock.acquireLockWithTimeout(TimeUnit.SECONDS.toMillis(60))) { lockingMessage = "Could not acquire a lock to create action blocker:" + request; } else { lockingMessage = setActionBlocker(zk, node, mode, hostLog, request); } } finally { try { zklock.releaseLock(); } catch (IOException e) } return lockingMessage; }
Source:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { try { Map<TypeElement, List<ExecutableElement>> providerMethods = providerMethodsByClass(env); for (Map.Entry<String, List<ExecutableElement>> module : delayedTypes.entrySet()) { providerMethods.put( processingEnv.getElementUtils().getTypeElement(module.getKey()), module.getValue()); } for (Map.Entry<TypeElement, List<ExecutableElement>> module : providerMethods.entrySet()) { TypeElement type = module.getKey(); String providesName = type.asType().toString(); try { Map<String, Object> parsedAnnotation = CodeGen.getAnnotation(Module.class, type); writeModuleAdapter(type, parsedAnnotation, module.getValue()); delayedTypes.remove(providesName); } catch (IllegalStateException e) { delayedTypes.put(providesName, module.getValue()); } } } catch (IOException e) { error("Code gen failed: " + e); } if (env.processingOver() && delayedTypes.size() > 0) { error("Could not find types required by provides methods for %s", delayedTypes.keySet() .toString()); } return true; }

Target:
@Override public boolean process(Set<? extends TypeElement> types, RoundEnvironment env) { try { remainingTypes.putAll(providerMethodsByClass(env)); for (Iterator<String> i = remainingTypes.keySet().iterator(); i.hasNext();) { String typeName = i.next(); TypeElement type = processingEnv.getElementUtils().getTypeElement(typeName); List<ExecutableElement> providesTypes = remainingTypes.get(typeName); try { Map<String, Object> parsedAnnotation = CodeGen.getAnnotation(Module.class, type); writeModuleAdapter(type, parsedAnnotation, providesTypes); i.remove(); } catch (IllegalStateException e) { } } } catch (IOException e) { error("Code gen failed: " + e); } if (env.processingOver() && remainingTypes.size() > 0) { error("Could not find types required by provides methods for %s", remainingTypes.keySet() .toString()); } return true; }
Source:
public void tickCubeServer(BooleanSupplier tryToTickFaster, Random rand) { if (!isFullyPopulated) { return; } tickCubeCommon(tryToTickFaster); while (!pendingTickListEntriesTreeSet.isEmpty()) { assert storage != null : "There are blocks to tick in cube but getStorage() is empty!"; NextTickListEntry ntle = pendingTickListEntriesTreeSet.first(); if (ntle.scheduledTime > world.getTotalWorldTime()) return; BlockPos pos = ntle.position; IBlockState iblockstate = this.storage.get(blockToLocal(pos.getX()), blockToLocal(pos.getY()), blockToLocal(pos.getZ())); if (iblockstate.getMaterial() != Material.AIR && iblockstate.getBlock() == ntle.getBlock()) { iblockstate.getBlock().updateTick((WorldServer) world, ntle.position, iblockstate, rand); } pendingTickListEntriesTreeSet.remove(ntle); pendingTickListEntriesHashSet.remove(ntle); } }

Target:
public void tickCubeServer(BooleanSupplier tryToTickFaster, Random rand) { if (!isFullyPopulated) { return; } tickCubeCommon(tryToTickFaster); Iterator<NextTickListEntry> pti = pendingTickListEntriesTreeSet.iterator(); while (pti.hasNext()) { assert storage != null : "There are blocks to tick in cube but getStorage() is empty!"; NextTickListEntry ntle = pti.next(); if (ntle.scheduledTime > world.getTotalWorldTime()) break; BlockPos pos = ntle.position; IBlockState iblockstate = this.storage.get(blockToLocal(pos.getX()), blockToLocal(pos.getY()), blockToLocal(pos.getZ())); if (iblockstate.getMaterial() != Material.AIR && iblockstate.getBlock() == ntle.getBlock()) { iblockstate.getBlock().updateTick((WorldServer) world, ntle.position, iblockstate, rand); } pti.remove(); } int tickLimit = 256; pti = pendingTickListEntriesHashSet.iterator(); while (pti.hasNext() && --tickLimit != 0) { NextTickListEntry ntle = pti.next(); pendingTickListEntriesTreeSet.add(ntle); pti.remove(); } }
Source:
public FeatureVector[] classify(Object[] examples) { if (!(examples instanceof Word[])) { String type = examples == null ? "null" : examples.getClass().getName(); logger.error("Classifier 'WordTypeInformation(Word)' defined on line 71 of CommonFeatures.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } return super.classify(examples); }

Target:
public FeatureVector[] classify(Object[] examples) { if (!(examples instanceof Word[])) { String type = examples == null ? "null" : examples.getClass().getName(); System.err.println("Classifier 'WordTypeInformation(Word)' defined on line 71 of CommonFeatures.lbj received '" + type + "' as input."); new Exception().printStackTrace(); System.exit(1); } return super.classify(examples); }
Source:
private void register(Set<CommandType> commandTypes) { for (CommandType type : commandTypes) { final String id = type.getId(); if (this.commandTypes.containsKey(id)) { Log.warn(CommandTypeRegistryImpl.class, "Command type with ID " + id + " is already registered."); } else { this.commandTypes.put(id, type); } } }

Target:
private void register(Set<CommandType> commandTypes) { for (CommandType type : commandTypes) { final String id = type.getId(); if (this.commandTypes.containsKey(id)) { Log.warn(getClass(), "Command type with ID " + id + " is already registered."); } else { this.commandTypes.put(id, type); } } }
Source:
private static boolean isGenericBeforeCtor(DetailAST ast) { return ast.getParent().getParent().getType() == TokenTypes.LITERAL_NEW && ast.getParent().getNextSibling().getType() == TokenTypes.IDENT; }

Target:
private static boolean isGenericBeforeCtor(DetailAST ast) { final DetailAST parent = ast.getParent(); return parent.getParent().getType() == TokenTypes.LITERAL_NEW && (parent.getNextSibling().getType() == TokenTypes.IDENT || parent.getNextSibling().getType() == TokenTypes.DOT); }
Source:
public ClouderaManagerParcelStatusListenerTask(ClouderaManagerApiPojoFactory clouderaManagerApiPojoFactory, CloudbreakEventService cloudbreakEventService, Map<String, String> parcelVersions, ParcelStatus parcelStatus) { super(clouderaManagerApiPojoFactory, cloudbreakEventService); this.parcelVersion = parcelVersions; this.parcelStatus = parcelStatus; }

Target:
public ClouderaManagerParcelStatusListenerTask(ClouderaManagerApiPojoFactory clouderaManagerApiPojoFactory, CloudbreakEventService cloudbreakEventService, Map<String, String> parcelVersions, ParcelStatus parcelStatus) { super(clouderaManagerApiPojoFactory, cloudbreakEventService); this.parcelVersions = parcelVersions; this.parcelStatus = parcelStatus; }
Source:
public static WebDriver getWebDriverFirefox() { return driver2; }

Target:
public static WebDriver getWebDriverFirefox() { return driverFF; }
Source:
private void push(Candidate toInsert) { boolean isNew = toInsert.add(SEEN); if (!isNew) { for (Candidate p = queue;; p = p.queueNext) { if (p.sourceCommit.equals(toInsert.sourceCommit)) { p.regionList = Region.merge(p.regionList, toInsert.regionList); return; } } } int time = toInsert.getTime(); Candidate n = queue; if (n == null || time > n.getTime() || (time == n.getTime() && isAncestor(n.sourceCommit, toInsert.sourceCommit))) { toInsert.queueNext = n; queue = toInsert; return; } for (Candidate p = n;; p = n) { n = p.queueNext; if (n == null || time > n.getTime() || (time == n.getTime() && isAncestor(n.sourceCommit, toInsert.sourceCommit))) { toInsert.queueNext = n; p.queueNext = toInsert; return; } } }

Target:
private void push(Candidate toInsert) { boolean isNew = toInsert.add(SEEN); if (!isNew) { for (Candidate p = queue; p != null; p = p.queueNext) { if (p.sourceCommit.equals(toInsert.sourceCommit)) { p.regionList = Region.merge(p.regionList, toInsert.regionList); return; } } } int time = toInsert.getTime(); Candidate n = queue; if (n == null || time >= n.getTime()) { toInsert.queueNext = n; queue = toInsert; return; } for (Candidate p = n;; p = n) { n = p.queueNext; if (n == null || time >= n.getTime()) { toInsert.queueNext = n; p.queueNext = toInsert; return; } } }
Source:
public JavaWriter beginAnonymousInnerClass(String referenceType, String name, Set<Modifier> modifiers, String declaredType) throws IOException { indent(); if (modifiers != null) { emitModifiers(modifiers); } if (referenceType != null) { out.write(referenceType); out.write(" "); } if (name != null) { out.write(name); out.write(" = "); } out.write("new "); out.write(declaredType); out.write("() {\n"); pushScope(Scope.ANONYMOUS_INNER_CLASS); return this; }

Target:
public JavaWriter beginAnonymousInnerClass(String referenceType, String name, Set<Modifier> modifiers, String declaredType) throws IOException { indent(); if (modifiers != null) { emitModifiers(modifiers); } if (referenceType != null) { out.write(referenceType); out.write(" "); } if (name != null) { out.write(name); out.write(" = "); } out.write("new "); out.write(declaredType); out.write("() {\n"); scopes.push(Scope.ANONYMOUS_INNER_CLASS); return this; }
Source:
public static void createMissingHistoricVariables(PvmExecutionImpl execution) { Collection<VariableInstanceEntity> variables = ((ExecutionEntity) execution).getVariablesInternal(); if (variables != null && variables.size() > 0) { for (VariableInstanceEntity variable : variables) { if (variable.getProcessDefinitionId() == null && getHistoryLevel().isHistoryEventProduced(HistoryEventTypes.VARIABLE_INSTANCE_CREATE, variable)) { VariableInstanceHistoryListener.INSTANCE.onCreate(variable, variable.getExecution()); } } } }

Target:
public static void createMissingHistoricVariables(PvmExecutionImpl execution) { Collection<VariableInstanceEntity> variables = ((ExecutionEntity) execution).getVariablesInternal(); if (variables != null && variables.size() > 0) { for (VariableInstanceEntity variable : variables) { if (variable.wasCreatedBefore713()) { VariableInstanceHistoryListener.INSTANCE.onCreate(variable, variable.getExecution()); } } } }
Source:
public void apply(RequestTemplate template) { if (tokenExists(oAuth2ClientContext)) { logger.debug("Applying RequestInterceptor customization"); template.header(header, value(tokenType)); } }

Target:
public void apply(RequestTemplate template) { template.header(header, extract(tokenType)); }
Source:
public void viewUserProfile_shouldPass() throws Exception { User user = Users.signUpAndSignIn(); Users.viewProfile(user); Users.viewProfile(); }

Target:
public void viewUserProfile_shouldPass() throws Exception { User user = Users.signUpAndSignIn(); Users.viewProfile(user); }
Source:
protected void endWithFailure() { setSucceeded(false); log(); }

Target:
protected void endWithFailure() { setSucceeded(true); log(); }
Source:
public void email(final String email, final String link) throws IOException { this.email(email); try { this.postman.send( new Envelope.MIME() .with(new StSubject("Netbout email verification")) .with( new StRecipient( email.substring(email.indexOf('!') + 1) ) ) .with( new EnHTML( StringUtils.join( new Markdown.Default().html( StringUtils.join( "Hi,<br/>Your notification e-mail ", "address for [netbout](http://", "www.netbout.com) has been changed. ", "Please verify it by clicking ", "[here](", link, ")." ) ), "If you did not change your e-mail address ", "you can ignore this message <br/>", "This is an automated e-mail, please ", "do not reply. If you have any questions, ", "submit an issue <a href=\"", "<LINK_0>\"", ">here</a><br/><br/> Best regards,<br/>", "Netbout team" ) ) ) ); } catch (final IOException exc) { throw new IOException( "Exception while sending the verification email ", exc ); } }

Target:
public void email(final String email, final String link) throws IOException { this.email(email); try { this.postman.send( new Envelope.MIME() .with(new StSubject("Netbout email verification")) .with( new StRecipient( email.substring(email.indexOf('!') + 1) ) ) .with( new EnHTML( StringUtils.join( new Markdown.Default().html( StringUtils.join( "Hi,<br/>Your notification e-mail ", "address for [netbout](http://", "www.netbout.com) has been changed. ", "Please verify it by clicking ", "[here](", link, ")." ) ), "If you did not change your e-mail address ", "you can ignore this message <br/>", "This is an automated e-mail, please ", "do not reply. If you have any questions, ", "submit an issue <a href=\"", EmAlias.NETBOUT_GITHUB, "\">here</a><br/><br/> Best regards,<br/>", "Netbout team" ) ) ) ); } catch (final IOException exc) { throw new IOException( "Exception while sending the verification email.", exc ); } }
Source:
public void beforeMethod() throws Exception { super.beforeMethod(); subscriptionCatalog = new SubscriptionCatalog(catalog, clock); }

Target:
public void beforeMethod() throws Exception { if (hasFailed()) { return; } super.beforeMethod(); currentVersion = catalog.versionForDate(clock.getUTCNow()); }
Source:
public MessagePacker writePayload(ByteBuffer src) throws IOException { if(src.remaining() >= FLUSH_THRESHOLD) { out.flush(buffer, 0, position); position = 0; MessageBuffer wrapped = MessageBuffer.wrap(src); out.flush(wrapped, src.position(), src.remaining()); } else { while(src.remaining() > 0) { if(position >= buffer.size()) flush(); int writeLen = Math.min(buffer.size() - position, src.remaining()); buffer.putByteBuffer(position, src, writeLen); position += writeLen; src.position(src.position() + writeLen); } } return this; }

Target:
public MessagePacker writePayload(ByteBuffer src) throws IOException { if(src.remaining() >= FLUSH_THRESHOLD) { flush(); MessageBuffer wrapped = MessageBuffer.wrap(src); out.flush(wrapped, src.position(), src.remaining()); src.position(src.limit()); } else { while(src.remaining() > 0) { if(position >= buffer.size()) flush(); int writeLen = Math.min(buffer.size() - position, src.remaining()); buffer.putByteBuffer(position, src, writeLen); position += writeLen; src.position(src.position() + writeLen); } } return this; }
Source:
private void closeOpenEditorsForProject(IProject project) { final List<IEditorReference> editorsToBeClosed = new ArrayList<>(); Map<IFile, IEditorReference> fileEditors = findAllEditorReferences(); Set<IFile> keySet = fileEditors.keySet(); for (IFile file : keySet) { if (file.getProject().equals(project)) { editorsToBeClosed.add(fileEditors.get(file)); } } if (!editorsToBeClosed.isEmpty()) { PlatformUI.getWorkbench().getDisplay() .syncExec(new Runnable() { @Override public void run() { IEditorReference[] editorToBeClosed = new IEditorReference[editorsToBeClosed .size()]; editorToBeClosed = editorsToBeClosed .toArray(editorToBeClosed); activePage.closeEditors(editorToBeClosed, true); } }); } }

Target:
private void closeOpenEditorsForProject(IProject project) { final List<IEditorReference> editorRefsToClose = new ArrayList<>(); Map<IFile, IEditorReference> fileEditors = findAllEditorReferences(); Set<IFile> keySet = fileEditors.keySet(); for (IFile file : keySet) { if (file.getProject().equals(project)) { editorRefsToClose.add(fileEditors.get(file)); } } if (editorRefsToClose.isEmpty()) { return; } PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { @Override public void run() { IEditorReference[] editorsToClose = new IEditorReference[editorRefsToClose .size()]; editorsToClose = editorRefsToClose.toArray(editorsToClose); activePage.closeEditors(editorsToClose, true); } }); }
Source:
public static Expr flatten(Expr expr) { if (expr instanceof BinaryOpExprBase) { BinaryOpExprBase binary = (BinaryOpExprBase) expr; Expr left = flatten(binary.left); Expr right = flatten(binary.right); if (Evals.isAllConstants(left, right)) { expr = Evals.toConstant(expr.eval(null)); } else if (left != binary.left || right != binary.right) { return Evals.binaryOp(binary, left, right); } } else if (expr instanceof UnaryExpr) { UnaryExpr unary = (UnaryExpr) expr; Expr eval = flatten(unary.expr); if (Evals.isConstant(eval)) { expr = Evals.toConstant(expr.eval(null)); } else if (eval != unary.expr) { if (expr instanceof UnaryMinusExpr) { expr = new UnaryMinusExpr(eval); } else { expr = new UnaryNotExpr(eval); } } } else if (expr instanceof FunctionExpr) { FunctionExpr functionExpr = (FunctionExpr) expr; List<Expr> args = functionExpr.args; boolean flattened = false; for (int i = 0; i < args.size(); i++) { Expr flatten = flatten(args.get(i)); flattened |= flatten != args.get(i); args.set(i, flatten); } if (Evals.isAllConstants(args)) { expr = Evals.toConstant(expr.eval(null)); } else if (flattened) { expr = new FunctionExpr(functionExpr.name, args); } } return expr; }

Target:
public static Expr flatten(Expr expr) { if (expr instanceof BinaryOpExprBase) { BinaryOpExprBase binary = (BinaryOpExprBase) expr; Expr left = flatten(binary.left); Expr right = flatten(binary.right); if (Evals.isAllConstants(left, right)) { expr = expr.eval(null).toExpr(); } else if (left != binary.left || right != binary.right) { return Evals.binaryOp(binary, left, right); } } else if (expr instanceof UnaryExpr) { UnaryExpr unary = (UnaryExpr) expr; Expr eval = flatten(unary.expr); if (eval instanceof ConstantExpr) { expr = expr.eval(null).toExpr(); } else if (eval != unary.expr) { if (expr instanceof UnaryMinusExpr) { expr = new UnaryMinusExpr(eval); } else if (expr instanceof UnaryNotExpr) { expr = new UnaryNotExpr(eval); } else { expr = unary; } } } else if (expr instanceof FunctionExpr) { FunctionExpr functionExpr = (FunctionExpr) expr; List<Expr> args = functionExpr.args; boolean flattened = false; List<Expr> flattening = Lists.newArrayListWithCapacity(args.size()); for (int i = 0; i < args.size(); i++) { Expr flatten = flatten(args.get(i)); flattened |= flatten != args.get(i); flattening.add(flatten); } if (Evals.isAllConstants(flattening)) { expr = expr.eval(null).toExpr(); } else if (flattened) { expr = new FunctionExpr(functionExpr.name, flattening); } } return expr; }
Source:
private NearbyLocation convert(SolrDocument doc, Geometry originalLocation) { String location = getField(doc, "location_geo", String.class); String title = Optional.ofNullable(getField(doc, "title_txt", String.class)) .filter(Objects::nonNull) .filter(s -> !"".equals(s)) .orElse("NO TITLE"); String cardinalDirection = ""; double distance = 0; try { Geometry geo = WKT_READER_THREAD_LOCAL.get().read(location); cardinalDirection = bearingToCardinalDirection(getBearing(originalLocation.getCentroid(), geo.getCentroid())); distance = originalLocation.distance(geo.getCentroid()) * KM_PER_DEGREE; } catch (org.locationtech.jts.io.ParseException e) { LOGGER.debug("Could not parse location for item (object: {})", doc.toString(), e); } return new NearbyLocationImpl(title, cardinalDirection, distance); }

Target:
private NearbyLocation convert(SolrDocument doc, Geometry originalLocation) { String location = getField(doc, LOCATION, String.class); String title = Optional.ofNullable(getField(doc, NAME, String.class)) .filter(Objects::nonNull) .filter(s -> !s.isEmpty()) .orElse("NO TITLE"); String cardinalDirection = ""; double distance = 0; try { Geometry geo = WKT_READER_THREAD_LOCAL.get().read(location); cardinalDirection = bearingToCardinalDirection(getBearing(originalLocation.getCentroid(), geo.getCentroid())); distance = convertDegreeToKilometer(originalLocation.distance(geo.getCentroid())); } catch (org.locationtech.jts.io.ParseException e) { LOGGER.debug("Could not parse location for item (object: {})", doc.toString(), e); } return new NearbyLocationImpl(title, cardinalDirection, distance); }
Source:
public void copyLogToClipboard(){ AuditLog item = getSelectedItem(); getEventBus().fireEvent(new CopyToClipboardEvent(item.toStringForLogging())); }

Target:
public void copyLogToClipboard(){ StringBuilder contents = new StringBuilder(); for (HasCopyToClipboard row : getSelectedItems()) { contents.append(row.toClipboardString()); contents.append("\n"); } ClipboardUtils.copyToClipboard(contents.toString()); }
Source:
private void cleanCache() { Reference<? extends ClassLoader> ref; while ((ref = DEAD.poll()) != null) { classLoaderCache.remove(((LoaderRef) ref).key); } }

Target:
private void cleanCache() { Reference<? extends ClassLoader> ref; while ((ref = DEAD.poll()) != null) { ObjectId key = ((LoaderRef) ref).key; if (classLoaderCache.get(key) == ref) { classLoaderCache.remove(key); } } }
Source:
public Long getIngressTimestamp() { Object result = getMessageAnnotation(AMQPMessageSupport.INGRESS_TIMESTAMP); if (result == null) { return null; } return (Long) result; }

Target:
public Long getIngressTimestamp() { return (Long) getMessageAnnotation(AMQPMessageSupport.INGRESS_TIME); }
Source:
public @Nullable Converter<?, RequestBody> requestBodyConverter( Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { if (type instanceof Class && ((Class<?>) type).isAnnotationPresent(XmlRootElement.class)) { switch (convertingMediaType) { case XML: return new JaxbXmlRequestConverter<>(contextForType((Class<?>) type), marshalProps, (Class<?>) type); case JSON: return new JaxbJsonRequestConverter<>(contextForType((Class<?>) type), marshalProps, (Class<?>) type); default: throw new IllegalArgumentException("Unsupported content type: " + convertingMediaType); } } return null; }

Target:
public @Nullable Converter<?, RequestBody> requestBodyConverter( Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) { JAXBContext context = contextForType((Class<?>) type); if (contentType.equals(XML)) { if (((Class<?>) type).isAnnotationPresent(XmlRootElement.class)) { return new JaxbXmlRequestConverter<>(context, (Class<?>) type); } } else { return new JaxbGenericRequestConverter<>(context, contentType, (Class<?>) type); } return null; }
Source:
private String getDate() { final DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ", Locale.ENGLISH); df.setTimeZone(TimeZone.getTimeZone("GMT")); return df.format(new Date()) + "GMT"; }

Target:
private String getDate() { final DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss ", Locale.US); df.setTimeZone(TimeZone.getTimeZone("GMT")); return df.format(new Date()) + "GMT"; }
Source:
private void addJdkPathToSdkProperties(String path) throws IOException { File sdkPropertiesFile = new File(Server.getServersPathFile(), SDKConstants.OPENMRS_SDK_PROPERTIES); Properties sdkProperties = getSdkProperties(); List<String> jdkPaths = getJdkPathsFromProperties(sdkProperties); if (!path.equals(System.getProperty("java.home")) && !isPathLineDuplicated(jdkPaths, path)) { if (jdkPaths.size() == 5) { jdkPaths.set(4, path); } else { jdkPaths.add(path); } Collections.sort(jdkPaths); String updatedProperty = convertListToPropertyString(jdkPaths); sdkProperties.setProperty(SDKConstants.OPENMRS_SDK_PROPERTIES_JDK_HOME, updatedProperty); savePropertiesChangesToFile(sdkProperties, sdkPropertiesFile, AVAILABLE_JDK_VERSIONS); } }

Target:
private void addJdkPathToSdkProperties(String path) { File sdkPropertiesFile = new File(Server.getServersPathFile(), SDKConstants.OPENMRS_SDK_PROPERTIES); Properties sdkProperties = null; sdkProperties = getSdkProperties(); List<String> jdkPaths = getJdkPaths(); if (!path.equals(System.getProperty("java.home")) && !isPathLineDuplicated(jdkPaths, path)) { if (jdkPaths.size() == 5) { jdkPaths.set(4, path); } else { jdkPaths.add(path); } Collections.sort(jdkPaths); String updatedProperty = convertListToPropertyString(jdkPaths); sdkProperties.setProperty(SDKConstants.OPENMRS_SDK_PROPERTIES_JDK_HOME, updatedProperty); savePropertiesChangesToFile(sdkProperties, sdkPropertiesFile, SDK_PROPERTIES_FILE); } }