auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testSingleChildOfSpan() { TestTraceReporter reporter = new TestTraceReporter(); APMTracer tracer = new APMTracer(reporter); Span parentSpan = tracer.buildSpan("ParentSpan") .start(); Span childSpan = tracer.buildSpan("ChildSpan") .asChildOf(parentSpan) .start(); childSpan.finish(); parentSpan.finish(); assertEquals(1, reporter.getTraces().size()); Trace trace = reporter.getTraces().get(0); assertEquals(1, trace.getNodes().size()); assertEquals(Component.class, trace.getNodes().get(0).getClass()); Component parentComponent = (Component) trace.getNodes().get(0); assertTrue(parentComponent.getCorrelationIds().isEmpty()); assertEquals(1, parentComponent.getNodes().size()); assertEquals(Component.class, parentComponent.getNodes().get(0).getClass()); Component childComponent = (Component) parentComponent.getNodes().get(0); assertTrue(childComponent.getCorrelationIds().isEmpty()); assertEquals(0, childComponent.getNodes().size()); }

Target:
public void testSingleChildOfSpan() { TestTraceReporter reporter = new TestTraceReporter(); Tracer tracer = new APMTracer(reporter); Span parentSpan = tracer.buildSpan("ParentSpan") .start(); Span childSpan = tracer.buildSpan("ChildSpan") .asChildOf(parentSpan) .start(); childSpan.finish(); parentSpan.finish(); assertEquals(1, reporter.getTraces().size()); Trace trace = reporter.getTraces().get(0); assertEquals(1, trace.getNodes().size()); assertEquals(Component.class, trace.getNodes().get(0).getClass()); Component parentComponent = (Component) trace.getNodes().get(0); assertTrue(parentComponent.getCorrelationIds().isEmpty()); assertEquals(1, parentComponent.getNodes().size()); assertEquals(Component.class, parentComponent.getNodes().get(0).getClass()); Component childComponent = (Component) parentComponent.getNodes().get(0); assertTrue(childComponent.getCorrelationIds().isEmpty()); assertEquals(0, childComponent.getNodes().size()); }
Source:
private void atomicWriteToFile(String content, File file) throws IOException { File tempFile = Files.createTempFile(file.getName(), null).toFile(); FileOutputStream out = new FileOutputStream(tempFile); try { IOUtils.write(content, out); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } out.close(); FileSystem defaultFileSystem = FileSystems.getDefault(); Path destinationFilePath = defaultFileSystem.getPath(file.getCanonicalPath()); try { file.getParentFile().mkdirs(); Path tempDestinationFile = defaultFileSystem.getPath(file.getCanonicalPath() + ".tmp"); Files.move(tempFile.toPath(), tempDestinationFile); Files.move(tempDestinationFile, destinationFilePath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } }

Target:
static void atomicWriteToFile(String content, File file) throws IOException { FileSystem defaultFileSystem = FileSystems.getDefault(); Path destinationFilePath = defaultFileSystem.getPath(file.getCanonicalPath()); File tempFile = Files.createTempFile(destinationFilePath.getParent(), file.getName(), null).toFile(); try (FileOutputStream out = new FileOutputStream(tempFile)) { IOUtils.write(content, out); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } try { file.getParentFile().mkdirs(); Files.move(tempFile.toPath(), destinationFilePath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException iox) { if (!tempFile.delete()) { tempFile.deleteOnExit(); } throw iox; } }
Source:
public void testAlwaysMeteredVpnWithNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = ensureWifiConnected(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = null; String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }

Target:
public void testAlwaysMeteredVpnWithNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = null; String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }
Source:
protected void setNetworkParameters(HWNetworkStore netstore, NetworkInterface netint) throws SocketException { Enumeration<InetAddress> addresses; StringBuilder sb; byte[] mac; mac = netint.getHardwareAddress(); netstore.setName(netint.getDisplayName()); sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? ":" : "")); } netstore.setMacaddr(sb.toString()); addresses = netint.getInetAddresses(); for (InetAddress address : Collections.list(addresses)) { if (address.getHostAddress().contains(":")) { netstore.setIpv6addr( (address.getHostAddress().split("%")[0] == null) ? "Unknown" : address.getHostAddress().split("%")[0]); } else { netstore.setIpaddr( (address.getHostAddress() == null) ? "Unknown" : address.getHostAddress()); } } }

Target:
protected void setNetworkParameters(HWNetworkStore netstore, NetworkInterface netint) throws SocketException { Enumeration<InetAddress> addresses; StringBuilder sb; byte[] mac; mac = netint.getHardwareAddress(); netstore.setName(netint.getName()); netstore.setDisplayName(netint.getDisplayName()); sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? ":" : "")); } netstore.setMacaddr(sb.toString()); netstore.setIpaddr("Unknown"); netstore.setIpv6addr("unknown"); addresses = netint.getInetAddresses(); for (InetAddress address : Collections.list(addresses)) { if (address.getHostAddress().contains(":")) { netstore.setIpv6addr(address.getHostAddress().split("%")[0]); } else { netstore.setIpaddr(address.getHostAddress()); } } }
Source:
protected TabbedPanel2 getHttpsInfoTabsPanel() { if (httpsInfoTabsPanel == null) { httpsInfoTabsPanel = new TabbedPanel2() { private static final long serialVersionUID = -1422894398829082869L; @Override public void setVisible(Component component, boolean visible) { if (!visible) { super.remove(component); } } }; } return httpsInfoTabsPanel; }

Target:
protected TabbedPanel2 getHttpsInfoTabsPanel() { if (httpsInfoTabsPanel == null) { httpsInfoTabsPanel = new TabbedPanel2() { private static final long serialVersionUID = -1422894398829082869L; @Override public void setVisible(Component component, boolean visible) { if (!visible) { removeTab((AbstractPanel) component); } } }; } return httpsInfoTabsPanel; }
Source:
private Object getValue(Monitor<?> monitor) { try { if (limiter != null) { final MonitorValueCallable c = new MonitorValueCallable(monitor); return limiter.callWithTimeout(c, 1, TimeUnit.SECONDS); } else { return monitor.getValue(); } } catch (TimeLimiter.UncheckedTimeoutException e) { LOGGER.warn("timeout trying to get value for {}", monitor.getConfig()); TIMEOUT_ERRORS.increment(); } catch (Exception e) { LOGGER.warn("failed to get value for " + monitor.getConfig(), e); } return null; }

Target:
private Object getValue(Monitor<?> monitor) { try { if (limiter != null) { final MonitorValueCallable c = new MonitorValueCallable(monitor); return limiter.callWithTimeout(c, 1, TimeUnit.SECONDS); } else { return monitor.getValue(); } } catch (TimeLimiter.UncheckedTimeoutException e) { LOGGER.warn("timeout trying to get value for {}", monitor.getConfig()); TIMEOUT_ERROR.increment(); } catch (Exception e) { LOGGER.warn("failed to get value for " + monitor.getConfig(), e); DynamicCounter.increment(GET_VALUE_ERROR, "id", e.getClass().getSimpleName()); } return null; }
Source:
private void setUpShareActionProvider(Menu menu) { getMenuInflater().inflate(R.menu.menu_share, menu); MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (ShareActionProvider)item.getActionProvider(); setShareIntent(); }

Target:
private void setUpShareActionProvider(Menu menu) { getMenuInflater().inflate(R.menu.menu_share, menu); MenuItem item = menu.findItem(R.id.menu_item_share); mShareActionProvider = (CommCareShareActionProvider)item.getActionProvider(); setShareIntent(); }
Source:
static public void println(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode ) { if (onlyifverbose) { log.debug(message); } else { log.error(message); } }

Target:
static public void println(PrintStream stream, String message, boolean onlyifverbose, boolean verbosemode ) { if (onlyifverbose && verbosemode) log.warn(message); else log.info(message); }
Source:
public void delete() { visit(url("delete")); elasticSleep(1000); clickButton("Yes"); }

Target:
public void delete() { visit(url("delete")); waitFor(by.button("Yes")); clickButton("Yes"); }
Source:
public VarDeclNode getVarDeclNode(String name) throws VariableNotDeclaredException { for (Scope scope : list) { if (scope.containsKey(name)) { return scope.get(name); } } throw new VariableNotDeclaredException(); }

Target:
public VarDeclNode getVarDeclNode(String name) throws VariableNotDeclaredException { return bottomScope.getVarDeclNode(name); }
Source:
public boolean isReadComplete() { return !(buffer == null || sizeRead < sizeToRead); }

Target:
public boolean isReadComplete() { return buffer != null && sizeRead >= sizeToRead; }
Source:
public Node apply(@Nonnull Node node) { if (!matches(node)) { return ErrorNodeFactory.createInvalidType(node, NodeType.Object); } else { final List<Node> children = node.getChildren(); final List<KeyValueRule> allFieldRules = getAllFieldRules(node); final List<KeyValueRule> nonMatchingRules = new ArrayList<>(allFieldRules); for (Node child : children) { final Rule matchingRule = findMatchingRule(allFieldRules, child); if (matchingRule != null) { nonMatchingRules.remove(matchingRule); final Node newChild = matchingRule.apply(child); child.replaceWith(newChild); } else { if (!allowsAdditionalProperties) { final Collection<String> options = Collections2.transform(allFieldRules, new Function<KeyValueRule, String>() { @Override public String apply(KeyValueRule rule) { return rule.getKeyRule().getDescription(); } }); child.replaceWith(ErrorNodeFactory.createUnexpectedKey(((KeyValueNode) child).getKey(), new TreeSet<>(options))); } } } for (KeyValueRule rule : nonMatchingRules) { if (rule.isRequired(node)) { node.addChild(ErrorNodeFactory.createRequiredValueNotFound(node, rule.getKeyRule())); } else { rule.applyDefault(node); } } validateKeysUnique(node); validateExclusiveRules(node); return getResult(node); } }

Target:
public Node apply(@Nonnull Node node) { if (!matches(node)) { return ErrorNodeFactory.createInvalidType(node, NodeType.Object); } else { final List<Node> children = node.getChildren(); final List<KeyValueRule> allFieldRules = getAllFieldRules(node); final List<KeyValueRule> nonMatchingRules = new ArrayList<>(allFieldRules); for (Node child : children) { final Rule matchingRule = findMatchingRule(allFieldRules, child); if (matchingRule != null) { nonMatchingRules.remove(matchingRule); final Node newChild = matchingRule.apply(child); child.replaceWith(newChild); } else { if (!allowsAdditionalProperties) { final Collection<String> options = Collections2.transform(allFieldRules, new Function<KeyValueRule, String>() { @Override public String apply(KeyValueRule rule) { return rule.getKeyRule().getDescription(); } }); child.replaceWith(ErrorNodeFactory.createUnexpectedKey(((KeyValueNode) child).getKey(), new TreeSet<>(options))); } } } for (KeyValueRule rule : nonMatchingRules) { if (rule.isRequired(node)) { node.addChild(ErrorNodeFactory.createRequiredValueNotFound(node, rule.getKeyRule())); } else { rule.applyDefault(node); } } validateKeysUnique(node); validateExclusiveKeys(node); return getResult(node); } }
Source:
public ListResponse<? extends BaseResponse> listApis(User user, String name) { ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>(); List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>(); if (user == null) return null; if (name != null) { if (!s_apiNameDiscoveryResponseMap.containsKey(name)) return null; for (APIChecker apiChecker : _apiAccessCheckers) { try { if (!"ApiRateLimitServiceImpl".equals(apiChecker.getName())) { apiChecker.checkAccess(user, name); } } catch (Exception ex) { s_logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage()); return null; } } responseList.add(s_apiNameDiscoveryResponseMap.get(name)); } else { for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) { boolean isAllowed = true; for (APIChecker apiChecker : _apiAccessCheckers) { try { if (!"ApiRateLimitServiceImpl".equals(apiChecker.getName())) { apiChecker.checkAccess(user, apiName); } } catch (Exception ex) { isAllowed = false; } } if (isAllowed) responseList.add(s_apiNameDiscoveryResponseMap.get(apiName)); } } response.setResponses(responseList); return response; }

Target:
public ListResponse<? extends BaseResponse> listApis(User user, String name) { ListResponse<ApiDiscoveryResponse> response = new ListResponse<ApiDiscoveryResponse>(); List<ApiDiscoveryResponse> responseList = new ArrayList<ApiDiscoveryResponse>(); if (user == null) return null; if (name != null) { if (!s_apiNameDiscoveryResponseMap.containsKey(name)) return null; for (APIChecker apiChecker : _apiAccessCheckers) { try { apiChecker.checkAccess(user, name); } catch (Exception ex) { s_logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage()); return null; } } responseList.add(s_apiNameDiscoveryResponseMap.get(name)); } else { for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) { boolean isAllowed = true; for (APIChecker apiChecker : _apiAccessCheckers) { try { apiChecker.checkAccess(user, apiName); } catch (Exception ex) { isAllowed = false; } } if (isAllowed) responseList.add(s_apiNameDiscoveryResponseMap.get(apiName)); } } response.setResponses(responseList); return response; }
Source:
public void visitFunctionDeclaration(FunctionDeclarationTree tree) { NameIdentifierTree name = tree.name(); if (name.text().equalsIgnoreCase(ASSERT_FUNCTION)) { context().newIssue(this, name, "Use instead the standard \"assert\" function."); } super.visitFunctionDeclaration(tree); }

Target:
public void visitFunctionDeclaration(FunctionDeclarationTree tree) { NameIdentifierTree name = tree.name(); if (name.text().equalsIgnoreCase(ASSERT_FUNCTION)) { context().newIssue(this, name, "Use the standard \"assert\" function instead of declaring a new assert function."); } super.visitFunctionDeclaration(tree); }
Source:
public List<GerritQueryResult> executeQueryRest(IProgressMonitor monitor, final String queryString, String optionString) throws GerritException { boolean isSomeOption = optionString != null && !optionString.equals(""); try { String uri = "/changes/?q=" + URLEncoder.encode(queryString, "UTF-8") + (isSomeOption ? "&o=" + URLEncoder.encode(optionString, "UTF-8") : ""); TypeToken<List<GerritQueryResult>> queryResultListType = new TypeToken<List<GerritQueryResult>>() { }; return executeGetRestRequest(uri, queryResultListType.getType(), monitor); } catch (UnsupportedEncodingException e) { throw new GerritException(e); } }

Target:
public List<GerritQueryResult> executeQueryRest(IProgressMonitor monitor, final String queryString, String optionString) throws GerritException { try { String uri = "/changes/?q=" + URLEncoder.encode(queryString, "UTF-8"); if (StringUtils.isNotBlank(optionString)) { uri += "&o=" + URLEncoder.encode(optionString, "UTF-8"); } TypeToken<List<GerritQueryResult>> queryResultListType = new TypeToken<List<GerritQueryResult>>() { }; return executeGetRestRequest(uri, queryResultListType.getType(), monitor); } catch (UnsupportedEncodingException e) { throw new GerritException(e); } }
Source:
public static void toJSON(OutputWriter outputWriter, String pipelineName, Integer fromCounter, Integer toCounter, boolean isBisect, List<MaterialRevision> materialRevisions) { outputWriter.addLinks(addLinks()) .addChild("_embedded", embeddedWriter -> embeddedWriter.add("pipeline_name", pipelineName) .add("from_counter", fromCounter) .add("to_counter", toCounter) .add("is_bisect", isBisect) .addChildList("changes", revisionsWriter -> MaterialRevisionsRepresenter.toJSONArray(revisionsWriter, materialRevisions)) ); }

Target:
public static void toJSON(OutputWriter outputWriter, String pipelineName, Integer fromCounter, Integer toCounter, boolean isBisect, List<MaterialRevision> materialRevisions) { outputWriter.addLinks(addLinks()) .add("pipeline_name", pipelineName) .add("from_counter", fromCounter) .add("to_counter", toCounter) .add("is_bisect", isBisect) .addChildList("changes", revisionsWriter -> MaterialRevisionsRepresenter.toJSONArray(revisionsWriter, materialRevisions)); }
Source:
protected void initialize(RProjectOptions options) { RProjectConfig config = options.getConfig(); restoreWorkspace_.setSelectedIndex(config.getRestoreWorkspace()); saveWorkspace_.setSelectedIndex(config.getSaveWorkspace()); alwaysSaveHistory_.setSelectedIndex(config.getAlwaysSaveHistory()); tutorialPath_ = config.getTutorialPath(); rVersion_ = config.getRVersion(); int quitChildProcessesOnExit = config.getQuitChildProcessesOnExit(); boolean quitChildProcessesChecked = sessionInfo_.quitChildProcessesOnExit(); switch (quitChildProcessesOnExit) { case 1: quitChildProcessesChecked = true; break; case 2: quitChildProcessesChecked = false; break; } quitChildProcessesOnExit_.setValue(quitChildProcessesChecked); }

Target:
protected void initialize(RProjectOptions options) { RProjectConfig config = options.getConfig(); restoreWorkspace_.setSelectedIndex(config.getRestoreWorkspace()); saveWorkspace_.setSelectedIndex(config.getSaveWorkspace()); alwaysSaveHistory_.setSelectedIndex(config.getAlwaysSaveHistory()); tutorialPath_ = config.getTutorialPath(); rVersion_ = config.getRVersion(); int quitChildProcessesOnExit = config.getQuitChildProcessesOnExit(); boolean quitChildProcessesChecked = sessionInfo_.quitChildProcessesOnExit(); switch (quitChildProcessesOnExit) { case YES_VALUE: quitChildProcessesChecked = true; break; case NO_VALUE: quitChildProcessesChecked = false; break; } quitChildProcessesOnExit_.setValue(quitChildProcessesChecked); }
Source:
public void beforeBlockElement(ProgramState currentState, Tree element) { if (element.is(Kind.CALL_EXPRESSION)) { CallExpressionTree callExpression = (CallExpressionTree) element; SeparatedList<Tree> actualArguments = callExpression.arguments().parameters(); int nbActualArguments = actualArguments.size(); SymbolicValue calleeValue = currentState.peekStack(actualArguments.size()); if (nbActualArguments > 0 && calleeValue instanceof BuiltInFunctionSymbolicValue && mustProcess(callExpression)) { IntFunction<Constraint> signature = ((BuiltInFunctionSymbolicValue) calleeValue).signature(); int index = nbActualArguments - 1; while (index >= 0) { if (signature.apply(index) != null) { break; } index--; } int nbAllowedArguments = index + 1; if (nbActualArguments > nbAllowedArguments) { String message = getMessage(callExpression, nbAllowedArguments, nbActualArguments); addIssue(callExpression.arguments(), message); withIssue.add(callExpression); } } } }

Target:
public void beforeBlockElement(ProgramState currentState, Tree element) { if (element.is(Kind.CALL_EXPRESSION)) { CallExpressionTree callExpression = (CallExpressionTree) element; SeparatedList<Tree> actualArguments = callExpression.arguments().parameters(); int nbActualArguments = actualArguments.size(); SymbolicValue calleeValue = currentState.peekStack(nbActualArguments); if (nbActualArguments > 0 && calleeValue instanceof BuiltInFunctionSymbolicValue && shouldCheck(callExpression) && hasTooManyArguments((BuiltInFunctionSymbolicValue) calleeValue, nbActualArguments)) { int nbExpectedArguments = getNbParameters((BuiltInFunctionSymbolicValue) calleeValue); String message = getMessage(callExpression, nbExpectedArguments, nbActualArguments); addIssue(callExpression.arguments(), message); withIssue.add(callExpression); } } }
Source:
public Optional<AgentConnectionEntity> getAgentConnection(@NotBlank final String jobId) { return this.agentConnectionRepository.findByJobId(jobId); }

Target:
private Optional<AgentConnectionEntity> getAgentConnection(@NotBlank final String jobId) { return this.agentConnectionRepository.findByJobId(jobId); }
Source:
private static List<Credential> getCredentialsFromFirebaseUser(@NonNull FirebaseUser user) { if (TextUtils.isEmpty(user.getEmail()) && TextUtils.isEmpty(user.getPhoneNumber())) { return Collections.emptyList(); } List<Credential> credentials = new ArrayList<>(); for (UserInfo userInfo : user.getProviderData()) { if (FirebaseAuthProvider.PROVIDER_ID.equals(userInfo.getProviderId())) { continue; } String type = ProviderUtils.providerIdToAccountType(userInfo.getProviderId()); if (type == null) { credentials.add(CredentialUtils.buildCredential(user, "pass", null)); } else { credentials.add(CredentialUtils.buildCredentialOrThrow(user, null, type)); } } return credentials; }

Target:
private static List<Credential> getCredentialsFromFirebaseUser(@NonNull FirebaseUser user) { if (TextUtils.isEmpty(user.getEmail()) && TextUtils.isEmpty(user.getPhoneNumber())) { return Collections.emptyList(); } List<Credential> credentials = new ArrayList<>(); for (UserInfo userInfo : user.getProviderData()) { if (FirebaseAuthProvider.PROVIDER_ID.equals(userInfo.getProviderId())) { continue; } String type = ProviderUtils.providerIdToAccountType(userInfo.getProviderId()); if (type == null) { credentials.add(CredentialUtils.buildCredentialOrThrow(user, "pass", null)); } else { credentials.add(CredentialUtils.buildCredentialOrThrow(user, null, type)); } } return credentials; }
Source:
protected IModel<String> getDataModel() { return new IModel<String>() { private static final long serialVersionUID = 1L; @Override public String getObject() { Page enclosingPage = getPage(); long pageSize = WicketObjects.sizeof(enclosingPage); Bytes pageSizeInBytes = (pageSize > -1 ? Bytes.bytes(pageSize) : null); String pageSizeAsString = pageSizeInBytes != null ? pageSizeInBytes.toString() : "unknown"; return "Page: " + pageSizeAsString; } }; }

Target:
protected IModel<String> getDataModel() { return new Model<>("Inspector"); }
Source:
public void topicListeningTestCase() { try { jmsTopicTransportListener.start(topicListeningParameters); logger.info("JMS Transport Listener is starting to listen to the topic " + JMSTestConstants.TOPIC_NAME); jmsServer.publishMessagesToTopic(JMSTestConstants.TOPIC_NAME); Assert.assertEquals(topicTestMessageProcessor.getCount(), 10, "Expected message count is not received when " + "listening to topic " + JMSTestConstants.TOPIC_NAME); jmsTopicTransportListener.stop(); } catch (Exception e) { Assert.fail("Error while listening to topic"); } }

Target:
public void topicListeningTestCase() throws InterruptedException, JMSException, ServerConnectorException { jmsTopicTransportListener.start(topicListeningParameters); logger.info("JMS Transport Listener is starting to listen to the topic " + JMSTestConstants.TOPIC_NAME); jmsServer.publishMessagesToTopic(JMSTestConstants.TOPIC_NAME); Assert.assertEquals(topicTestMessageProcessor.getCount(), 10, "Expected message count is not received when " + "listening to topic " + JMSTestConstants.TOPIC_NAME); jmsTopicTransportListener.stop(); }
Source:
private StreamGraphImpl createStreamGraphWithJoin() { StreamGraphImpl streamGraph = new StreamGraphImpl(runner, config); streamGraph.setDefaultSerde(KVSerde.of(new NoOpSerde<>(), new NoOpSerde<>())); MessageStream<KV<Object, Object>> m1 = streamGraph.<KV<Object, Object>>getInputStream("input1") .map(m -> m); MessageStream<KV<Object, Object>> m2 = streamGraph.<KV<Object, Object>>getInputStream("input2") .partitionBy(m -> m.key, m -> m.value) .filter(m -> true); MessageStream<KV<Object, Object>> m3 = streamGraph.<KV<Object, Object>>getInputStream("input3") .filter(m -> true) .partitionBy(m -> m.key, m -> m.value) .map(m -> m); OutputStream<KV<Object, Object>> output1 = streamGraph.getOutputStream("output1"); OutputStream<KV<Object, Object>> output2 = streamGraph.getOutputStream("output2"); m1.join(m2, mock(JoinFunction.class), Duration.ofHours(2)).sendTo(output1); m3.join(m2, mock(JoinFunction.class), Duration.ofHours(1)).sendTo(output2); return streamGraph; }

Target:
private StreamGraphImpl createStreamGraphWithJoin() { StreamGraphImpl streamGraph = new StreamGraphImpl(runner, config); MessageStream<KV<Object, Object>> m1 = streamGraph.<KV<Object, Object>>getInputStream("input1") .map(m -> m); MessageStream<KV<Object, Object>> m2 = streamGraph.<KV<Object, Object>>getInputStream("input2") .partitionBy(m -> m.key, m -> m.value) .filter(m -> true); MessageStream<KV<Object, Object>> m3 = streamGraph.<KV<Object, Object>>getInputStream("input3") .filter(m -> true) .partitionBy(m -> m.key, m -> m.value) .map(m -> m); OutputStream<KV<Object, Object>> output1 = streamGraph.getOutputStream("output1"); OutputStream<KV<Object, Object>> output2 = streamGraph.getOutputStream("output2"); m1.join(m2, mock(JoinFunction.class), Duration.ofHours(2)).sendTo(output1); m3.join(m2, mock(JoinFunction.class), Duration.ofHours(1)).sendTo(output2); return streamGraph; }
Source:
public static boolean matches(List<Protos.Resource> offeredResources, Configuration configuration) { ImmutableMap<String, Protos.Resource> resourceMap = Maps.uniqueIndex(offeredResources, new Function<Protos.Resource, String>() { @Override public String apply(Protos.Resource input) { return input.getName(); } }); Protos.Resource cpus1 = resourceMap.get("cpus"); if (cpus1.getScalar().getValue() < configuration.resourcesCpus()) { return false; } Protos.Resource mem = resourceMap.get("mem"); if (mem.getScalar().getValue() < configuration.resourcesMemory()) { return false; } Protos.Resource ports = resourceMap.get("ports"); final TreeSet<Long> portsRange = newTreeSet(); for (final Protos.Value.Range range : ports.getRanges().getRangeList()) { final long begin = range.getBegin(); final long end = range.getEnd(); for (long l = begin; l <= end; l++) { portsRange.add(l); } } if (!portsRange.contains(configuration.httpPort().longValue())) { return false; } return true; }

Target:
public static boolean matches(List<Protos.Resource> offeredResources, Configuration configuration) { ImmutableMap<String, Protos.Resource> resourceMap = Maps.uniqueIndex(offeredResources, new Function<Protos.Resource, String>() { @Override public String apply(Protos.Resource input) { return input.getName(); } }); Protos.Resource cpus1 = resourceMap.get("cpus"); if (cpus1.getScalar().getValue() < configuration.resCpus) { return false; } Protos.Resource mem = resourceMap.get("mem"); if (mem.getScalar().getValue() < configuration.resMemory) { return false; } Protos.Resource ports = resourceMap.get("ports"); if(!checkPorts(configuration, ports)) { return false; } return true; }
Source:
public final boolean isExtendedLifetimeValid() { if (mExtendedExpiresOn != null && !StringExtensions.IsNullOrBlank(mAccessToken)) { return !isTokenExpired(mExtendedExpiresOn); } else { return false; } }

Target:
public final boolean isExtendedLifetimeValid() { if (mExtendedExpiresOn != null && !StringExtensions.IsNullOrBlank(mAccessToken)) { return !isTokenExpired(mExtendedExpiresOn); } return false; }
Source:
public void canGetExistingChatThread() { CreateChatThreadOptions threadRequest = ChatOptionsProvider.createThreadOptions( firstThreadMember.getId(), secondThreadMember.getId()); ChatThreadAsyncClient chatThreadClient = client.createChatThread(threadRequest).block(); StepVerifier.create(client.getChatThread(chatThreadClient.getChatThreadId())) .assertNext(chatThread -> { assertEquals(chatThreadClient.getChatThreadId(), chatThread.getId()); }) .verifyComplete(); }

Target:
public void canGetExistingChatThread() { CreateChatThreadOptions threadRequest = ChatOptionsProvider.createThreadOptions( firstThreadMember.getId(), secondThreadMember.getId()); AtomicReference<ChatThreadAsyncClient> chatThreadClientRef = new AtomicReference<>(); StepVerifier.create( client.createChatThread(threadRequest) .flatMap(chatThreadClient -> { chatThreadClientRef.set(chatThreadClient); return client.getChatThread(chatThreadClient.getChatThreadId()); })) .assertNext(chatThread -> { assertEquals(chatThreadClientRef.get().getChatThreadId(), chatThread.getId()); }) .verifyComplete(); }
Source:
protected Object doReadObject(final boolean unshared) throws ClassNotFoundException, IOException { final Object obj = objectPreResolver.readResolve(doReadObject(readUnsignedByte(), unshared)); if (depth == 0) { final SortedSet<Validator> validators = this.validators; if (validators != null) { this.validators = null; validatorSeq = 0; for (Validator validator : validators) { validator.getValidation().validateObject(); } } } return obj; }

Target:
protected Object doReadObject(final boolean unshared) throws ClassNotFoundException, IOException { final Object obj = doReadObject(readUnsignedByte(), unshared); if (depth == 0) { final SortedSet<Validator> validators = this.validators; if (validators != null) { this.validators = null; validatorSeq = 0; for (Validator validator : validators) { validator.getValidation().validateObject(); } } } return obj; }
Source:
public void dispose() { clearCachedSwingEditor(); }

Target:
public synchronized void dispose() { clearCachedSwingEditor(); }
Source:
public void testFacebookLoginFlow() { List<String> providers = Arrays.asList(AuthUI.FACEBOOK_PROVIDER); AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers); FirebaseUser mockFirebaseUser = TestHelper.makeMockFirebaseUser(); when(mockFirebaseUser.getProviders()) .thenReturn(Arrays.asList(FacebookAuthProvider.PROVIDER_ID)); when(ActivityHelperShadow.firebaseAuth.signInWithCredential((AuthCredential) anyObject())) .thenReturn(new AutoCompleteTask<AuthResult>( new FakeAuthResult(mockFirebaseUser), true, null)); Button facebookButton = (Button) authMethodPickerActivity.findViewById(R.id.facebook_button); assertNotNull(facebookButton); facebookButton.performClick(); Intent smartLockIntent = SmartLock.getInstance(authMethodPickerActivity).getIntentForTest(); verifySaveCredentialIntent(smartLockIntent, FacebookAuthProvider.PROVIDER_ID); }

Target:
public void testFacebookLoginFlow() { List<String> providers = Arrays.asList(AuthUI.FACEBOOK_PROVIDER); AuthMethodPickerActivity authMethodPickerActivity = createActivity(providers); FirebaseUser mockFirebaseUser = TestHelper.makeMockFirebaseUser(); when(mockFirebaseUser.getProviders()) .thenReturn(Arrays.asList(FacebookAuthProvider.PROVIDER_ID)); when(ActivityHelperShadow.firebaseAuth.signInWithCredential((AuthCredential) Mockito.any())) .thenReturn(new AutoCompleteTask<AuthResult>( new FakeAuthResult(mockFirebaseUser), true, null)); SmartLockResult result = SmartLockResult.newInstance(authMethodPickerActivity, "AuthMethodPicker", null, FacebookAuthProvider.PROVIDER_ID); Button facebookButton = (Button) authMethodPickerActivity.findViewById(R.id.facebook_button); assertNotNull(facebookButton); facebookButton.performClick(); try { result.await(); } catch (InterruptedException e) { assertTrue("Interrupted waiting for result", false); } }
Source:
private void insertAction(final Action action, final FilterKey key) { if (filterMap.get(key) == null) { filterMap.put(key, action); } else { logger.error(MessageUtils.getMessage("DOTJ007W", key.toString()).toString()); } }

Target:
private void insertAction(final Action action, final FilterKey key) { if (filterMap.get(key) == null) { filterMap.put(key, action); } else { logger.warn(MessageUtils.getMessage("DOTJ007W", key.toString()).toString()); } }
Source:
private void closeSegments(AbstractLogSegment... segments) { for (AbstractLogSegment segment : segments) { if (segment != null) { segment.close(); } } }

Target:
private void closeSegments(AbstractLogSegment... segments) { for (AbstractLogSegment segment : segments) { if (segment != null) { segment.close(true); } } }
Source:
public QuotaRoot getQuotaRoot(MailboxPath mailboxPath) { Preconditions.checkArgument(!mailboxPath.getNamespace().contains(SEPARATOR), "Namespace should not contain " + SEPARATOR); Preconditions.checkArgument(mailboxPath.getUser() != null, "Username should not be null"); Preconditions.checkArgument(!mailboxPath.getUser().contains(SEPARATOR), "Username should not contain " + SEPARATOR); User user = User.fromUsername(mailboxPath.getUser()); return QuotaRoot.quotaRoot(mailboxPath.getNamespace() + SEPARATOR + user.asString(), user.getDomainPart()); }

Target:
public QuotaRoot getQuotaRoot(MailboxPath mailboxPath) { Preconditions.checkArgument(!mailboxPath.getNamespace().contains(SEPARATOR), "Namespace should not contain " + SEPARATOR); return Optional.ofNullable(mailboxPath.getUser()) .map(user -> { Preconditions.checkArgument(!mailboxPath.getUser().contains(SEPARATOR), "Username should not contain " + SEPARATOR); return User.fromUsername(mailboxPath.getUser()); }) .map(user -> QuotaRoot.quotaRoot(mailboxPath.getNamespace() + SEPARATOR + user.asString(), user.getDomainPart())) .orElseGet(() -> QuotaRoot.quotaRoot(mailboxPath.getNamespace(), Optional.empty())); }
Source:
public GatewayOrder createGatewayOrder(EpdqTemplateData templateData) { templateData.setOperationType(getOperationType()); List<NameValuePair> templateParams = extract(templateData); List<NameValuePair> requestParams = new ArrayList<>(templateParams); requestParams.add(new BasicNameValuePair("SHASIGN", signatureGenerator.sign(templateParams, templateData.getShaInPassphrase()))); String payload = URLEncodedUtils.format(requestParams, EPDQ_APPLICATION_X_WWW_FORM_URLENCODED_CHARSET); return new GatewayOrder( getOrderRequestType(), payload, MediaType.APPLICATION_FORM_URLENCODED_TYPE ); }

Target:
public GatewayOrder createGatewayOrder(EpdqTemplateData templateData) { templateData.setOperationType(getOperationType()); ArrayList<NameValuePair> params = new ArrayList<>(extract(templateData)); String signature = SIGNATURE_GENERATOR.sign(params, templateData.getShaInPassphrase()); params.add(new BasicNameValuePair("SHASIGN", signature)); String payload = URLEncodedUtils.format(params, EPDQ_APPLICATION_X_WWW_FORM_URLENCODED_CHARSET); return new GatewayOrder( getOrderRequestType(), payload, MediaType.APPLICATION_FORM_URLENCODED_TYPE ); }
Source:
public void terminate() { while ( !queue.isEmpty() ) { PooledConnection conn = queue.poll(); if ( conn != null ) { conn.dispose(); } } for ( PooledConnection pooledConnection : acquiredConnections ) { pooledConnection.dispose(); } }

Target:
public void terminate() { if (isTerminating.compareAndSet( false, true )) { while ( !queue.isEmpty() ) { PooledConnection conn = queue.poll(); if ( conn != null ) { conn.dispose(); } } for ( PooledConnection pooledConnection : acquiredConnections ) { pooledConnection.dispose(); } } }
Source:
public void authorizeAPI(final String emailAddress, final Activity activity, final OAuth2TokenProviderAuthCallback callback) { Account account = getAccountFromManager(emailAddress); if (account == null) { callback.failure(new Exception(activity.getString(R.string.xoauth2_account_doesnt_exist))); } if(account.name.equals(emailAddress)) { accountManager.getAuthToken(account, GMAIL_AUTH_TOKEN_TYPE, null, activity, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { Bundle bundle = future.getResult(); if (bundle.get(AccountManager.KEY_ACCOUNT_NAME).equals(emailAddress)) { callback.success(); } } catch (OperationCanceledException e) { callback.failure(new Exception(activity.getString( R.string.xoauth2_auth_cancelled_by_user), e)); } catch (IOException e) { callback.failure(new Exception(activity.getString( R.string.xoauth2_unable_to_contact_auth_server), e)); } catch (AuthenticatorException e) { callback.failure(new Exception(activity.getString( R.string.xoauth2_error_contacting_auth_server), e)); } } }, null); } }

Target:
public void authorizeAPI(final String emailAddress, final Activity activity, final OAuth2TokenProviderAuthCallback callback) { Account account = getAccountFromManager(emailAddress); if (account == null) { callback.failure(new AuthorizationException(activity.getString(R.string.xoauth2_account_doesnt_exist))); return; } if (account.name.equals(emailAddress)) { accountManager.getAuthToken(account, GMAIL_AUTH_TOKEN_TYPE, null, activity, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { Bundle bundle = future.getResult(); Object keyAccountName = bundle.get(AccountManager.KEY_ACCOUNT_NAME); if (keyAccountName == null) { callback.failure(new AuthorizationException(activity.getString( R.string.xoauth2_no_account))); return; } if (keyAccountName.equals(emailAddress)) { callback.success(); } else { callback.failure(new AuthorizationException(activity.getString( R.string.xoauth2_incorrect_auth_info_provided))); } } catch (OperationCanceledException e) { callback.failure(new AuthorizationException(activity.getString( R.string.xoauth2_auth_cancelled_by_user), e)); } catch (IOException e) { callback.failure(new AuthorizationException(activity.getString( R.string.xoauth2_unable_to_contact_auth_server), e)); } catch (AuthenticatorException e) { callback.failure(new AuthorizationException(activity.getString( R.string.xoauth2_error_contacting_auth_server), e)); } } }, null); } }
Source:
private void initUi() { setTitle(R.string.dish_title); setContentView(R.layout.main_list_activity); LinearLayout galleryFrame = (LinearLayout) findViewById(R.id.gallery_frame); Button orderListButton = (Button) findViewById(R.id.orderedlist_button); orderListButton.setOnClickListener(this); LayoutInflater inflater = LayoutInflater.from(getApplicationContext()); int categoryNum = mCategoryList.size(); mCategoryGallery = new GridView[categoryNum]; for (int i = 0; i < categoryNum; i++) { LinearLayout categoryLayout = (LinearLayout) inflater.inflate(R.layout.main_list_item, null); TextView cagegoryNameTextView = (TextView) categoryLayout .findViewById(R.id.category_name); Category category = mCategoryList.get(i); long categoryId = category.getCategoryId(); cagegoryNameTextView.setText(category.getName()); List<Dish> dishList = mCategoryDishesMap.get(categoryId); if (dishList == null) { dishList = Collections.emptyList(); } mCategoryGallery[i] = (GridView) categoryLayout.findViewById(R.id.dish_grid); mCategoryGallery[i].setId((int) categoryId); mCategoryGallery[i].setAdapter(new GridViewAdapter(this, dishList)); mCategoryGallery[i].setOnItemClickListener(this); int dishNumber = dishList.size(); int rowNum = (dishNumber % DISHNUM_IN_ONEROW == 0) ? (dishNumber / DISHNUM_IN_ONEROW) : (dishNumber / DISHNUM_IN_ONEROW + 1); mCategoryGallery[i].getLayoutParams().height = rowNum * HEIGHT_ONEROW; galleryFrame.addView(categoryLayout); } mDbHelper.notifyObservers(); }

Target:
private void initUi() { setTitle(R.string.dish_title); setContentView(R.layout.main_list_activity); LinearLayout galleryFrame = (LinearLayout) findViewById(R.id.gallery_frame); Button orderListButton = (Button) findViewById(R.id.orderedlist_button); orderListButton.setOnClickListener(this); LayoutInflater inflater = LayoutInflater.from(getApplicationContext()); int categoryNum = mCategoryList.size(); mCategoryGallery = new GridView[categoryNum]; for (int i = 0; i < categoryNum; i++) { LinearLayout categoryLayout = (LinearLayout) inflater.inflate(R.layout.main_list_item, null); TextView cagegoryNameTextView = (TextView) categoryLayout.findViewById(R.id.category_name); Category category = mCategoryList.get(i); long categoryId = category.getCategoryId(); cagegoryNameTextView.setText(category.getName()); List<Dish> dishList = mCategoryDishesMap.get(categoryId); if (dishList == null) { dishList = Collections.emptyList(); } mCategoryGallery[i] = (GridView) categoryLayout.findViewById(R.id.dish_grid); mCategoryGallery[i].setId((int) categoryId); mCategoryGallery[i].setAdapter(new GridViewAdapter(this, dishList)); mCategoryGallery[i].setOnItemClickListener(this); int dishNumber = dishList.size(); int rowNum = (dishNumber % DISHNUM_IN_ONEROW == 0) ? (dishNumber / DISHNUM_IN_ONEROW) : (dishNumber / DISHNUM_IN_ONEROW + 1); mCategoryGallery[i].getLayoutParams().height = rowNum * HEIGHT_ONEROW; galleryFrame.addView(categoryLayout); } }
Source:
protected String initDomain() { if (!globalJmxRegistration.isJMXEnabled()) { if (globalJmxRegistration.mBeanServer == null) { globalJmxRegistration.mBeanServer = mBeanServer; } globalJmxRegistration.initJMX(); } return globalJmxRegistration.jmxDomain; }

Target:
protected String initDomain() { return globalJmxRegistration.jmxDomain; }
Source:
private void serve(final HttpServletRequest req, final HttpServletResponse rsp, final boolean sendBody) throws IOException { final File obj = new File(objects(req), req.getPathInfo()); final FileSender sender; try { sender = new FileSender(obj); } catch (FileNotFoundException e) { rsp.sendError(SC_NOT_FOUND); return; } try { final String etag = etag(sender); final long lastModified = sender.getLastModified() / 1000 * 1000; String ifNoneMatch = req.getHeader(HDR_IF_NONE_MATCH); if (etag != null && etag.equals(ifNoneMatch)) { rsp.sendError(SC_NOT_MODIFIED); return; } long ifModifiedSince = req.getDateHeader(HDR_IF_MODIFIED_SINCE); if (0 < lastModified && lastModified < ifModifiedSince) { rsp.sendError(SC_NOT_MODIFIED); return; } if (etag != null) rsp.setHeader(HDR_ETAG, etag); if (0 < lastModified) rsp.setDateHeader(HDR_LAST_MODIFIED, lastModified); rsp.setContentType(contentType); sender.serve(req, rsp, sendBody); } finally { sender.close(); } }

Target:
private void serve(final HttpServletRequest req, final HttpServletResponse rsp, final boolean sendBody) throws IOException { final File obj = new File(objects(req), req.getPathInfo()); final FileSender sender; try { sender = new FileSender(obj); } catch (FileNotFoundException e) { rsp.sendError(SC_NOT_FOUND); return; } try { final String etag = etag(sender); final long lastModified = (sender.getLastModified() / 1000) * 1000; String ifNoneMatch = req.getHeader(HDR_IF_NONE_MATCH); if (etag != null && etag.equals(ifNoneMatch)) { rsp.sendError(SC_NOT_MODIFIED); return; } long ifModifiedSince = req.getDateHeader(HDR_IF_MODIFIED_SINCE); if (0 < lastModified && lastModified < ifModifiedSince) { rsp.sendError(SC_NOT_MODIFIED); return; } if (etag != null) rsp.setHeader(HDR_ETAG, etag); if (0 < lastModified) rsp.setDateHeader(HDR_LAST_MODIFIED, lastModified); rsp.setContentType(contentType); sender.serve(req, rsp, sendBody); } finally { sender.close(); } }
Source:
public Void visit(Import node, Void _) { Module module; if (!node.getName().startsWith("#")) { module = this.getCurrentDefinition().getModulesMap().get(node.getName()); if (module == null) { String msg = "Could not find module: " + node.getName() + " imported from: " + this.getCurrentModule().getName(); throw KExceptionManager.compilerError(msg, this, node); } this.getCurrentModule().getModuleContext().addImportedModule(module); } moduleInclusion.addRelation(this.getCurrentModule().getName(), node.getName()); return null; }

Target:
public Void visit(Import node, Void _) { Module module; if (!node.getName().startsWith("#")) { module = this.getCurrentDefinition().getDefinitionContext().getModuleByName(node.getName()); if (module == null) { String msg = "Could not find module: " + node.getName() + " imported from: " + this.getCurrentModule().getName(); throw KExceptionManager.compilerError(msg, this, node); } this.getCurrentModule().getModuleContext().addImportedModule(module); } return null; }
Source:
public void testZeroExitCode() { DoNothingSoftwareProcessDriver sshRunner = mock(DoNothingSoftwareProcessDriver.class); ScriptHelper scriptHelper = new ScriptHelper(sshRunner, "test-zero-code-task"); Asserts.assertTrue(scriptHelper.executeInternal() == 0, "ScriptHelper doesn't return zero code"); }

Target:
public void testZeroExitCode() { DoNothingSoftwareProcessDriver sshRunner = mock(DoNothingSoftwareProcessDriver.class); ScriptHelper scriptHelper = new ScriptHelper(sshRunner, "test-zero-code-task"); Assert.assertEquals(scriptHelper.executeInternal(), 0, "ScriptHelper doesn't return zero code"); }
Source:
public void visitMethodInvocation(MethodInvocationTree syntaxNode) { final ExpressionTree methodSelect = syntaxNode.methodSelect(); if (isClosingResource(syntaxNode.symbol())) { if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) methodSelect).expression(); if (targetExpression.is(Tree.Kind.IDENTIFIER)) { final IdentifierTree identifier = (IdentifierTree) targetExpression; programState = closeResource(programState, programState.getValue(identifier.symbol())); } else { programState = closeResource(programState, programState.peekValue()); } } } else if (syntaxNode.methodSelect().is(Tree.Kind.MEMBER_SELECT) && isCreatingResultSet(syntaxNode.symbol())) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) syntaxNode.methodSelect()).expression(); final SymbolicValue value; if (targetExpression.is(Tree.Kind.IDENTIFIER)) { final IdentifierTree identifier = (IdentifierTree) targetExpression; value = programState.getValue(identifier.symbol()); } else { value = programState.peekValue(); } constraintManager.setValueFactory(new WrappedValueFactory(value)); } else if(isClosingResultSets(syntaxNode.symbol())) { if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) methodSelect).expression(); final SymbolicValue value; if (targetExpression.is(Tree.Kind.IDENTIFIER)) { final IdentifierTree identifier = (IdentifierTree) targetExpression; value = programState.getValue(identifier.symbol()); } else { value = programState.peekValue(); } closeResultSetsRelatedTo(value); } } else { closeArguments(syntaxNode.arguments(), 1); } }

Target:
public void visitMethodInvocation(MethodInvocationTree syntaxNode) { final ExpressionTree methodSelect = syntaxNode.methodSelect(); if (isClosingResource(syntaxNode.symbol())) { if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) methodSelect).expression(); if (targetExpression.is(Tree.Kind.IDENTIFIER)) { final IdentifierTree identifier = (IdentifierTree) targetExpression; programState = closeResource(programState, programState.getValue(identifier.symbol())); } else { programState = closeResource(programState, programState.peekValue()); } } } else if (syntaxNode.methodSelect().is(Tree.Kind.MEMBER_SELECT) && isOpeningResultSet(syntaxNode.symbol())) { final SymbolicValue value = getTargetValue(syntaxNode); constraintManager.setValueFactory(new WrappedValueFactory(value)); } else if (isClosingResultSets(syntaxNode.symbol())) { if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { final SymbolicValue value = getTargetValue(syntaxNode); closeResultSetsRelatedTo(value); } } else { closeArguments(syntaxNode.arguments(), 1); } }