auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static boolean boundedShutdown(List<Runnable> shutdownTasks, String message, long timeoutMs) { ExecutorService shutdownExecutorService = Executors.newCachedThreadPool(new ThreadFactory() { private final AtomicInteger counter = new AtomicInteger(0); @Override public Thread newThread(Runnable r) { Thread thread = new Thread(r); thread.setDaemon(true); thread.setName(message + "-" + counter.incrementAndGet()); return thread; } }); shutdownTasks.forEach(shutdownExecutorService::submit); shutdownExecutorService.shutdown(); try { shutdownExecutorService.awaitTermination(timeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.error("Shutdown was interrupted for " + message, e); } if (shutdownExecutorService.isTerminated()) { LOG.info("Shutdown complete for {}", message); return true; } else { LOG.error("Shutdown function for remains unfinished after timeout({}ms) or interruption", message, timeoutMs); Util.logThreadDump(message); shutdownExecutorService.shutdownNow(); return false; } }

Target:
public static boolean boundedShutdown(List<Runnable> shutdownTasks, String message, long timeoutMs) { ExecutorService shutdownExecutorService = Executors.newCachedThreadPool( new ThreadFactoryBuilder().setNameFormat(message + "-%d").setDaemon(true).build()); shutdownTasks.forEach(shutdownExecutorService::submit); shutdownExecutorService.shutdown(); try { shutdownExecutorService.awaitTermination(timeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.error("Shutdown was interrupted for " + message, e); } if (shutdownExecutorService.isTerminated()) { LOG.info("Shutdown complete for {}", message); return true; } else { LOG.error("Shutdown function for remains unfinished after timeout({}ms) or interruption", message, timeoutMs); Util.logThreadDump(message); shutdownExecutorService.shutdownNow(); return false; } }
Source:
public SystemStreamPartitionGrouper getSystemStreamPartitionGrouper(Config config) { if (!(new TaskConfigJava(config).getBroadcastSystemStreams().isEmpty())) { throw new ConfigException("The job configured with AllSspToSingleTaskGrouper cannot have broadcast streams."); } String processors = config.get(JobConfig.PROCESSOR_LIST()); List<String> processorList = Arrays.asList(processors.split(",")); return new AllSspToSingleTaskGrouper(processorList); }

Target:
public SystemStreamPartitionGrouper getSystemStreamPartitionGrouper(Config config) { if (!(new TaskConfigJava(config).getBroadcastSystemStreams().isEmpty())) { throw new ConfigException("The job configured with AllSspToSingleTaskGrouper cannot have broadcast streams."); } String processors = config.get(JobConfig.PROCESSOR_LIST()); List<String> processorList = Arrays.asList(processors.split(",")); if (processorList.isEmpty()) { throw new SamzaException("processor list cannot be empty!"); } return new AllSspToSingleTaskGrouper(processorList); }
Source:
public void setData(IComponent component){ if ( !(component instanceof ISequential ) ) return; this.rootComponent = component; mData.clear(); this.sections = new SectionRow[0]; if ( rootComponent != null ) { ISequential course = (ISequential)rootComponent; int sectionsNumber = course.getVerticals().size(); sections = new SectionRow[sectionsNumber]; int sectionPosition = 0, listPosition = 0; for (char i=0; i<sectionsNumber; i++) { IVertical vertical = course.getVerticals().get(i); SectionRow section = new SectionRow(SectionRow.SECTION, vertical ); section.sectionPosition = sectionPosition; section.listPosition = listPosition++; sections[sectionPosition] = section; mData.add(section); List<IUnit> units = vertical.getUnits(); for (int j=0;j<units.size();j++) { SectionRow item = new SectionRow(SectionRow.ITEM, units.get(j) ); item.sectionPosition = sectionPosition; item.listPosition = listPosition++; mData.add(item); } sectionPosition++; } } notifyDataSetChanged(); }

Target:
public void setData(IComponent component){ if ( !(component instanceof ISequential ) ) return; this.rootComponent = component; mData.clear(); this.sections = new SectionRow[0]; if ( rootComponent != null ) { ISequential course = (ISequential)rootComponent; int sectionsNumber = course.getVerticals().size(); sections = new SectionRow[sectionsNumber]; int sectionPosition = 0, listPosition = 0; for (int i=0; i<sectionsNumber; i++) { IVertical vertical = course.getVerticals().get(i); SectionRow section = new SectionRow(SectionRow.SECTION, vertical ); section.sectionPosition = sectionPosition; section.listPosition = listPosition++; sections[sectionPosition] = section; mData.add(section); List<IUnit> units = vertical.getUnits(); for (int j=0;j<units.size();j++) { SectionRow item = new SectionRow(SectionRow.ITEM, units.get(j) ); item.sectionPosition = sectionPosition; item.listPosition = listPosition++; mData.add(item); } sectionPosition++; } } notifyDataSetChanged(); }
Source:
public boolean isClusterModified() { try { if (null == clusterVersion) { Cluster remoteCluster = getClusterFromBootstrapURL(clientConfig); return currentCluster.equals(remoteCluster); } else { Properties props = MetadataVersionStoreUtils.getProperties(metadataVersionSysStoreClient); long retrievedVersion = MetadataVersionStoreUtils.getVersion(props, SystemStoreConstants.CLUSTER_VERSION_KEY); return retrievedVersion > this.clusterVersion; } } catch(Exception e) { logger.info("Error retrieving cluster metadata version"); return true; } }

Target:
public boolean isClusterModified() { try { if (null == clusterVersion) { long currentTime = System.currentTimeMillis(); Cluster remoteCluster = getClusterFromBootstrapURL(clientConfig); boolean remoteClusterConsistentWithLocalOne = currentCluster.equals(remoteCluster); if (remoteClusterConsistentWithLocalOne) { clusterVersion = currentTime; } return !remoteClusterConsistentWithLocalOne; } else { Properties props = MetadataVersionStoreUtils.getProperties(metadataVersionSysStoreClient); long retrievedVersion = MetadataVersionStoreUtils.getVersion(props, SystemStoreConstants.CLUSTER_VERSION_KEY); return retrievedVersion > this.clusterVersion; } } catch(Exception e) { logger.info("Error retrieving cluster metadata version"); return true; } }
Source:
public List<HeliumPackage> getBundlePackagesToBundle() { Map<String, List<HeliumPackageSearchResult>> allPackages = getAllPackageInfo(); List<String> visOrder = heliumConf.getBundleDisplayOrder(); List<HeliumPackage> orderedBundlePackages = new LinkedList<>(); for (String name : visOrder) { List<HeliumPackageSearchResult> versions = allPackages.get(name); if (versions == null) { continue; } for (HeliumPackageSearchResult pkgInfo : versions) { if (canBundle(pkgInfo)) { orderedBundlePackages.add(pkgInfo.getPkg()); allPackages.remove(name); break; } } } for (List<HeliumPackageSearchResult> pkgInfos : allPackages.values()) { for (HeliumPackageSearchResult pkgInfo : pkgInfos) { if (canBundle(pkgInfo)) { orderedBundlePackages.add(pkgInfo.getPkg()); break; } } } return orderedBundlePackages; }

Target:
public List<HeliumPackage> getBundlePackagesToBundle() { List<String> visOrder = heliumConf.getBundleDisplayOrder(); Set<HeliumPackage> orderedBundlePackages = new HashSet<>(); List<HeliumPackage> output = new LinkedList<>(); for (String name : visOrder) { List<HeliumPackageSearchResult> versions = allPackages.get(name); if (versions == null) { continue; } for (HeliumPackageSearchResult pkgInfo : versions) { if (canBundle(pkgInfo)) { orderedBundlePackages.add(pkgInfo.getPkg()); break; } } } for (List<HeliumPackageSearchResult> pkgInfos : allPackages.values()) { for (HeliumPackageSearchResult pkgInfo : pkgInfos) { if (canBundle(pkgInfo)) { orderedBundlePackages.add(pkgInfo.getPkg()); break; } } } new LinkedList<>().addAll(orderedBundlePackages); return output; }
Source:
public void accumulate(Node node, TransferResult<CFValue, CFStore> result, String... values) { Tree tree = node.getTree(); if (tree == null) { return; } AnnotatedTypeMirror oldType = typeFactory.getAnnotatedType(tree); AnnotationMirror newAnno = getCombinedAnno(oldType, Arrays.asList(values)); insertIntoStores(result, node, newAnno); if (tree.getKind() == Kind.METHOD_INVOCATION) { MethodInvocationNode methodInvocationNode = (MethodInvocationNode) node; Node receiver = methodInvocationNode.getTarget().getReceiver(); MethodInvocationTree invokedMethod = (MethodInvocationTree) tree; while (receiver != null && typeFactory.returnsThis(invokedMethod)) { insertIntoStores(result, receiver, newAnno); Tree receiverTree = receiver.getTree(); if (receiverTree == null || receiverTree.getKind() != Tree.Kind.METHOD_INVOCATION) { break; } invokedMethod = (MethodInvocationTree) receiver.getTree(); receiver = ((MethodInvocationNode) receiver).getTarget().getReceiver(); } } }

Target:
public void accumulate(Node node, TransferResult<CFValue, CFStore> result, String... values) { List<String> valuesAsList = Arrays.asList(values); CFValue flowValue = result.getResultValue(); if (flowValue != null) { Set<AnnotationMirror> flowAnnos = flowValue.getAnnotations(); assert flowAnnos.size() <= 1; for (AnnotationMirror anno : flowAnnos) { List<String> oldFlowValues = ValueCheckerUtils.getValueOfAnnotationWithStringArgument(anno); if (oldFlowValues != null) { oldFlowValues.addAll(valuesAsList); valuesAsList = oldFlowValues; } } } AnnotationMirror newAnno = typeFactory.createAccumulatorAnnotation(valuesAsList); insertIntoStores(result, node, newAnno); Tree tree = node.getTree(); if (tree != null && tree.getKind() == Kind.METHOD_INVOCATION) { Node receiver = ((MethodInvocationNode) node).getTarget().getReceiver(); if (receiver != null && typeFactory.returnsThis((MethodInvocationTree) tree)) { accumulate(receiver, result, values); } } }
Source:
private boolean check() throws IOException { final FileFilter fileFilter = new FileFilter(this.getIncludes(), this.getExcludes()); final BundleCreator creator = new BundleCreator(this.getProject(), fileFilter); final IBundleCoverage bundle = creator.createBundle(executionDataStore); boolean passed = true; CheckConfiguration overall = check.getOverall(); CheckConfiguration classLevel = check.getEachClass(); if (classLevel!=null){ Collection<IPackageCoverage> packages = bundle.getPackages(); for (IPackageCoverage aPackage : packages) { Collection<IClassCoverage> classes = aPackage.getClasses(); for (IClassCoverage aClass : classes) { for (final CounterEntity entity : CounterEntity.values()) { passed = this.checkCounter("Class "+aClass.getName(),entity, aClass.getCounter(entity), classLevel.getRatio(entity)) && passed; } } } } if (overall!=null){ for (final CounterEntity entity : CounterEntity.values()) { passed = this.checkCounter("Project "+this.getProject().getArtifactId(),entity, bundle.getCounter(entity), overall.getRatio(entity)) && passed; } } return passed; }

Target:
private boolean check() throws IOException { final FileFilter fileFilter = new FileFilter(this.getIncludes(), this.getExcludes()); final BundleCreator creator = new BundleCreator(this.getProject(), fileFilter); final IBundleCoverage bundle = creator.createBundle(executionDataStore); int totalFailureCount = checkBundleFailures(check, bundle); logIfFailed("Bundle Coverage Checks", totalFailureCount); List<Rule> rules = check.getRules(); boolean rulesAreValid= checkRuleDefinitionIsValid(rules); if (rulesAreValid) { for (Rule rule : rules) { totalFailureCount += checkRuleFailures(rule, bundle); } return totalFailureCount==0; } return false; }
Source:
public BulkWrites getBulkWrites() throws Exception { Set<Entry<byte[], PartitionBuffer>> entries = this.buffers.entrySet(); Collection<BulkWrite> bws = new ArrayList<>(entries.size()); for (Entry<byte[], PartitionBuffer> regionEntry : this.buffers.entrySet()) { PartitionBuffer value = regionEntry.getValue(); if (value.isEmpty()) continue; BulkWrite bulkWrite = value.getBulkWrite(); bws.add(bulkWrite); Collection<KVPair> kvPairs = bulkWrite.getMutations(); for (KVPair kvPair:kvPairs) { value.remove(kvPair); } } if(bws.isEmpty()) return null; else return new BulkWrites(bws, this.txn, this.buffers.lastKey(),token); }

Target:
public BulkWrites getBulkWrites() throws Exception { Set<Entry<byte[], PartitionBuffer>> entries = this.buffers.entrySet(); Collection<BulkWrite> bws = new ArrayList<>(entries.size()); for (Entry<byte[], PartitionBuffer> regionEntry : this.buffers.entrySet()) { PartitionBuffer value = regionEntry.getValue(); if (value.isEmpty()) continue; bws.add(value.getBulkWrite()); value.clear(); } if(bws.isEmpty()) return null; else return new BulkWrites(bws, this.txn, this.buffers.lastKey(),token); }
Source:
protected GoFunctionOrMethodDeclaration findTestFunctionInContext(@NotNull PsiElement contextElement) { GoFunctionOrMethodDeclaration function = PsiTreeUtil.getNonStrictParentOfType(contextElement, GoFunctionOrMethodDeclaration.class); return function != null && GoTestFinder.isBenchmarkFunction(function) ? function : null; }

Target:
protected GoFunctionDeclaration findTestFunctionInContext(@NotNull PsiElement contextElement) { GoFunctionDeclaration function = PsiTreeUtil.getNonStrictParentOfType(contextElement, GoFunctionDeclaration.class); return function != null && GoTestFinder.isBenchmarkFunction(function) ? function : null; }
Source:
private Vector<Entry> getEntriesForCommand(String commandId, OrderedHashtable<String, String> currentSessionData, boolean includeNested) { Vector<Entry> entries = new Vector<>(); if (commandId == null) { return entries; } for (Suite s : platform.getInstalledSuites()) { List<Menu> menusWithId = s.getMenusWithId(commandId); if (menusWithId != null) { List<Menu> menusToExamine = new ArrayList<>(menusWithId); while (!menusToExamine.isEmpty()) { Menu menu = menusToExamine.remove(0); entries.addAll(getStillValidEntriesFromMenu(menu, currentSessionData)); if (includeNested) { menusToExamine.addAll(s.getMenusWithRoot(menu.getId())); } } } if (s.getEntries().containsKey(commandId)) { entries.addElement(s.getEntries().get(commandId)); } } return entries; }

Target:
private Vector<Entry> getEntriesForCommand(String commandId, OrderedHashtable<String, String> currentSessionData, boolean includeNested) { Vector<Entry> entries = new Vector<>(); if (commandId == null) { return entries; } for (Suite s : platform.getInstalledSuites()) { List<Menu> menusWithId = s.getMenusWithId(commandId); if (menusWithId != null) { Queue<Menu> menusToExamine = new LinkedList<>(menusWithId); while (!menusToExamine.isEmpty()) { Menu menu = menusToExamine.poll(); entries.addAll(getStillValidEntriesFromMenu(menu, currentSessionData)); if (includeNested) { menusToExamine.addAll(s.getMenusWithRoot(menu.getId())); } } } if (s.getEntries().containsKey(commandId)) { entries.addElement(s.getEntries().get(commandId)); } } return entries; }
Source:
public static byte[] serializeAuthenticatorUserMap( ObjectMapper objectMapper, Map<String, BasicAuthenticatorUser> userMap ) { try { return objectMapper.writeValueAsBytes(userMap); } catch (IOException ioe) { throw new ISE("WTF? Couldn't serialize userMap!"); } }

Target:
public static byte[] serializeAuthenticatorUserMap( ObjectMapper objectMapper, Map<String, BasicAuthenticatorUser> userMap ) { try { return objectMapper.writeValueAsBytes(userMap); } catch (IOException ioe) { throw new ISE(ioe, "WTF? Couldn't serialize userMap!"); } }
Source:
protected Class<?> resolveName(String name) { String result; if (name.contains(".")) { result = name; } else if (name.equals("View") || name.equals("ViewGroup")) { result = "android.view." + name; } else { result = "android.widget." + name; } if (mappings.containsKey(result)) { logger.debug(getClass().getSimpleName() + " mapping " + name + " to " + mappings.get(result)); return mappings.get(result); } try { logger.debug(getClass().getSimpleName() + " resolving " + name + " with " + result); return Class.forName(result); } catch (ClassNotFoundException e) { if (mDebugMode) { throw new RuntimeException(e); } return null; } }

Target:
protected Class<?> resolveName(String name) { String result; if (name.contains(".")) { result = name; } else if (name.equals("View") || name.equals("ViewGroup")) { result = "android.view." + name; } else { result = "android.widget." + name; } if (mappings.containsKey(result)) { logger.debug(mLoggingTag + " mapping " + name + " to " + mappings.get(result)); return mappings.get(result); } try { logger.debug(mLoggingTag + " resolving " + name + " with " + result); return Class.forName(result); } catch (ClassNotFoundException e) { if (mDebugMode) { throw new RuntimeException(e); } return null; } }
Source:
public Handler accept(final InetSocketAddress remoteAddress, final InetSocketAddress localAddress) { return buffer -> { final Header header = new Header(slice(buffer, Header.SIZE)); final Packet packet = header.parsePayload(slice(buffer, header.length - Header.SIZE)); System.out.println(packet); final BasicOutputBuffer output = new BasicOutputBuffer(); try (final BsonBinaryWriter writer = new BsonBinaryWriter(output)) { writer.writeStartDocument(); writer.writeInt32("@version", header.version); writer.writeString("@type", header.type.name()); packet.visit(new Serializer(writer)); writer.writeEndDocument(); } this.recordsDispatched.mark(); final TelemetryMessage message = new TelemetryMessage(remoteAddress, output.getByteBuffers().get(0).asNIO()); return dispatcher.send(message); }; }

Target:
public Handler accept(final InetSocketAddress remoteAddress, final InetSocketAddress localAddress) { return buffer -> { final Header header = new Header(slice(buffer, Header.SIZE)); final Packet packet = header.parsePayload(slice(buffer, header.length - Header.SIZE)); LOG.trace("Got packet: {}", packet); final BasicOutputBuffer output = new BasicOutputBuffer(); try (final BsonBinaryWriter writer = new BsonBinaryWriter(output)) { writer.writeStartDocument(); writer.writeInt32("@version", header.version); writer.writeString("@type", header.type.name()); packet.accept(new Serializer(writer)); writer.writeEndDocument(); } this.recordsDispatched.mark(); final TelemetryMessage message = new TelemetryMessage(remoteAddress, output.getByteBuffers().get(0).asNIO()); return dispatcher.send(message); }; }
Source:
public void loginAsync_errorHandlerThrows() { RealmLog.setLevel(LogLevel.INFO); SyncCredentials credentials = SyncCredentials.usernamePassword("IWantToHackYou", "GeneralPassword", false); SyncUser.loginAsync(credentials, Constants.AUTH_URL, new SyncUser.Callback() { @Override public void onSuccess(SyncUser user) { fail(); } @Override public void onError(ObjectServerError error) { assertEquals(ErrorCode.INVALID_CREDENTIALS, error.getErrorCode()); throw new IllegalArgumentException("BOOM"); } }); looperThread.postRunnableDelayed(new Runnable() { @Override public void run() { looperThread.testComplete(); } }, 1000); }

Target:
public void loginAsync_errorHandlerThrows() { final int defaultLevel = RealmLog.getLevel(); RealmLog.setLevel(LogLevel.INFO); SyncCredentials credentials = SyncCredentials.usernamePassword("IWantToHackYou", "GeneralPassword", false); SyncUser.loginAsync(credentials, Constants.AUTH_URL, new SyncUser.Callback() { @Override public void onSuccess(SyncUser user) { fail(); } @Override public void onError(ObjectServerError error) { assertEquals(ErrorCode.INVALID_CREDENTIALS, error.getErrorCode()); throw new IllegalArgumentException("BOOM"); } }); looperThread.postRunnableDelayed(new Runnable() { @Override public void run() { RealmLog.setLevel(defaultLevel); looperThread.testComplete(); } }, 1000); }
Source:
public void execute() throws MojoExecutionException { super.execute(); try { SimpleDateFormat dateFormat = null; String tagTimestamp = ""; String finalTag = tag; if ( addTimestamp ) { try { getLog().info( "Using timestamp pattern '" + timestampFormat + "'" ); dateFormat = new SimpleDateFormat( timestampFormat ); tagTimestamp = dateFormat.format( new Date() ); getLog().info( "Using timestamp '" + tagTimestamp + "'" ); } catch ( IllegalArgumentException e ) { String msg = "The timestamp format '" + timestampFormat + "' is invalid."; getLog().error( msg, e ); throw new MojoExecutionException( msg, e ); } if ( "end".equals( timestampPosition ) ) { finalTag += timestampPrefix + tagTimestamp; } else { finalTag = tagTimestamp + timestampPrefix + finalTag; } } ScmRepository repository = getScmRepository(); ScmProvider provider = getScmManager().getProviderByRepository( repository ); getLog().info( "Sign: '" + sign+ "'" ); finalTag = provider.sanitizeTagName( finalTag ); getLog().info( "Final Tag Name: '" + finalTag + "'" ); ScmTagParameters scmTagParameters = new ScmTagParameters( message ); scmTagParameters.setRemoteTagging( remoteTagging ); scmTagParameters.setPinExternals( pinExternals ); scmTagParameters.setSign( sign ); TagScmResult result = provider.tag( repository, getFileSet(), finalTag, scmTagParameters ); checkResult( result ); } catch ( IOException e ) { throw new MojoExecutionException( "Cannot run tag command : ", e ); } catch ( ScmException e ) { throw new MojoExecutionException( "Cannot run tag command : ", e ); } }

Target:
public void execute() throws MojoExecutionException { super.execute(); try { SimpleDateFormat dateFormat = null; String tagTimestamp = ""; String finalTag = tag; if ( addTimestamp ) { try { getLog().info( "Using timestamp pattern '" + timestampFormat + "'" ); dateFormat = new SimpleDateFormat( timestampFormat ); tagTimestamp = dateFormat.format( new Date() ); getLog().info( "Using timestamp '" + tagTimestamp + "'" ); } catch ( IllegalArgumentException e ) { String msg = "The timestamp format '" + timestampFormat + "' is invalid."; getLog().error( msg, e ); throw new MojoExecutionException( msg, e ); } if ( "end".equals( timestampPosition ) ) { finalTag += timestampPrefix + tagTimestamp; } else { finalTag = tagTimestamp + timestampPrefix + finalTag; } } ScmRepository repository = getScmRepository(); ScmProvider provider = getScmManager().getProviderByRepository( repository ); finalTag = provider.sanitizeTagName( finalTag ); getLog().info( "Final Tag Name: '" + finalTag + "'" ); ScmTagParameters scmTagParameters = new ScmTagParameters( message ); scmTagParameters.setRemoteTagging( remoteTagging ); scmTagParameters.setPinExternals( pinExternals ); scmTagParameters.setSign( sign ); TagScmResult result = provider.tag( repository, getFileSet(), finalTag, scmTagParameters ); checkResult( result ); } catch ( IOException e ) { throw new MojoExecutionException( "Cannot run tag command : ", e ); } catch ( ScmException e ) { throw new MojoExecutionException( "Cannot run tag command : ", e ); } }
Source:
static <T> Option<Seq<T>> sequence(Iterable<? extends Option<? extends T>> values) { Objects.requireNonNull(values, "values is null"); Stream<T> stream = Stream.empty(); for (Option<? extends T> value : values) { if (value.isEmpty()) { return Option.none(); } stream = stream.append(value.get()); } return Option.some(stream); }

Target:
static <T> Option<Seq<T>> sequence(Iterable<? extends Option<? extends T>> values) { Objects.requireNonNull(values, "values is null"); Vector<T> vector = Vector.empty(); for (Option<? extends T> value : values) { if (value.isEmpty()) { return Option.none(); } vector = vector.append(value.get()); } return Option.some(vector); }
Source:
public static void changeOutcomeSettings(OutcomeSettings settings){ outcomeSettings = settings; outcomeEventsController.setOutcomeSettings(settings); }

Target:
static void changeOutcomeSettings(OutcomeSettings settings) { outcomeSettings = settings; outcomeEventsController.setOutcomeSettings(settings); }
Source:
public void testFindProcessInstanceWithParentIdAndProcessNameEqualsToFilter() throws Exception { Map<String, Object> parameters = new HashMap<>(); Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION, parameters); Assertions.assertThat(processInstanceId).isNotNull(); HashMap<ProcessInstanceField, Comparable<?>> compareList = new HashMap<>(); compareList.put(ProcessInstanceField.PARENTPROCESSINSTANCEID, -1); compareList.put(ProcessInstanceField.PROCESSNAME, PROCESS_NAME_EVALUATION); testFindProcessInstanceWithQueryFilter(createQueryFilterEqualsTo(ProcessInstanceField.PARENTPROCESSINSTANCEID, -1), processInstanceId); }

Target:
public void testFindProcessInstanceWithParentIdAndProcessNameEqualsToFilter() throws Exception { Map<String, Object> parameters = new HashMap<>(); Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION, parameters); Assertions.assertThat(processInstanceId).isNotNull(); HashMap<ProcessInstanceField, Comparable<?>> compareList = new HashMap<>(); compareList.put(ProcessInstanceField.PARENTPROCESSINSTANCEID, -1); compareList.put(ProcessInstanceField.PROCESSNAME, PROCESS_NAME_EVALUATION); testFindProcessInstanceWithQueryFilter(createQueryFilterAndEqualsTo(compareList), processInstanceId); }
Source:
public void stripPrefixIfPresent() throws Exception { Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME)); Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME + "/")); Assert.assertEquals("test", mS3UnderFileSystem.stripPrefixIfPresent("test")); Assert.assertEquals("test", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME + "/test")); }

Target:
public void stripPrefixIfPresent() throws Exception { Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME)); Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME + "/")); Assert.assertEquals("test/", mS3UnderFileSystem.stripPrefixIfPresent("s3a://" + BUCKET_NAME + "/test/")); Assert.assertEquals("test", mS3UnderFileSystem.stripPrefixIfPresent("test")); Assert.assertEquals("test/", mS3UnderFileSystem.stripPrefixIfPresent("test/")); Assert.assertEquals("test/", mS3UnderFileSystem.stripPrefixIfPresent("/test/")); Assert.assertEquals("test", mS3UnderFileSystem.stripPrefixIfPresent("/test")); Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("")); Assert.assertEquals("", mS3UnderFileSystem.stripPrefixIfPresent("/")); }
Source:
public void testGetAllWithCompatibility() { RemoteCache<String, String> cache = client(0).getCache(); HashMap<String, String> cachedValues = new HashMap<>(); for(int i=0; i<100; i++){ String key = String.format("key-%d", i); String value = String.format("value-%d", i); cache.put(key, value); cachedValues.put(key, value); } System.out.println("Key's added"); Map<String, String> values = cache.getAll(cachedValues.keySet()); System.out.println("done"); assertEquals(cachedValues.size(), values.size()); for(String key : values.keySet()){ assertEquals(cachedValues.get(key), values.get(key)); } }

Target:
public void testGetAllWithCompatibility() { RemoteCache<String, String> cache = client(0).getCache(); HashMap<String, String> cachedValues = new HashMap<>(); for(int i=0; i<100; i++){ String key = String.format("key-%d", i); String value = String.format("value-%d", i); cache.put(key, value); cachedValues.put(key, value); } Map<String, String> values = cache.getAll(cachedValues.keySet()); assertEquals(cachedValues.size(), values.size()); for(String key : values.keySet()){ assertEquals(cachedValues.get(key), values.get(key)); } }
Source:
@Override public void remove() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); if (isEmpty()) throw new NoSuchElementException(); if (nextElementIndex != 1) { throw new UnsupportedOperationException("Removal is only permitted from the head."); } try { QueueFile.this.remove(); } catch (IOException e) { throw new RuntimeException("todo: throw a proper error", e); } expectedModCount = modCount; nextElementIndex--; }

Target:
@Override public void remove() { checkForComodification(); if (isEmpty()) throw new NoSuchElementException(); if (nextElementIndex != 1) { throw new UnsupportedOperationException("Removal is only permitted from the head."); } try { QueueFile.this.remove(); } catch (IOException e) { throw new RuntimeException("todo: throw a proper error", e); } expectedModCount = modCount; nextElementIndex--; }
Source:
public void run() { if (this.state.compareAndSet(NEW, RUNNING)) { try { renameThread("RUNNING"); this.threadRef.set(Thread.currentThread()); this.jedis.sadd(key(WORKERS), this.name); this.jedis.set(key(WORKER, this.name, STARTED), new SimpleDateFormat(DATE_FORMAT).format(new Date())); this.listenerDelegate.fireEvent(WORKER_START, this, null, null, null, null, null); this.popScriptHash.set(this.jedis.scriptLoad(ScriptUtils.readScript(POP_LUA))); this.lpoplpushScriptHash.set(this.jedis.scriptLoad(ScriptUtils.readScript(LPOPLPUSH_LUA))); this.multiPriorityQueuesScriptHash.set(this.jedis.scriptLoad(ScriptUtils.readScript(LPOPLPUSH_LUA))); poll(); } catch (Exception ex) { LOG.error("Uncaught exception in worker run-loop!", ex); this.listenerDelegate.fireEvent(WORKER_ERROR, this, null, null, null, null, ex); } finally { renameThread("STOPPING"); this.listenerDelegate.fireEvent(WORKER_STOP, this, null, null, null, null, null); this.jedis.srem(key(WORKERS), this.name); this.jedis.del(key(WORKER, this.name), key(WORKER, this.name, STARTED), key(STAT, FAILED, this.name), key(STAT, PROCESSED, this.name)); this.jedis.quit(); this.threadRef.set(null); } } else if (RUNNING.equals(this.state.get())) { throw new IllegalStateException("This WorkerImpl is already running"); } else { throw new IllegalStateException("This WorkerImpl is shutdown"); } }

Target:
public void run() { if (this.state.compareAndSet(NEW, RUNNING)) { try { renameThread("RUNNING"); this.threadRef.set(Thread.currentThread()); this.jedis.sadd(key(WORKERS), this.name); this.jedis.set(key(WORKER, this.name, STARTED), new SimpleDateFormat(DATE_FORMAT).format(new Date())); this.listenerDelegate.fireEvent(WORKER_START, this, null, null, null, null, null); this.popScriptHash.set(this.jedis.scriptLoad(ScriptUtils.readScript(POP_LUA))); this.lpoplpushScriptHash.set(this.jedis.scriptLoad(ScriptUtils.readScript(LPOPLPUSH_LUA))); this.multiPriorityQueuesScriptHash.set(this.jedis.scriptLoad(ScriptUtils.readScript(POP_FROM_MULTIPLE_PRIO_QUEUES))); poll(); } catch (Exception ex) { LOG.error("Uncaught exception in worker run-loop!", ex); this.listenerDelegate.fireEvent(WORKER_ERROR, this, null, null, null, null, ex); } finally { renameThread("STOPPING"); this.listenerDelegate.fireEvent(WORKER_STOP, this, null, null, null, null, null); this.jedis.srem(key(WORKERS), this.name); this.jedis.del(key(WORKER, this.name), key(WORKER, this.name, STARTED), key(STAT, FAILED, this.name), key(STAT, PROCESSED, this.name)); this.jedis.quit(); this.threadRef.set(null); } } else if (RUNNING.equals(this.state.get())) { throw new IllegalStateException("This WorkerImpl is already running"); } else { throw new IllegalStateException("This WorkerImpl is shutdown"); } }
Source:
void startBundles(List<Bundle> tobestarted) throws Exception { refresh(); trace("bundles administered %s", installedBundles.keySet()); if (security) policy.setDefaultPermissions(null); if (padmin != null && padmin.resolveBundles(null) == false) { List<String> failed = new ArrayList<>(); for (Bundle b : installedBundles.values()) { try { if (b.getState() == Bundle.INSTALLED) { b.start(); } } catch (Exception e) { failed.add(b.getSymbolicName() + "-" + b.getVersion() + " " + e + "\n"); } } error("could not resolve the bundles: %s", failed); } trace("Will start bundles: %s", tobestarted); List<Bundle> all = new ArrayList<>(tobestarted); all.addAll(wantsToBeStarted); int startOptions = Bundle.START_ACTIVATION_POLICY; if (parms.eagerActivation) { startOptions = 0; } for (Bundle b : tobestarted) { try { trace("starting %s", b.getSymbolicName()); if (!isFragment(b)) b.start(startOptions); trace("started %s", b.getSymbolicName()); } catch (BundleException e) { wantsToBeStarted.add(b); error("Failed to start bundle %s-%s, exception %s", b.getSymbolicName(), b.getVersion(), e); } } }

Target:
void startBundles(List<Bundle> tobestarted) throws Exception { refresh(); trace("bundles administered %s", installedBundles.keySet()); if (security) policy.setDefaultPermissions(null); if (padmin != null && padmin.resolveBundles(null) == false) { List<String> failed = new ArrayList<>(); for (Bundle b : installedBundles.values()) { try { if (b.getState() == Bundle.INSTALLED) { b.start(); } } catch (Exception e) { failed.add(b.getSymbolicName() + "-" + b.getVersion() + " " + e + "\n"); } } error("could not resolve the bundles: %s", failed); } trace("Will start bundles: %s", tobestarted); List<Bundle> all = new ArrayList<>(tobestarted); all.addAll(wantsToBeStarted); int startOptions = Bundle.START_ACTIVATION_POLICY; if (parms.activationEager) { startOptions &= ~Bundle.START_ACTIVATION_POLICY; } for (Bundle b : tobestarted) { try { trace("starting %s", b.getSymbolicName()); if (!isFragment(b)) b.start(startOptions); trace("started %s", b.getSymbolicName()); } catch (BundleException e) { wantsToBeStarted.add(b); error("Failed to start bundle %s-%s, exception %s", b.getSymbolicName(), b.getVersion(), e); } } }
Source:
private JClassType getPreBootstrapper() throws UnableToCompleteException { String typeName = lookupTypeNameByProperty("gwtp.prebootstrapper"); if (typeName == null) { return null; } return findAndVerifyType(typeName, PreBootstrapper.class); }

Target:
private JClassType getPreBootstrapper() throws UnableToCompleteException { String typeName = lookupTypeNameByProperty(PROPERTY_NAME_PREBOOTSTRAPPER); if (typeName == null) { return null; } return findAndVerifyType(typeName, PreBootstrapper.class); }
Source:
public String toString() { return "RuleImpl '" + getRule().uid + "' has been removed."; }

Target:
public String toString() { return "Rule '" + getRule().uid + "' has been removed."; }
Source:
private Node createGroupColorRegion(BibEntryTableViewModel entry, List<AbstractGroup> matchedGroups) { List<Color> groupColors = matchedGroups.stream() .flatMap(group -> OptionalUtil.toStream(group.getColor())) .collect(Collectors.toList()); if (!groupColors.isEmpty()) { HBox container = new HBox(); container.setSpacing(2); container.setMinWidth(10); container.setAlignment(Pos.CENTER); for (Color groupColor : groupColors) { Rectangle groupRectangle = new Rectangle(); groupRectangle.setWidth(3); groupRectangle.setHeight(18); groupRectangle.setFill(groupColor); groupRectangle.setStroke(Color.DARKGRAY); groupRectangle.setStrokeWidth(1); container.getChildren().add(groupRectangle); } String matchedGroupsString = matchedGroups.stream() .map(AbstractGroup::getName) .collect(Collectors.joining(", ")); Tooltip tooltip = new Tooltip(Localization.lang("Entry is contained in the following groups:") + "\n" + matchedGroupsString); Tooltip.install(container, tooltip); return container; } return new Pane(); }

Target:
private Node createGroupColorRegion(BibEntryTableViewModel entry, List<AbstractGroup> matchedGroups) { List<Color> groupColors = matchedGroups.stream() .flatMap(group -> OptionalUtil.toStream(group.getColor())) .collect(Collectors.toList()); if (!groupColors.isEmpty()) { HBox container = new HBox(); container.setSpacing(2); container.setMinWidth(10); container.setAlignment(Pos.CENTER_LEFT); container.setPadding(new Insets(0, 2, 0, 2)); for (Color groupColor : groupColors) { Rectangle groupRectangle = new Rectangle(); groupRectangle.setWidth(3); groupRectangle.setHeight(18); groupRectangle.setFill(groupColor); groupRectangle.setStroke(Color.DARKGRAY); groupRectangle.setStrokeWidth(1); container.getChildren().add(groupRectangle); } String matchedGroupsString = matchedGroups.stream() .map(AbstractGroup::getName) .collect(Collectors.joining(", ")); Tooltip tooltip = new Tooltip(Localization.lang("Entry is contained in the following groups:") + "\n" + matchedGroupsString); Tooltip.install(container, tooltip); return container; } return new Pane(); }
Source:
protected String generateUserAgent() { String prodName = null; String version = null; IPropertiesProvider productInfo = PropertiesHelper.getPropertiesProvider(); if(productInfo instanceof VersionPropertiesProvider ) { VersionPropertiesProvider prov = (VersionPropertiesProvider)productInfo; prodName = prov.getContext(); version = prov.getCurrentVersion(); } else { prodName = "unknown"; version = "unknown"; } String os = System.getProperty("os.name"); String osVers = System.getProperty("os.version"); String osArch = System.getProperty("os.arch"); String javaVersion = "Java " + System.getProperty("java.version"); String inParens = String.join(";", new String[] {os, osVers, osArch, javaVersion}); String ret = prodName+"/" + version + " (" + inParens + ")"; return ret; }

Target:
protected String generateUserAgent() { String prodName = null; String version = null; IPropertiesProvider productInfo = PropertiesHelper.getPropertiesProvider(); if(productInfo instanceof VersionPropertiesProvider ) { VersionPropertiesProvider prov = (VersionPropertiesProvider)productInfo; prodName = prov.getContext(); version = prov.getCurrentVersion(); } else { prodName = "jbosstools"; version = "unknown"; } String os = System.getProperty("os.name"); String osVers = System.getProperty("os.version"); String osArch = System.getProperty("os.arch"); String javaVersion = "Java " + System.getProperty("java.version"); String inParens = String.join(";", new String[] {os, osVers, osArch, javaVersion}); String ret = prodName+"/" + version + " (" + inParens + ")"; return ret; }
Source:
public TextArgs add(Object... args) { if (positionedArgsBuilder == null) { throw new IllegalArgumentException("Positioned arguments were already accessed, to add" + "more arguments use TextArgs.copy()"); } positionedArgsBuilder.add(args); return this; }

Target:
public TextArgs add(Object... args) { return new TextArgs( ImmutableList.builder().addAll(positionedArgs).add(args).build(), namedArgs ); }
Source:
private Method checkProxy(Method methodArg, Object bean) { Method method = methodArg; if (AopUtils.isJdkDynamicProxy(bean)) { try { method = bean.getClass().getMethod(method.getName(), method.getParameterTypes()); Class<?>[] proxiedInterfaces = ((Advised) bean).getProxiedInterfaces(); for (Class<?> iface : proxiedInterfaces) { try { method = iface.getMethod(method.getName(), method.getParameterTypes()); break; } catch (NoSuchMethodException noMethod) { } } } catch (SecurityException ex) { ReflectionUtils.handleReflectionException(ex); } catch (NoSuchMethodException ex) { throw new IllegalStateException(String.format( "@StreamListener method '%s' found on bean target class '%s', " + "but not found in any interface(s) for bean JDK proxy. Either " + "pull the method up to an interface or switch to subclass (CGLIB) " + "proxies by setting proxy-target-class/proxyTargetClass " + "attribute to 'true'", method.getName(), method.getDeclaringClass().getSimpleName()), ex); } } return method; }

Target:
private Method checkProxy(Method methodArg, Object bean) { Method method = methodArg; if (AopUtils.isJdkDynamicProxy(bean)) { try { method = bean.getClass().getMethod(method.getName(), method.getParameterTypes()); Class<?>[] proxiedInterfaces = ((Advised) bean).getProxiedInterfaces(); for (Class<?> iface : proxiedInterfaces) { try { method = iface.getMethod(method.getName(), method.getParameterTypes()); break; } catch (NoSuchMethodException noMethod) { } } } catch (SecurityException ex) { ReflectionUtils.handleReflectionException(ex); } catch (NoSuchMethodException ex) { throw new IllegalStateException(String.format( "@StreamListener method '%s' found on bean target class '%s', " + "but not found in any interface(s) for bean JDK proxy. Either " + "pull the method up to an interface or switch to subclass (CGLIB) " + "proxies by setting proxy-target-class/proxyTargetClass attribute to 'true'", method.getName(), method.getDeclaringClass().getSimpleName()), ex); } } return method; }
Source:
public void testVariableLocalDir() throws Exception { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(VariableLocalConfig.class); StandardConfig config = ctx.getBean(StandardConfig.class); assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue(); List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList()); assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1); File f1 = new File(tmpDir + File.separator + "foo" + File.separator + "f1"); assertThat(f1.exists()).isTrue(); File f2 = new File(tmpDir + File.separator + "baz" + File.separator + "f2"); assertThat(f2.exists()).isTrue(); File f3 = new File(tmpDir + File.separator + "fiz" + File.separator + "f3"); assertThat(f3.exists()).isTrue(); assertThat(f1.delete()).isTrue(); assertThat(f2.delete()).isTrue(); assertThat(f3.delete()).isTrue(); assertThat(f1.getParentFile().delete()).isTrue(); assertThat(f2.getParentFile().delete()).isTrue(); assertThat(f3.getParentFile().delete()).isTrue(); assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3); ctx.close(); }

Target:
public void testVariableLocalDir() throws Exception { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(VariableLocalConfig.class); StandardConfig config = ctx.getBean(StandardConfig.class); assertThat(config.latch.await(10, TimeUnit.SECONDS)).isTrue(); List<Integer> sfCalls = config.sessionSources.stream().limit(17).collect(Collectors.toList()); assertThat(sfCalls).containsExactly(1, 1, 1, 2, 2, 2, 3, 3, 3, 1, 1, 2, 2, 3, 3, 1, 1); File f1 = new File(tmpDir + File.separator + "variable" + File.separator + "foo" + File.separator + "f1"); assertThat(f1.exists()).isTrue(); File f2 = new File(tmpDir + File.separator + "variable" + File.separator + "baz" + File.separator + "f2"); assertThat(f2.exists()).isTrue(); File f3 = new File(tmpDir + File.separator + "variable" + File.separator + "fiz" + File.separator + "f3"); assertThat(f3.exists()).isTrue(); assertThat(f1.delete()).isTrue(); assertThat(f2.delete()).isTrue(); assertThat(f3.delete()).isTrue(); assertThat(f1.getParentFile().delete()).isTrue(); assertThat(f2.getParentFile().delete()).isTrue(); assertThat(f3.getParentFile().delete()).isTrue(); assertThat(ctx.getBean("files", QueueChannel.class).getQueueSize()).isEqualTo(3); ctx.close(); }
Source:
public void setup(OperatorContext context) { super.setup(context); intializeDSLContext(); if (scanService == null) { scanService = Executors.newScheduledThreadPool(partitionCount); } spinMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); execute = true; cause = new AtomicReference<Throwable>(); emitQueue = new LinkedBlockingDeque<>(queueCapacity); operatorId = context.getId(); windowManager.setup(context); }

Target:
public void setup(OperatorContext context) { super.setup(context); intializeDSLContext(); if (scanService == null) { scanService = Executors.newScheduledThreadPool(1); } execute = true; emitQueue = new LinkedBlockingDeque<>(queueCapacity); operatorId = context.getId(); windowManager.setup(context); }
Source:
private RawText getRawText(ObjectId id, Repository repo) throws IOException { if (id.equals(ObjectId.zeroId())) return new RawText(new byte[] {}); return new RawText(repo.openBlob(id).getCachedBytes()); }

Target:
private RawText getRawText(ObjectId id, Repository repo) throws IOException { if (id.equals(ObjectId.zeroId())) { return new RawText(new byte[] {}); } return new RawText(repo.openBlob(id).getCachedBytes()); }
Source:
public synchronized void save() throws IOException, FormValidation { if (! isIdOrFullnameAllowed(id)) { throw FormValidation.error(Messages.User_IllegalUsername(id)); } if (! isIdOrFullnameAllowed(fullName)) { throw FormValidation.error(Messages.User_IllegalFullname(fullName)); } if(BulkChange.contains(this)) return; synchronized (saving) { saving.add(this); } try { getConfigFile().write(this); } finally { synchronized (saving) { saving.remove(this); } } SaveableListener.fireOnChange(this, getConfigFile()); }

Target:
public synchronized void save() throws IOException, FormValidation { if (! isIdOrFullnameAllowed(id)) { throw FormValidation.error(Messages.User_IllegalUsername(id)); } if (! isIdOrFullnameAllowed(fullName)) { throw FormValidation.error(Messages.User_IllegalFullname(fullName)); } if(BulkChange.contains(this)) return; getConfigFile().write(this); SaveableListener.fireOnChange(this, getConfigFile()); }
Source:
public JmsConfiguration create() { final JmsConfiguration configuration = new JmsConfiguration(); if (this.messageListener == null) { configuration.setJmsTemplate(this.jmsTemplate()); } configuration.setRedeliveryPolicy(this.redeliveryPolicy()); if (this.messageListener != null) { configuration.setMessageListenerContainer(this.messageListenerContainer()); } return configuration; }

Target:
public JmsConfiguration create() { final JmsConfiguration configuration = new JmsConfiguration(); configuration.setJmsTemplate(this.jmsTemplate()); configuration.setRedeliveryPolicy(this.redeliveryPolicy()); if (this.messageListener != null) { configuration.setMessageListenerContainer(this.messageListenerContainer()); } return configuration; }
Source:
public Boolean isMavenInstalled() { String oldProjectPath = projectPath; projectPath = System.getProperty("user.home"); MavenResult res = excuteCommand("-version"); projectPath = oldProjectPath; if (res.isSuccess() && res.getOutput().contains("Apache Maven")) { return true; } else if (res.getOutput().contains("M2_HOME is set to an invalid directory")) { throw new IllegalStateException("M2_HOME variable is incorrect"); } return false; }

Target:
public Boolean isMavenInstalled() { if (new File(System.getProperty("karaf.data") + "/apache-maven-" + readMvnVersionFromPropFile()).exists()) { return true; } return false; }
Source:
private List<Constraint> flowFromLearnedConstraints(ExplodedGraph.Node currentNode) { List<Constraint> learnedConstraints = currentNode.getLearnedConstraints().stream() .filter(lc -> lc.getSv().equals(symbolicValue)) .map(ExplodedGraph.Node.LearnedConstraint::getConstraint) .collect(Collectors.toList()); final ExplodedGraph.Node parent = currentNode.parent(); learnedConstraints.stream() .filter(addToFlow.and(Objects::nonNull)) .forEach(lc -> { flow.add(location(parent, learnedConstraintMessage(lc, currentNode, parent))); if (parent.programPoint.syntaxTree().is(Tree.Kind.METHOD_INVOCATION)) { List<MethodYield> usedMethodYields = currentNode.usedMethodYields(parent); if (!usedMethodYields.isEmpty()) { flow.addAll(flowFromMethodInvocation(usedMethodYields, parent)); } } }); return learnedConstraints; }

Target:
private List<Constraint> flowFromLearnedConstraints(ExplodedGraph.Node currentNode) { List<Constraint> learnedConstraints = currentNode.getLearnedConstraints().stream() .filter(lc -> lc.getSv().equals(symbolicValue)) .map(ExplodedGraph.Node.LearnedConstraint::getConstraint) .collect(Collectors.toList()); final ExplodedGraph.Node parent = currentNode.parent(); learnedConstraints.stream() .filter(addToFlow.and(Objects::nonNull)) .forEach(lc -> { flow.add(location(parent, learnedConstraintMessage(lc, currentNode, parent))); if (parent.programPoint.syntaxTree().is(Tree.Kind.METHOD_INVOCATION)) { MethodYield selectedMethodYields = currentNode.selectedMethodYield(parent); if (selectedMethodYields != null) { flow.addAll(flowFromMethodInvocation(selectedMethodYields, parent)); } } }); return learnedConstraints; }
Source:
private void updateRepo(ObjectId tagId) throws TeamException { String refName = Constants.R_TAGS + tag.getTag(); try { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); if (updateResult != Result.NEW && updateResult != Result.FORCED) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag(), updateResult)); } } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag(), e.getMessage()), e); } }

Target:
private void updateRepo(ObjectId tagId) throws TeamException { String refName = Constants.R_TAGS + tag.getTag(); try { RefUpdate tagRef = repo.updateRef(refName); tagRef.setNewObjectId(tagId); tagRef.setForceUpdate(shouldMoveTag); Result updateResult = tagRef.update(); if (updateResult != Result.NEW && updateResult != Result.FORCED) throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag(), updateResult)); } catch (IOException e) { throw new TeamException(NLS.bind(CoreText.TagOperation_taggingFailure, tag.getTag(), e.getMessage()), e); } }