auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleCloseWebSocketMessage(StatusCarbonMessage closeCarbonMessage, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Method method = new EndpointDispatcher().getOnCloseMethod(webSocketEndpoint); try { if (method != null) { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == CloseReason.class) { CloseReason.CloseCode closeCode = new CloseCodeImpl( closeCarbonMessage.getStatusCode()); CloseReason closeReason = new CloseReason( closeCode, closeCarbonMessage.getReasonText()); parameterList.add(closeReason); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } else { <START> parameterList.add(null); <END> throw new IllegalArgumentException("String parameters without" + " @PathParam annotation"); } } else { parameterList.add(null); } } ); executeMethod(method, webSocketEndpoint, parameterList, session); } } catch (Throwable throwable) { handleError(closeCarbonMessage, throwable, routableEndpoint, session); } }</code><technical_language>If throwing, do need add a null list</technical_language>

Target:
private void handleCloseWebSocketMessage(StatusCarbonMessage closeCarbonMessage, PatternPathRouter.RoutableDestination<Object> routableEndpoint, Session session) { Object webSocketEndpoint = routableEndpoint.getDestination(); Map<String, String> paramValues = routableEndpoint.getGroupNameValues(); Optional<Method> methodOptional = new EndpointDispatcher().getOnCloseMethod(webSocketEndpoint); try { methodOptional.ifPresent( method -> { List<Object> parameterList = new LinkedList<>(); Arrays.stream(method.getParameters()).forEach( parameter -> { if (parameter.getType() == CloseReason.class) { CloseReason.CloseCode closeCode = new CloseCodeImpl( closeCarbonMessage.getStatusCode()); CloseReason closeReason = new CloseReason( closeCode, closeCarbonMessage.getReasonText()); parameterList.add(closeReason); } else if (parameter.getType() == Session.class) { parameterList.add(session); } else if (parameter.getType() == String.class) { PathParam pathParam = parameter.getAnnotation(PathParam.class); if (pathParam != null) { parameterList.add(paramValues.get(pathParam.value())); } else { throw new IllegalArgumentException("String parameters without" + " @PathParam annotation"); } } else { parameterList.add(null); } } ); executeMethod(method, webSocketEndpoint, parameterList, session); } ); } catch (Throwable throwable) { handleError(throwable, routableEndpoint, session); } }
Source:
<code>protected boolean canHandle(Network network, Service service) { if (network.getBroadcastDomainType() != Networks.BroadcastDomainType.Vsp) { return false; } if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) { if (s_logger.isDebugEnabled()) { <START> s_logger.debug("NuageElement is not a provider for network " + network.getDisplayText()); <END> } return false; } if (service != null) { if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, getProvider())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageElement can't provide the " + service.getName() + " service on network " + network.getDisplayText()); } return false; } } return true; }</code><technical_language>Please provide identifying/context information of Nuage element assist debugging</technical_language>

Target:
protected boolean canHandle(Network network, Service service) { if (network.getBroadcastDomainType() != Networks.BroadcastDomainType.Vsp) { return false; } if (!_networkModel.isProviderForNetwork(getProvider(), network.getId())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageVsp is not a provider for network " + network.getDisplayText()); } return false; } if (service != null) { if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), service, getProvider())) { if (s_logger.isDebugEnabled()) { s_logger.debug("NuageVsp can't provide the " + service.getName() + " service on network " + network.getDisplayText()); } return false; } } return true; }
Source:
<code>public List<Location> getLocationsById(Collection<String> ids) { List<Location> result = new ArrayList<Location>(); for (Object id: ids) { if (id instanceof String) result.add(resolve((String)id)); else if (id instanceof Collection) { log.warn("LocationRegistry got list of list of location strings, "+ids+"; flattening"); result.addAll(getLocationsById((Collection)id)); } else if (id instanceof Location) result.add((Location)id); else { <START> throw new IllegalArgumentException("Cannot resolve '"+id+"' to a location; unsupported type"); <END> } } return result; }</code><technical_language>type was? toString instance clear is unsupported..</technical_language>

Target:
public List<Location> getLocationsById(Collection<String> ids) { List<Location> result = new ArrayList<Location>(); for (Object id: ids) { if (id instanceof String) result.add(resolve((String)id)); else if (id instanceof Collection) { log.warn("LocationRegistry got list of list of location strings, "+ids+"; flattening"); result.addAll(getLocationsById((Collection)id)); } else if (id instanceof Location) result.add((Location)id); else { throw new IllegalArgumentException("Cannot resolve '"+id+"' to a location; unsupported type "+ (id==null ? "null" : ""+id.getClass())); } } return result; }
Source:
<code>public HeroicConfig.Builder build(final ExtraParameters params) throws Exception { final HeroicConfig.Builder builder = HeroicConfig.builder(); <START> final String level = params.get("level").orElse("INFO"); <END> return builder .queryLogging( new Slf4jQueryLoggingModule(Optional.of("query_log"), Optional.of(level)) ); }</code><technical_language>talked TRACE log level default. In opinion also. do think</technical_language>

Target:
public HeroicConfig.Builder build(final ExtraParameters params) throws Exception { final HeroicConfig.Builder builder = HeroicConfig.builder(); final String level = params.get("level").orElse("TRACE"); return builder .queryLogging( new Slf4jQueryLoggingModule(Optional.of("query_log"), Optional.of(level)) ); }
Source:
<code>protected SSLContext getSslContext(ElasticSearchClientConfig config) { if (StringUtils.isBlank(config.getOption(KEYSTORE_PATH_OPT))) { return null; } try { Path keyStorePath = Paths.get(config.getOption(KEYSTORE_PATH_OPT)); String keyStorePass = config.getOption(KEYSTORE_PASSWORD_OPT); String keyStoreType = config.getOption(KEYSTORE_TYPE, KeyStore.getDefaultType()); <START> char[] keyPass = StringUtils.isEmpty(keyStorePass)?null:keyStorePass.toCharArray(); <END> KeyStore keyStore = KeyStore.getInstance(keyStoreType); try (InputStream is = Files.newInputStream(keyStorePath)) { keyStore.load(is, keyPass); } SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(keyStore, null); return sslBuilder.build(); } catch (GeneralSecurityException | IOException e) { throw new NuxeoException("Cannot setup SSL for RestClient: " + config, e); } }</code><technical_language>Formatting: add spaces ? : For a user-supplied parameter this one, isBlank instead of isEmpty</technical_language>

Target:
protected SSLContext getSslContext(ElasticSearchClientConfig config) { if (StringUtils.isBlank(config.getOption(KEYSTORE_PATH_OPT))) { return null; } try { Path keyStorePath = Paths.get(config.getOption(KEYSTORE_PATH_OPT)); String keyStorePass = config.getOption(KEYSTORE_PASSWORD_OPT); String keyStoreType = StringUtils.defaultIfBlank(config.getOption(KEYSTORE_TYPE_OPT), KeyStore.getDefaultType()); char[] keyPass = StringUtils.isBlank(keyStorePass) ? null : keyStorePass.toCharArray(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); try (InputStream is = Files.newInputStream(keyStorePath)) { keyStore.load(is, keyPass); } SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(keyStore, null); return sslBuilder.build(); } catch (GeneralSecurityException | IOException e) { throw new NuxeoException("Cannot setup SSL for RestClient: " + config, e); } }
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Set<String> groupByFields = conf.getGroupByFields(); List<GroupByConfig.FunctionInfo> aggregates = conf.getAggregates(); StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer(); Schema inputSchema = stageConfigurer.getInputSchema(); if (inputSchema == null) { stageConfigurer.setOutputSchema(null); return; } List<Schema.Field> outputFields = new ArrayList<>(groupByFields.size() + aggregates.size()); for (String groupByField : groupByFields) { Schema.Field field = inputSchema.getField(groupByField); if (field == null) { throw new IllegalArgumentException(String.format( "Cannot group by field '%s' because it does not exist in input schema %s.", groupByField, inputSchema)); } outputFields.add(field); } for (GroupByConfig.FunctionInfo functionInfo : aggregates) { if (functionInfo.getField().equals("*")) { AggregateFunction aggregateFunction = functionInfo.getAggregateFunction(null); outputFields.add(Schema.Field.of(functionInfo.getName(), aggregateFunction.getOutputSchema())); continue; } Schema.Field inputField = inputSchema.getField(functionInfo.getField()); if (inputField == null) { throw new IllegalArgumentException(String.format( "Invalid aggregate %s(%s): Field '%s' does not exist in input schema %s.", functionInfo.getFunction(), functionInfo.getField(), functionInfo.getField(), inputSchema)); } AggregateFunction aggregateFunction = functionInfo.getAggregateFunction(inputField.getSchema()); <START> outputFields.add(Schema.Field.of(functionInfo.getName(), aggregateFunction.getOutputSchema())); <END> } Schema outputSchema = Schema.recordOf(inputSchema.getRecordName() + ".agg", outputFields); stageConfigurer.setOutputSchema(outputSchema); }</code><technical_language>split separate methods, configurePipeline is pretty long</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Set<String> groupByFields = conf.getGroupByFields(); List<GroupByConfig.FunctionInfo> aggregates = conf.getAggregates(); StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer(); Schema inputSchema = stageConfigurer.getInputSchema(); if (inputSchema == null) { stageConfigurer.setOutputSchema(null); return; } stageConfigurer.setOutputSchema(getOutputSchema(inputSchema, groupByFields, aggregates)); }
Source:
<code>private boolean hasIndirectDependent(Set<StructDef<?>> visited, StructDef<?> structDef) { for (StructDef<?> next : this.dependents) { if <START> (visited.contains(next)) { <END> continue; } visited.add(next); if (next.equals(structDef)) { return true; } if (next.hasIndirectDependent(visited, structDef)) { return true; } } return false; }</code><technical_language>Simpler: if (!visited.add(next))</technical_language>

Target:
private boolean hasIndirectDependent(Set<StructDef<?>> visited, StructDef<?> structDef) { for (StructDef<?> next : this.dependents) { if (!visited.add(next)) { continue; } if (next.equals(structDef)) { return true; } if (next.hasIndirectDependent(visited, structDef)) { return true; } } return false; }
Source:
<code>public Map<String, Set<String>> getPrincipalRoles(PID pid) { <START> String pidString = pid.getRepositoryPath(); <END> List<Entry<String, String>> objAcls = objAclCache.getUnchecked(pidString); Map<String, Set<String>> result = objAcls.stream() .filter(p -> roleUris.contains(p.getKey())) .collect(Collectors.groupingBy( Entry<String, String>::getValue, Collectors.mapping(Entry<String, String>::getKey, Collectors.toSet()) )); return result; }</code><technical_language>lines get called repeatedly in (i.e., 87-88) of methods follow. worth creating a private method returns objAcls</technical_language>

Target:
public Map<String, Set<String>> getPrincipalRoles(PID pid) { Map<String, Set<String>> result = getObjectAcls(pid).stream() .filter(p -> roleUris.contains(p.getKey())) .collect(Collectors.groupingBy( Entry<String, String>::getValue, Collectors.mapping(Entry<String, String>::getKey, Collectors.toSet()) )); return result; }
Source:
<code>public int compare(T a, T b) { int res = sortAscending ? comparator.compare(a, b) : comparator.compare(b, a); <START> return res != 0 ? res : Integer.signum(positions.get(b) - positions.get(a)); <END> }</code><technical_language>more defensive "positions" map, for example: int posA = positions.containsKey(a) ? positions.get(a) : undefinedPosition; int posB = positions.containsKey(b) ? positions.get(b) : undefinedPosition; Also, compare "A vs. B" instead of "B vs. A" items position considered "before" items higher positions? int posDelta = Integer.signum(posA - posB); In code, "undefinedPosition" is similar null item, Integer.MIN_VALUE (null first) Integer.MAX_VALUE (null last)</technical_language>

Target:
public int compare(T a, T b) { int res = sortAscending ? comparator.compare(a, b) : comparator.compare(b, a); return (res != 0) ? res : Integer.signum(insertionIndex.get(a) - insertionIndex.get(b)); }
Source:
<code>private void renderRow(SafeHtmlBuilder sb) { sb.openDiv().setStyleName(RelatedChanges.R.css().row()); sb.openSpan().setStyleName(RelatedChanges.R.css().pointer()); sb.append(POINTER_HTML); sb.closeSpan(); sb.openSpan().setStyleName(RelatedChanges.R.css().subject()); String url = url(); if (url != null) { sb.openAnchor().setAttribute("href", url); if (url.startsWith("#")) { sb.setAttribute("onclick", OPEN); } if (showBranches) { sb.append(info.branch()).append(": "); } sb.append(info.commit().subject()); sb.closeAnchor(); } else { sb.append(info.commit().subject()); } sb.closeSpan(); sb.openSpan(); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && (!info.has_change_number() || !info.has_revision_number())) { sb.setStyleName(RelatedChanges.R.css().gitweb()); sb.setAttribute("title", gw.getLinkName()); sb.append('\u25CF'); <START> } else if (connected) { <END> sb.setStyleName(RelatedChanges.R.css().indirect()); sb.setAttribute("title", Resources.C.indirectAncestor()); sb.append('~'); } else if (info.has_current_revision_number() && info.has_revision_number() && info._current_revision_number() != info._revision_number()) { sb.setStyleName(RelatedChanges.R.css().notCurrent()); sb.setAttribute("title", Util.C.notCurrent()); sb.append('\u25CF'); } else { sb.setStyleName(RelatedChanges.R.css().current()); } sb.closeSpan(); sb.closeDiv(); }</code><technical_language>is notConnected a name for this field</technical_language>

Target:
private void renderRow(SafeHtmlBuilder sb) { sb.openDiv().setStyleName(RelatedChanges.R.css().row()); sb.openSpan().setStyleName(RelatedChanges.R.css().pointer()); sb.append(POINTER_HTML); sb.closeSpan(); sb.openSpan().setStyleName(RelatedChanges.R.css().subject()); String url = url(); if (url != null) { sb.openAnchor().setAttribute("href", url); if (url.startsWith("#")) { sb.setAttribute("onclick", OPEN); } if (showBranches) { sb.append(info.branch()).append(": "); } sb.append(info.commit().subject()); sb.closeAnchor(); } else { sb.append(info.commit().subject()); } sb.closeSpan(); sb.openSpan(); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && (!info.has_change_number() || !info.has_revision_number())) { sb.setStyleName(RelatedChanges.R.css().gitweb()); sb.setAttribute("title", gw.getLinkName()); sb.append('\u25CF'); } else if (notConnected) { sb.setStyleName(RelatedChanges.R.css().indirect()); sb.setAttribute("title", Resources.C.indirectAncestor()); sb.append('~'); } else if (info.has_current_revision_number() && info.has_revision_number() && info._current_revision_number() != info._revision_number()) { sb.setStyleName(RelatedChanges.R.css().notCurrent()); sb.setAttribute("title", Util.C.notCurrent()); sb.append('\u25CF'); } else { sb.setStyleName(RelatedChanges.R.css().current()); } sb.closeSpan(); sb.closeDiv(); }
Source:
<code>public void testAuthorResponse() { String xml = read(prefix("peer-review.pone.0207232.xml")); String html = service.transformXmlToHtml(xml, DEFAULT_PEER_REVIEW_XSL); Document doc = Jsoup.parse(html); assertThat(doc.select(".review-history .revision .letter__title").get(0).text(), containsString("Original Submission")); assertThat(doc.select(".review-history .revision .letter__date").get(0).text(), containsString("June 1, 2018")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(0).text(), containsString("September 12, 2018")); <START> assertThat(doc.select(".review-history .decision-letter span[itemprop=name]").get(0).text(), containsString("Qinghui Zhang, Editor, Surachai Supattapone, Editor")); <END> assertThat(doc.select(".review-history .revision .letter__title").get(1).text(), containsString("Revision 1")); Element authorResponseDiv = doc.select(".author-response").first(); assertThat(authorResponseDiv.text(), containsString("Author Response")); Element attachmentElem = authorResponseDiv.select(".review-files .supplementary-material").first(); assertThat(attachmentElem.text(), containsString("Response to Reviewers.docx")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(1).text(), containsString("October 9, 2018")); assertThat(doc.select(".review-history .decision-letter span[itemprop=name]").get(1).text(), containsString("Qinghui Zhang, Editor")); }</code><technical_language>do changing this java assertEquals("Qinghui Zhang, Editor, Surachai Supattapone, Editor", doc.select(".review-history .decision-letter span[itemprop=name]").get(0).text()); catch accidental trailing ,</technical_language>

Target:
public void testAuthorResponse() { String xml = read(prefix("peer-review.pone.0207232.xml")); String html = service.transformXmlToHtml(xml, DEFAULT_PEER_REVIEW_XSL); Document doc = Jsoup.parse(html); assertThat(doc.select(".review-history .revision .letter__title").get(0).text(), containsString("Original Submission")); assertThat(doc.select(".review-history .revision .letter__date").get(0).text(), containsString("June 1, 2018")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(0).text(), containsString("September 12, 2018")); assertEquals("Qinghui Zhang, Editor, Surachai Supattapone, Editor", doc.select(".review-history .decision-letter span[itemprop=name]").get(0).text()); assertThat(doc.select(".review-history .revision .letter__title").get(1).text(), containsString("Revision 1")); Element authorResponseDiv = doc.select(".author-response").first(); assertThat(authorResponseDiv.text(), containsString("Author Response")); Element attachmentElem = authorResponseDiv.select(".review-files .supplementary-material").first(); assertThat(attachmentElem.text(), containsString("Response to Reviewers.docx")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(1).text(), containsString("October 9, 2018")); assertEquals("Qinghui Zhang, Editor", doc.select(".review-history .decision-letter span[itemprop=name]").get(1).text()); }
Source:
<code>public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); conf.set("dt.application.FilterExample.operator.selectedOutput.prop.filePath", outputDir); conf.set("dt.application.FilterExample.operator.rejectedOutput.prop.filePath", outputDir); <START> File selectedfile = FileUtils.getFile(outputDir, "selected.txt_6.0"); <END> File rejectedfile = FileUtils.getFile(outputDir, "rejected.txt_8.0"); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); while (!selectedfile.exists()) { System.out.println("Sleeping ...."); Thread.sleep(1000); } while (!rejectedfile.exists()) { System.out.println("Sleeping ...."); Thread.sleep(1000); } lc.shutdown(); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/selected.txt" ),selectedfile)); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/rejected.txt" ),rejectedfile)); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }</code><technical_language>file is appended number 6 & 8</technical_language>

Target:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); conf.set("dt.application.FilterExample.operator.selectedOutput.prop.filePath", outputDir); conf.set("dt.application.FilterExample.operator.rejectedOutput.prop.filePath", outputDir); final File selectedfile = FileUtils.getFile(outputDir, "selected.txt_6.0"); final File rejectedfile = FileUtils.getFile(outputDir, "rejected.txt_8.0"); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.setHeartbeatMonitoringEnabled(false); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (selectedfile.exists() && rejectedfile.exists()) { return true; } return false; } }); lc.run(40000); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/selected_output.txt" ),selectedfile)); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/rejected_output.txt" ),rejectedfile)); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
<code>default Object getProperty(String key, Object defaultValue) { Object value = getInternalProperty(key); if (value == null) { value = defaultValue; } <START> return value; <END> }</code><technical_language>simplified return value!=null? : defaultValue</technical_language>

Target:
default Object getProperty(String key, Object defaultValue) { Object value = getInternalProperty(key); return value != null ? value : defaultValue; }
Source:
<code>private void sortByTotalStudentsDescending(List<InstituteStats> list) { list.sort((institute1, institute2) -> { <START> return Integer.compare(institute2.studentTotal, institute1.studentTotal); <END> }); }</code><technical_language>a .reversed comparator here</technical_language>

Target:
private void sortByTotalStudentsDescending(List<InstituteStats> list) { list.sort(Comparator.comparing((InstituteStats institute) -> institute.studentTotal).reversed()); }
Source:
<code>public void release() { <START> JdbcConnectionAccess connectionAccess = jdbcContext.getJdbcConnectionAccess(); <END> if( !( connectionAccess instanceof JdbcConnectionAccessProvidedConnectionImpl ) ) { throw new IllegalStateException( "DdlTransactionIsolatorProvidedConnectionImpl should always use a JdbcConnectionAccessProvidedConnectionImpl" ); } JdbcConnectionAccessProvidedConnectionImpl connectionAccessProvidedConnection = (JdbcConnectionAccessProvidedConnectionImpl) connectionAccess; try { connectionAccess.releaseConnection( null ); } catch (SQLException ignore) { LOG.unableToReleaseIsolatedConnection( ignore ); } }</code><technical_language>I connectionAccessProvidedConnection used. Is check connectionAccess cast connection provided</technical_language>

Target:
public void release() { JdbcConnectionAccess connectionAccess = jdbcContext.getJdbcConnectionAccess(); if( !( connectionAccess instanceof JdbcConnectionAccessProvidedConnectionImpl ) ) { throw new IllegalStateException( "DdlTransactionIsolatorProvidedConnectionImpl should always use a JdbcConnectionAccessProvidedConnectionImpl" ); } try { connectionAccess.releaseConnection( null ); } catch (SQLException ignore) { LOG.unableToReleaseIsolatedConnection( ignore ); } }
Source:
<code>protected void onResume() { super.onResume(); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); <START> boolean state = appPrefs.getBoolean(PassCodeActivity.PREFERENCE_SET_PASSCODE, false); <END> pCode.setChecked(state); boolean patternState = appPrefs.getBoolean(PatternLockActivity.PREFERENCE_SET_PATTERN,false); patternCode.setChecked(patternState); }</code><technical_language>Please rename this variable passCodeState, distinguish patternState</technical_language>

Target:
protected void onResume() { super.onResume(); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); boolean passCodeState = appPrefs.getBoolean(PassCodeActivity.PREFERENCE_SET_PASSCODE, false); pCode.setChecked(passCodeState); boolean patternState = appPrefs.getBoolean(PatternLockActivity.PREFERENCE_SET_PATTERN,false); pPattern.setChecked(patternState); }
Source:
<code>public void testListFilesRecursiveWhenAllListingsAreAuthoritative() throws Exception { describe("listFiles does not make further calls to the fs when" + "all nested directory listings are authoritative"); Set<Path> files = new HashSet<>(); Path parentDir = dir; Path parentFile = dirFile; Path nestedDir1 = new Path(dir, "nested1"); Path nestedFile1 = new Path(nestedDir1, "nestedFile1"); Path nestedDir2 = new Path(nestedDir1, "nested2/"); Path nestedFile2 = new Path(nestedDir2, "nestedFile2"); files.add(parentFile); files.add(nestedFile1); files.add(nestedFile2); authFS.mkdirs(parentDir); authFS.mkdirs(nestedDir1); authFS.mkdirs(nestedDir2); touchFile(parentFile); touchFile(nestedFile1); touchFile(nestedFile2); authFS.listStatus(parentDir); authFS.listStatus(nestedDir1); authFS.listStatus(nestedDir2); S3AStorageStatistics statistics = authFS.getStorageStatistics(); statistics.reset(); RemoteIterator<LocatedFileStatus> statusIterator = authFS.listFiles(dir, true); while (statusIterator.hasNext()) { LocatedFileStatus locatedFileStatus = statusIterator.next(); <START> assertTrue("This path does not exist in original listing: " + <END> locatedFileStatus.getPath(), files.remove(locatedFileStatus.getPath())); } assertEquals("Some files were missing from authoritative listing:" + Arrays.toString(files.toArray()), 0, files.size()); assertEquals("There must not be any OBJECT_LIST requests" + "as all directory listings are authoritative.", 0, (long) statistics.getLong(OBJECT_LIST_REQUESTS.getSymbol())); }</code><technical_language>This test suite leap AssertJ assertions -please case them. better,</technical_language>

Target:
public void testListFilesRecursiveWhenAllListingsAreAuthoritative() throws Exception { describe("listFiles does not make further calls to the fs when" + "all nested directory listings are authoritative"); Set<Path> originalFiles = new HashSet<>(); Path parentDir = dir; Path parentFile = dirFile; Path nestedDir1 = new Path(dir, "nested1"); Path nestedFile1 = new Path(nestedDir1, "nestedFile1"); Path nestedDir2 = new Path(nestedDir1, "nested2/"); Path nestedFile2 = new Path(nestedDir2, "nestedFile2"); originalFiles.add(parentFile); originalFiles.add(nestedFile1); originalFiles.add(nestedFile2); mkAuthDir(parentDir); mkAuthDir(nestedDir1); mkAuthDir(nestedDir2); touchFile(parentFile); touchFile(nestedFile1); touchFile(nestedFile2); S3ATestUtils.MetricDiff objListRequests = new S3ATestUtils.MetricDiff(authFS, OBJECT_LIST_REQUESTS); RemoteIterator<LocatedFileStatus> statusIterator = authFS.listFiles(dir, true); List<Path> pathsFromStatusIterator = toPaths(statusIterator); Assertions.assertThat(pathsFromStatusIterator) .as("listFiles should return all the items in actual" + "S3 directory and nothing more") .hasSameElementsAs(originalFiles) .hasSameSizeAs(originalFiles); objListRequests.assertDiffEquals("There must not be any OBJECT_LIST " + "requests as all directory listings are authoritative", 0); }
Source:
<code>private void updateGitIgnore(File gitIgnore, String entry) throws CoreException { try { <START> if (!gitIgnore.exists()) { <END> if (!gitIgnore.createNewFile()) { String error = NLS.bind( CoreText.IgnoreOperation_creatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, null)); } } else entry = getEntry(gitIgnore, entry); FileOutputStream os = new FileOutputStream(gitIgnore, true); try { os.write(entry.getBytes()); } finally { os.close(); } } catch (IOException e) { String error = NLS.bind(CoreText.IgnoreOperation_updatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, e)); } }</code><technical_language>remove this bracket</technical_language>

Target:
private void updateGitIgnore(File gitIgnore, String entry) throws CoreException { try { String ignoreLine = entry; if (!gitIgnore.exists()) if (!gitIgnore.createNewFile()) { String error = NLS.bind( CoreText.IgnoreOperation_creatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, null)); } else ignoreLine = getEntry(gitIgnore, ignoreLine); FileOutputStream os = new FileOutputStream(gitIgnore, true); try { os.write(ignoreLine.getBytes()); } finally { os.close(); } } catch (IOException e) { String error = NLS.bind(CoreText.IgnoreOperation_updatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, e)); } }
Source:
<code>public static TableName newTestTableName() { <START> return TableName.valueOf("test_table-" + UUID.randomUUID().toString()); <END> }</code><technical_language>useful test created table in name</technical_language>

Target:
public static TableName newTestTableName() { return TableName.valueOf("test-dataflow-" + UUID.randomUUID().toString()); }
Source:
<code>private TableRow<Replay> replayRowFactory() { TableRow<Replay> row = new TableRow<>(); ContextMenu contextMenu = new ContextMenu(); <START> MenuItem copyReplayId = new MenuItem("Copy Replay Id"); <END> copyReplayId.setOnAction(event -> { var replayId = row.getItem().getId(); final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(String.valueOf(replayId)); clipboard.setContent(content); }); MenuItem copyReplayPath = new MenuItem("Copy Replay Path"); copyReplayPath.setOnAction(event -> { var replayPath = row.getItem().getReplayFile(); final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(String.valueOf(replayPath)); clipboard.setContent(content); }); contextMenu.getItems().addAll(copyReplayId, copyReplayPath); row.setContextMenu(contextMenu); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && !row.isEmpty() && row.getItem().getId() != 0) { replayService.runReplay(row.getItem()); } }); return row; }</code><technical_language>internationalization this needs translatable. i18n service. a constructor parameter other services. enter english translation in message.properties file in resources/i18n folder</technical_language>

Target:
private TableRow<Replay> replayRowFactory() { TableRow<Replay> row = new TableRow<>(); ContextMenu contextMenu = replayRowContextMenuFactory(row); row.setContextMenu(contextMenu); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && !row.isEmpty() && row.getItem().getId() != 0) { replayService.runReplay(row.getItem()); } }); return row; }
Source:
<code>public void clear() { try { getDiskCache().delete(); <START> diskLruCache = null; <END> } catch (IOException e) { if (Log.isLoggable(TAG, Log.WARN)) { Log.w(TAG, "Unable to clear disk cache", e); } } }</code><technical_language>guess findbugs (the reason for build breakage) is complaining unsynchronized access diskLruCache here</technical_language>

Target:
public synchronized void clear() { try { getDiskCache().delete(); resetDiskCache(); } catch (IOException e) { if (Log.isLoggable(TAG, Log.WARN)) { Log.w(TAG, "Unable to clear disk cache", e); } } }
Source:
<code>public String validateSchema(FormDataMultiPart multiPart) { Schema schema = getSchemaFromMultiPart(multiPart); try { SchemaUtils.validate(schema); } catch (Exception e) { <START> throw new ControllerApplicationException(LOGGER, String.format("Invalid schema:%s.", schema.getSchemaName()), <END> Response.Status.BAD_REQUEST, e); } return schema.toPrettyJsonString(); }</code><technical_language>(nit) Space ':' '.' schema name for readability. for other exceptions suggestion throw new ControllerApplicationException(LOGGER, "Invalid schema: " + schema.getSchemaName()),</technical_language>

Target:
public String validateSchema(FormDataMultiPart multiPart) { Schema schema = getSchemaFromMultiPart(multiPart); try { SchemaUtils.validate(schema); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, "Invalid schema: " + schema.getSchemaName(), Response.Status.BAD_REQUEST, e); } return schema.toPrettyJsonString(); }
Source:
<code>public void testServerInfo() throws Exception { final HttpGet get = new HttpGet(url.toExternalForm() + "jaxrs/test/server/info"); final HttpResponse response = HTTP_CLIENT.execute(get); final HttpEntity entity = response.getEntity(); Assert.assertNotNull("Null entity!", entity); final String content = EntityUtils.toString(response.getEntity()); <START> Assert.assertTrue("Wrong content! " + content, content.contains("WildFly")); <END> }</code><technical_language>this change</technical_language>

Target:
public void testServerInfo() throws Exception { final HttpGet get = new HttpGet(url.toExternalForm() + "jaxrs/test/server/info"); final HttpResponse response = HTTP_CLIENT.execute(get); final HttpEntity entity = response.getEntity(); Assert.assertNotNull("Null entity!", entity); final String content = EntityUtils.toString(response.getEntity()); Assert.assertTrue("Wrong content! " + content, content.matches("WildFly Full .*\\(WildFly Core .*\\) - .*")); }
Source:
<code>public void testDisposalOfFileResources() throws Exception { final Application application = new UnitTestApplication(); final SessionID sessionID = new SessionID( FixVersions.BEGINSTRING_FIX44, "SENDER", "TARGET"); final MessageStoreFactory mockMessageStoreFactory = mock(MessageStoreFactory.class); final CloseableMessageStore mockMessageStore = mock(CloseableMessageStore.class); stub(mockMessageStoreFactory.create(sessionID)).toReturn( mockMessageStore); final LogFactory mockLogFactory = mock(LogFactory.class); final CloseableLog mockLog = mock(CloseableLog.class); stub(mockLogFactory.create(sessionID)).toReturn(mockLog); try (Session session = new Session(application, mockMessageStoreFactory, sessionID, null, null, mockLogFactory, new DefaultMessageFactory(), 30, false, 30, UtcTimestampPrecision.MILLIS, true, false, false, false, false, false, true, false, 1.5, null, true, new int[] { 5 }, false, false, false, false, true, false, true, false, <START> null, true, 0, false, false, true, new ArrayList<>(), 1.4)) { <END> session.setResponder(null); } verify(mockMessageStore).close(); verifyNoMoreInteractions(mockMessageStore); verify(mockLog, atLeastOnce()).onEvent(anyString()); verify(mockLog).close(); verifyNoMoreInteractions(mockLog); }</code><technical_language>Instead of this magic number, Session.DEFAULT_HEARTBEAT_TIMEOUT_MULTIPLIER in this test</technical_language>

Target:
public void testDisposalOfFileResources() throws Exception { final Application application = new UnitTestApplication(); final SessionID sessionID = new SessionID( FixVersions.BEGINSTRING_FIX44, "SENDER", "TARGET"); final MessageStoreFactory mockMessageStoreFactory = mock(MessageStoreFactory.class); final CloseableMessageStore mockMessageStore = mock(CloseableMessageStore.class); stub(mockMessageStoreFactory.create(sessionID)).toReturn( mockMessageStore); final LogFactory mockLogFactory = mock(LogFactory.class); final CloseableLog mockLog = mock(CloseableLog.class); stub(mockLogFactory.create(sessionID)).toReturn(mockLog); try (Session session = new Session(application, mockMessageStoreFactory, sessionID, null, null, mockLogFactory, new DefaultMessageFactory(), 30, false, 30, UtcTimestampPrecision.MILLIS, true, false, false, false, false, false, true, false, 1.5, null, true, new int[] { 5 }, false, false, false, false, true, false, true, false, null, true, 0, false, false, true, new ArrayList<>(), Session.DEFAULT_HEARTBEAT_TIMEOUT_MULTIPLIER)) { session.setResponder(null); } verify(mockMessageStore).close(); verifyNoMoreInteractions(mockMessageStore); verify(mockLog, atLeastOnce()).onEvent(anyString()); verify(mockLog).close(); verifyNoMoreInteractions(mockLog); }
Source:
<code>private void candidateBatchSizeDecreasesToAMinimumOfOne() { int newValue = adjustableConfig.getAdjustedSweepConfig().candidateBatchSize(); if (newValue == 1) { return; } <START> assertThat(newValue, is(lessThan(previousCandidateBatchSize))); <END> }</code><technical_language>Nit: replace lines with: assertThat(newValue, is(anyOf(lessThan(previousMaxCellTsPairsToExamine), equalTo(1)))); for other batch config asserts</technical_language>

Target:
private void candidateBatchSizeDecreasesToAMinimumOfOne() { decreasesToOne(SweepBatchConfig::candidateBatchSize); }
Source:
<code>public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); } catch (OpenStackResponseException e) { StringBuilder builder = new StringBuilder(); builder.append(e.getMessage()).append("(").append(e.getStatus()).append(")"); <START> log.error(builder.toString(), e); <END> throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }</code><technical_language>enough stacktrace in DEBUG? error code in INFO enough? If I prefer: log.error("{} ({})", e.getMessage(), e.getStatus()); log.debug("Exception", e);</technical_language>

Target:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); } catch (OpenStackResponseException e) { log.error("{} (OpenStack response error code: {})", e.getMessage(), e.getStatus()); log.debug("Exception", e); throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
<code>protected void initConditions() { <START> conditionSpark1 = new MultiComponentCondition( <END> new BasicExpression(SparkBatchConstant.SPARK_LOCAL_MODE_PARAMETER, EqualityOperator.EQ, "false"), BooleanOperator.AND, new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_1_6.getSparkVersion())); conditionSpark2 = new MultiComponentCondition( new BasicExpression(SparkBatchConstant.SPARK_LOCAL_MODE_PARAMETER, EqualityOperator.EQ, "false"), BooleanOperator.AND, new MultiComponentCondition( new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_2.getSparkVersion()), BooleanOperator.OR, new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_4.getSparkVersion())) ); }</code><technical_language>spark 2.4 is supported for CDP</technical_language>

Target:
protected void initConditions() { conditionSpark2 = new MultiComponentCondition( new BasicExpression(SparkBatchConstant.SPARK_LOCAL_MODE_PARAMETER, EqualityOperator.EQ, "false"), BooleanOperator.AND, new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_4.getSparkVersion())); }
Source:
<code>private static boolean rename(File source, File target) throws IOException { Files.move(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING); <START> return true; <END> }</code><technical_language>This return void. remove if if(rename... log falling copy/delete in handleFileMessage(). Also, logic in renameTo() deletes existing file removed if tests throw s removed also, Files.move throw exception</technical_language>

Target:
private static void rename(File source, File target) throws IOException { Files.move(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING); }
Source:
<code>private void updateTranscriptVisibility(int visibility) { <START> Fragment fragment = getParentFragment(); <END> if (fragment instanceof CourseUnitVideoFragment) { ((CourseUnitVideoFragment) fragment).updateTranscriptVisibility(visibility); } }</code><technical_language>final</technical_language>

Target:
private void updateTranscriptVisibility(int visibility) { final Fragment fragment = getParentFragment(); if (fragment instanceof CourseUnitVideoFragment) { ((CourseUnitVideoFragment) fragment).updateBottomSectionVisibility(visibility); } }
Source:
<code>public int read(byte[] b, int off, int len) throws IOException { validateParameters(b, off, len); if (len == 0) { return 0; } if (!subscribed) { blockForData(); } <START> if (this.buffer == null) { END> if (this.lastError != null) { throw logger.logThrowableAsError(this.lastError); } if (this.fluxComplete) { return -1; } this.buffer = new ByteArrayInputStream(new byte[0]); } if (this.buffer.available() == 0) { if (this.fluxComplete) { return -1; } blockForData(); } if (this.buffer.available() > 0) { return this.buffer.read(b, off, len); } if (this.fluxComplete) { return -1; } else { throw logger.logExceptionAsError(new IllegalStateException("An unexpected error occurred. No data was " + "read from the stream but the stream did not indicate completion.")); } }</code><technical_language>I want lock checking if buffer is null assigning here. lock in onNext below, modifying locking give a race condition, i</technical_language>

Target:
public int read(byte[] b, int off, int len) throws IOException { validateParameters(b, off, len); if (len == 0) { return 0; } if (!subscribed) { blockForData(); } if (this.buffer == null) { if (this.lastError != null) { throw logger.logThrowableAsError(this.lastError); } if (this.fluxComplete) { return -1; } throw logger.logExceptionAsError(new IllegalStateException("An unexpected error occurred. No data was " + "read from the stream but the stream did not indicate completion.")); } if (this.buffer.available() == 0) { if (this.fluxComplete) { return -1; } blockForData(); } if (this.buffer.available() > 0) { return this.buffer.read(b, off, len); } if (this.fluxComplete) { return -1; } else { throw logger.logExceptionAsError(new IllegalStateException("An unexpected error occurred. No data was " + "read from the stream but the stream did not indicate completion.")); } }
Source:
<code>public static VgpuPlacementEnum forValue(int value) { <START> return values()[value]; <END> }</code><technical_language>this works maintain order values. Safer is write this: return Arrays.stream(values()).filter(e -> e.getValue() == value).findFirst().get();</technical_language>

Target:
public static VgpuPlacementEnum forValue(int value) { return Arrays.stream(values()).filter(e -> e.getValue() == value).findFirst().get(); }
Source:
<code>public void testClearExpiredDeviceCodes() { expiredDeviceCodes1 = Sets.newHashSet(deviceCode1, deviceCode2); expiredDeviceCodes2 = Sets.newHashSet(); <START> Mockito.when(repository.getExpiredCodes()).thenReturn(expiredDeviceCodes1, expiredDeviceCodes1,expiredDeviceCodes2); <END> service.clearExpiredDeviceCodes(); Mockito.verify(repository, atLeast(2)).remove(Matchers.any(DeviceCode.class)); Mockito.verify(repository,times(4)).getExpiredCodes(); }</code><technical_language>test pass some side effects. If underlying paging system change, suddenly fail of side effects</technical_language>

Target:
public void testClearExpiredDeviceCodes() { java.util.concurrent.ArrayBlockingQueue<DeviceCode> deviceCodesList = new ArrayBlockingQueue<>(2); deviceCodesList.add(deviceCode1); deviceCodesList.add(deviceCode2); when(repository.getExpiredCodes()).thenReturn(deviceCodesList); Answer<java.util.concurrent.ArrayBlockingQueue<DeviceCode>> answer = new Answer<java.util.concurrent.ArrayBlockingQueue<DeviceCode>>() { @Override public java.util.concurrent.ArrayBlockingQueue<DeviceCode> answer(InvocationOnMock invocation) throws Throwable { deviceCodesList.remove(); return deviceCodesList; } }; doAnswer(answer).when(repository).remove(Matchers.any(DeviceCode.class)); service.clearExpiredDeviceCodes(); assertThat(0, equalTo(deviceCodesList.size())); }
Source:
<code>public void getAttributesByIdsAndPrimaryHolder() throws Exception { System.out.println(CLASS_NAME + "getAttributesByIdsAndPrimaryHolder"); Attribute groupAttr = setUpGroupAttribute(); Attribute groupResourceAttr = setUpGroupResourceAttribute(); AttributeDefinition groupAttrDef = setUpGroupAttributeDefinition(); AttributeDefinition resourceAttrDef = setUpResourceAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); cacheManager.setAttribute(groupResourceAttr, groupHolder, resourceHolder); List<Integer> attributeIds = new ArrayList<>(); attributeIds.add(groupAttr.getId()); attributeIds.add(groupResourceAttr.getId()); attributeIds.add(groupAttrDef.getId()); attributeIds.add(resourceAttrDef.getId()); List<Attribute> attrs = cacheManager.getAttributesByIds(attributeIds, groupHolder); assertTrue("result should contain group attribute", attrs.contains(groupAttr)); <START> assertTrue("result should contain group attribute definition", attrs.contains(new Attribute(groupAttrDef))); <END> assertTrue("it should return 2 attributes", attrs.size() == 2); }</code><technical_language>above</technical_language>

Target:
public void getAttributesByIdsAndPrimaryHolder() throws Exception { System.out.println(CLASS_NAME + "getAttributesByIdsAndPrimaryHolder"); Attribute groupAttr = setUpGroupAttribute(); Attribute groupResourceAttr = setUpGroupResourceAttribute(); AttributeDefinition groupAttrDef = setUpGroupAttributeDefinition(); AttributeDefinition resourceAttrDef = setUpResourceAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); cacheManager.setAttribute(groupResourceAttr, groupHolder, resourceHolder); List<Integer> attributeIds = new ArrayList<>(); attributeIds.add(groupAttr.getId()); attributeIds.add(groupResourceAttr.getId()); attributeIds.add(groupAttrDef.getId()); attributeIds.add(resourceAttrDef.getId()); List<Attribute> attrs = cacheManager.getAttributesByIds(attributeIds, groupHolder); assertTrue("result should contain group attribute", attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(groupAttrDef)); assertTrue("it should return 2 attributes", attrs.size() == 2); }
Source:
<code>public Date getDate() { if (Objects.isNull(date) && Objects.nonNull(getValue())) { try { date = new SimpleDateFormat("yyyy-mm-dd").parse(getValue()); } catch (ParseException e) { <START> logger.error(e.getLocalizedMessage()); <END> } } return date; }</code><technical_language>For error logger stack trace is quiet wanted: suggestion logger.error(e.getLocalizedMessage(), e);</technical_language>

Target:
public Date getDate() { if (Objects.isNull(date) && Objects.nonNull(getValue())) { try { date = new SimpleDateFormat("yyyy-mm-dd").parse(getValue()); } catch (ParseException e) { logger.error(e.getLocalizedMessage(), e); } } return date; }
Source:
<code>public boolean removeVertex(final V v) { final Set<V> neighbors = adjacent.remove(v); if (neighbors != null) { inDegrees.remove(v); for (final V neighbor : neighbors) { final int inDegree = inDegrees.get(neighbor) - 1; inDegrees.put(neighbor, inDegree); if (inDegree == 0) { rootVertices.add(neighbor); } } rootVertices.remove(v); return true; } else { <START> LOG.log(Level.WARNING, "The vertex {0} does exists", new Object[]{v}); <END> return false; } }</code><technical_language>object array replaced a value</technical_language>

Target:
public boolean removeVertex(final V v) { final Set<V> neighbors = adjacent.remove(v); if (neighbors != null) { inDegrees.remove(v); for (final V neighbor : neighbors) { final int inDegree = inDegrees.get(neighbor) - 1; inDegrees.put(neighbor, inDegree); if (inDegree == 0) { rootVertices.add(neighbor); } } rootVertices.remove(v); return true; } else { LOG.log(Level.WARNING, "The vertex {0} does exists", v); return false; } }