auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
static JsonObjectBuilder createEventJson(EventInfo event, Probe probe) { JsonObjectBuilder builder = Json.newObjectBuilder(); builder.add(TYPE, Formats.formatType(event.type, false)); builder.add(QUALIFIERS, createQualifiers(event.qualifiers, true)); builder.add(EVENT_INFO, event.eventString); builder.add(KIND, (event.containerEvent ? CONTAINER : APPLICATION).toUpperCase()); JsonArrayBuilder observersBuilder = Json.newArrayBuilder(); for (ObserverMethod<?> observer : event.observers) { JsonObjectBuilder b = Json.newObjectBuilder() .add(CLASS, observer.getBeanClass().getName()) .add(ID, probe.getObserverId(observer)); if (observer instanceof ObserverMethodImpl<?, ?>) { ObserverMethodImpl<?, ?> weldObserver = (ObserverMethodImpl<?, ?>) observer; AnnotatedMethod<?> method = weldObserver.getMethod().getAnnotated(); b.add(METHOD, method.getJavaMember().getName() + Formats.formatAsFormalParameterList(method.getParameters())); } observersBuilder.add(b); } builder.add(OBSERVERS, observersBuilder); return builder; }

Target:
static JsonObjectBuilder createEventJson(EventInfo event, Probe probe) { JsonObjectBuilder builder = Json.newObjectBuilder(); builder.add(TYPE, Formats.formatType(event.type, false)); builder.add(QUALIFIERS, createQualifiers(event.qualifiers, true)); builder.add(EVENT_INFO, event.eventString); builder.add(KIND, (event.containerEvent ? CONTAINER : APPLICATION).toUpperCase()); JsonArrayBuilder observersBuilder = Json.newArrayBuilder(); for (ObserverMethod<?> observer : event.observers) { JsonObjectBuilder b = createSimpleObserverJson(observer, probe); if (observer instanceof ObserverMethodImpl<?, ?>) { ObserverMethodImpl<?, ?> weldObserver = (ObserverMethodImpl<?, ?>) observer; AnnotatedMethod<?> method = weldObserver.getMethod().getAnnotated(); b.add(METHOD, method.getJavaMember().getName() + Formats.formatAsFormalParameterList(method.getParameters())); } observersBuilder.add(b); } builder.add(OBSERVERS, observersBuilder); return builder; }
Source:
public LoggingFileObjectPutter(final Path inputDirectory) { objectPutter = new FileObjectPutter(inputDirectory); }

Target:
public LoggingFileObjectPutter(final Path inputDirectory) { this.objectPutter = new FileObjectPutter(inputDirectory); }
Source:
private RetreatResult showRetreatDialog( final String message, final Collection<Territory> possible) { final String yes = possible.size() == 1 ? "Retreat to " + possible.iterator().next().getName() : "Retreat"; final String no = "Remain"; final String cancel = "Ask Me Later"; final String[] options = {yes, no, cancel}; final int choice = JOptionPane.showOptionDialog( BattleDisplay.this, message, "Retreat?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, no); if (choice == JOptionPane.CLOSED_OPTION || choice == JOptionPane.CANCEL_OPTION) { return RetreatResult.noResult(); } if (choice == JOptionPane.NO_OPTION) { return RetreatResult.remain(); } if (possible.size() == 1) { return RetreatResult.retreatTo(possible.iterator().next()); } final RetreatComponent comp = new RetreatComponent(possible); final int option = JOptionPane.showConfirmDialog( BattleDisplay.this, comp, message, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (option == JOptionPane.OK_OPTION) { if (comp.getSelection() != null) { return RetreatResult.retreatTo(comp.getSelection()); } } return RetreatResult.noResult(); }

Target:
private RetreatResult showRetreatDialog( final String message, final Collection<Territory> possible) { final String yes = possible.size() == 1 ? "Retreat to " + possible.iterator().next().getName() : "Retreat"; final String no = "Remain"; final String cancel = "Ask Me Later"; final String[] options = {yes, no, cancel}; final int choice = JOptionPane.showOptionDialog( BattleDisplay.this, message, "Retreat?", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, no); if (choice == JOptionPane.CLOSED_OPTION || choice == JOptionPane.CANCEL_OPTION) { return RetreatResult.noResult(); } if (choice == JOptionPane.NO_OPTION) { return RetreatResult.remain(); } if (possible.size() == 1) { return RetreatResult.retreatTo(possible.iterator().next()); } return showRetreatOptions(message, possible); }
Source:
public String showIndexPage(Model model) { List<String> modelVersions; try { modelVersions = sourceCodeManager.getAvailableVersions(); } catch (Exception e) { LOGGER.warn(LOG_FAILED_TO_GET_REPOSITORY_VERSIONS); LOGGER.error(e); modelVersions = new ArrayList<>(); } model.addAttribute("repository_url", configurationService.getModelRepositoryUrl()); model.addAttribute("model_version", configurationService.getModelRepositoryVersion()); model.addAttribute("available_versions", modelVersions); return "index"; }

Target:
public String showIndexPage(Model model) { List<String> modelVersions; try { modelVersions = sourceCodeManager.getAvailableVersions(); } catch (Exception e) { LOGGER.error(LOG_FAILED_TO_GET_REPOSITORY_VERSIONS, e); modelVersions = new ArrayList<>(); } model.addAttribute("repository_url", configurationService.getModelRepositoryUrl()); model.addAttribute("model_version", configurationService.getModelRepositoryVersion()); model.addAttribute("available_versions", modelVersions); return "index"; }
Source:
public Map<String, String> getShellEnvironment() { MutableMap<String, String> result = MutableMap.copyOf(super.getShellEnvironment()); if (getEntity().getEpmdListenerPort() != null) { result.put("ERL_EPMD_PORT", "" + Integer.toString(getEntity().getEpmdListenerPort())); } result.put("WAIT_FOR_ERLANG", "60"); return result; }

Target:
public Map<String, String> getShellEnvironment() { MutableMap<String, String> result = MutableMap.copyOf(super.getShellEnvironment()); if (getEntity().getEpmdListenerPort() != null) { result.put("ERL_EPMD_PORT", Integer.toString(getEntity().getEpmdListenerPort())); } result.put("WAIT_FOR_ERLANG", "60"); return result; }
Source:
public DetailOptionsResponse listDetailOptions(final ListDetailOptionsCmd cmd) { final ResourceObjectType type = cmd.getResourceType(); final String resourceUuid = cmd.getResourceId(); final Map<String, List<String>> options = new HashMap<>(); switch (type) { case Template: case UserVm: HypervisorType hypervisorType = HypervisorType.None; if (!Strings.isNullOrEmpty(resourceUuid) && ResourceObjectType.Template.equals(type)) { hypervisorType = _templateDao.findByUuid(resourceUuid).getHypervisorType(); } if (!Strings.isNullOrEmpty(resourceUuid) && ResourceObjectType.UserVm.equals(type)) { hypervisorType = _vmInstanceDao.findByUuid(resourceUuid).getHypervisorType(); } fillVMOrTemplateDetailOptions(options, hypervisorType); break; default: throw new CloudRuntimeException("Resource type not supported."); } return new DetailOptionsResponse(options); }

Target:
public DetailOptionsResponse listDetailOptions(final ListDetailOptionsCmd cmd) { final ResourceObjectType type = cmd.getResourceType(); final String resourceUuid = cmd.getResourceId(); final Map<String, List<String>> options = new HashMap<>(); switch (type) { case Template: case UserVm: HypervisorType hypervisorType = HypervisorType.None; if (!Strings.isNullOrEmpty(resourceUuid) && ResourceObjectType.Template.equals(type)) { hypervisorType = _templateDao.findByUuid(resourceUuid).getHypervisorType(); } if (!Strings.isNullOrEmpty(resourceUuid) && ResourceObjectType.UserVm.equals(type)) { hypervisorType = _vmInstanceDao.findByUuid(resourceUuid).getHypervisorType(); } fillVMOrTemplateDetailOptions(options, hypervisorType); break; default: throw new CloudRuntimeException("Resource type not supported."); } if (CallContext.current().getCallingAccount().getType() != Account.ACCOUNT_TYPE_ADMIN) { final List<String> userBlacklistedSettings = Stream.of(QueryService.UserVMBlacklistedDetails.value().split(",")) .map(item -> (item).trim()) .collect(Collectors.toList()); for (final String detail : userBlacklistedSettings) { if (options.containsKey(detail)) { options.remove(detail); } } } return new DetailOptionsResponse(options); }
Source:
public void testRootNodeInvalidation() throws Exception { Session session = repository.getConnection(); Serializable rootNodeId = session.getRootNode().getId(); Session session2 = repository.getConnection(); session2.getRootNode().getCollectionProperty(Model.ACL_PROP); Node root = session.getRootNode(); CollectionProperty prop = root.getCollectionProperty(Model.ACL_PROP); assertEquals(3, prop.getValue().length); ACLRow acl1 = new ACLRow(1, "test", true, "Write", "steve", null); ACLRow acl2 = new ACLRow(1, "test", true, "Write", "jobs", null); prop.setValue(new ACLRow[] { acl1, acl2 }); session.save(); session2.save(); Node root2 = session2.getNodeById(rootNodeId); CollectionProperty prop2 = root2.getCollectionProperty(Model.ACL_PROP); prop2.setValue(new ACLRow[] { acl1 }); Node root22 = session2.getRootNode(); CollectionProperty prop22 = root22.getCollectionProperty(Model.ACL_PROP); assertEquals(1, prop22.getValue().length); }

Target:
public void testRootNodeInvalidation() throws Exception { Session session = repository.getConnection(); Serializable rootNodeId = session.getRootNode().getId(); Session session2 = repository.getConnection(); session2.getRootNode().getCollectionProperty(Model.ACL_PROP); Node root = session.getRootNode(); CollectionProperty prop = root.getCollectionProperty(Model.ACL_PROP); Serializable[] origValue = prop.getValue(); assertEquals(3, origValue.length); ACLRow acl1 = new ACLRow(1, "test", true, "Write", "steve", null); ACLRow acl2 = new ACLRow(1, "test", true, "Write", "jobs", null); prop.setValue(new ACLRow[] { acl1, acl2 }); session.save(); session2.save(); Node root2 = session2.getNodeById(rootNodeId); CollectionProperty prop2 = root2.getCollectionProperty(Model.ACL_PROP); prop2.setValue(new ACLRow[] { acl1 }); Node root22 = session2.getRootNode(); CollectionProperty prop22 = root22.getCollectionProperty(Model.ACL_PROP); assertEquals(1, prop22.getValue().length); }
Source:
public static String getClusterName(Entity node) { String name = node.getConfig(CLUSTER_NAME); if (!Strings.isBlank(name)) return Strings.makeValidFilename(name); return getCluster(node).getId(); }

Target:
public static String getClusterName(Entity node) { String name = node.getConfig(CLUSTER_NAME); if (!Strings.isBlank(name)) return Strings.makeValidFilename(name); return getClusterOrNode(node).getId(); }
Source:
public void initialize() { super.initialize(); cancelButton.managedProperty().bind(cancelButton.visibleProperty()); playButton.managedProperty().bind(playButton.visibleProperty()); ratingLabel.managedProperty().bind(ratingLabel.visibleProperty()); ratingProgressIndicator.managedProperty().bind(ratingProgressIndicator.visibleProperty()); factionsToButtons = new HashMap<>(); factionsToButtons.put(AEON, aeonButton); factionsToButtons.put(UEF, uefButton); factionsToButtons.put(CYBRAN, cybranButton); factionsToButtons.put(SERAPHIM, seraphimButton); setSearching(false); gameService.searching1v1Property().addListener((observable, oldValue, newValue) -> setSearching(newValue)); ObservableList<Faction> factions = preferencesService.getPreferences().getLadder1v1Prefs().getFactions(); for (Faction faction : EnumSet.of(AEON, CYBRAN, UEF, SERAPHIM)) { factionsToButtons.get(faction).setSelected(factions.contains(faction)); } playButton.setDisable(!factionsToButtons.values().stream().anyMatch(ToggleButton::isSelected)); preferencesService.addUpdateListener(preferences -> { if (preferencesService.getPreferences().getForgedAlliance().getPath() == null) { onCancelButtonClicked(); } }); playerService.currentPlayerProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> setCurrentPlayer(newValue))); playerService.getCurrentPlayer().ifPresent(this::setCurrentPlayer); }

Target:
public void initialize() { super.initialize(); cancelButton.managedProperty().bind(cancelButton.visibleProperty()); playButton.managedProperty().bind(playButton.visibleProperty()); ratingLabel.managedProperty().bind(ratingLabel.visibleProperty()); ratingProgressIndicator.managedProperty().bind(ratingProgressIndicator.visibleProperty()); factionsToButtons = new HashMap<>(); factionsToButtons.put(AEON, aeonButton); factionsToButtons.put(UEF, uefButton); factionsToButtons.put(CYBRAN, cybranButton); factionsToButtons.put(SERAPHIM, seraphimButton); setSearching(false); gameService.searching1v1Property().addListener((observable, oldValue, newValue) -> setSearching(newValue)); ObservableList<Faction> factions = preferencesService.getPreferences().getLadder1v1Prefs().getFactions(); for (Faction faction : EnumSet.of(AEON, CYBRAN, UEF, SERAPHIM)) { factionsToButtons.get(faction).setSelected(factions.contains(faction)); } playButton.setDisable(factionsToButtons.values().stream().noneMatch(ToggleButton::isSelected)); preferencesService.addUpdateListener(preferences -> { if (preferencesService.getPreferences().getForgedAlliance().getPath() == null) { onCancelButtonClicked(); } }); playerService.currentPlayerProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> setCurrentPlayer(newValue))); playerService.getCurrentPlayer().ifPresent(this::setCurrentPlayer); }
Source:
void processPendingExpunge(PendingExpunge command, Account account) throws MessagingException { String folder = command.folder; Timber.d("processPendingExpunge: folder = %s", folder); Store remoteStore = account.getRemoteStore(); Folder remoteFolder = remoteStore.getFolder(folder); LocalStore localStore = account.getLocalStore(); LocalFolder localFolder = localStore.getFolder(folder); try { if (!remoteFolder.exists()) { return; } remoteFolder.open(Folder.OPEN_MODE_RW); if (remoteFolder.getMode() != Folder.OPEN_MODE_RW) { return; } remoteFolder.expunge(localFolder.getAllMessageUids(true)); Timber.d("processPendingExpunge: complete for folder = %s", folder); } finally { closeFolder(localFolder); closeFolder(remoteFolder); } }

Target:
void processPendingExpunge(PendingExpunge command, Account account) throws MessagingException { String folder = command.folder; Timber.d("processPendingExpunge: folder = %s", folder); Store remoteStore = account.getRemoteStore(); Folder remoteFolder = remoteStore.getFolder(folder); try { if (!remoteFolder.exists()) { return; } remoteFolder.open(Folder.OPEN_MODE_RW); if (remoteFolder.getMode() != Folder.OPEN_MODE_RW) { return; } remoteFolder.expunge(); Timber.d("processPendingExpunge: complete for folder = %s", folder); } finally { closeFolder(remoteFolder); } }
Source:
public static boolean canShowHistoryFor(final Object object) { if (object instanceof HistoryPageInput) { return true; } if (object instanceof IResource) { return typeOk((IResource) object); } if (object instanceof RepositoryTreeNode) { RepositoryTreeNodeType nodeType = ((RepositoryTreeNode) object) .getType(); boolean unsupportedNodeType = EnumSet.of( RepositoryTreeNodeType.ADDITIONALREFS, RepositoryTreeNodeType.BRANCHES, RepositoryTreeNodeType.BRANCHHIERARCHY, RepositoryTreeNodeType.ERROR, RepositoryTreeNodeType.FETCH, RepositoryTreeNodeType.LOCAL, RepositoryTreeNodeType.PUSH, RepositoryTreeNodeType.REMOTE, RepositoryTreeNodeType.REMOTES, RepositoryTreeNodeType.REMOTETRACKING, RepositoryTreeNodeType.STASH, RepositoryTreeNodeType.STASHED_COMMIT, RepositoryTreeNodeType.TAGS) .contains(nodeType); return !unsupportedNodeType; } if (object instanceof Path) { return true; } IResource resource = AdapterUtils.adaptToAnyResource(object); if (resource != null && typeOk(resource)) { return true; } return Adapters.adapt(object, Repository.class) != null; }

Target:
public static boolean canShowHistoryFor(final Object object) { if (object instanceof HistoryPageInput) { return true; } if (object instanceof IResource) { return typeOk((IResource) object); } if (object instanceof RepositoryTreeNode) { return SUPPORTED_REPOSITORY_NODE_TYPES.contains(object); } if (object instanceof Path) { return true; } IResource resource = AdapterUtils.adaptToAnyResource(object); if (resource != null && typeOk(resource)) { return true; } return Adapters.adapt(object, Repository.class) != null; }
Source:
public static List<URL> toJarUrls(String url) throws MalformedURLException { if (url==null) throw new NullPointerException("Cannot read from null"); if (url=="") throw new NullPointerException("Cannot read from empty string"); List<URL> result = Lists.newArrayList(); String protocol = Urls.getProtocol(url); if (protocol!=null) { if ("file".equals(protocol)) { url = ResourceUtils.tidyFileUrl(url); } result.add(new URL(url)); } else { String tidiedPath = Os.tidyPath(url); File tidiedFile = new File(tidiedPath); if (tidiedFile.isDirectory()) { List<File> toscan = Lists.newLinkedList(); toscan.add(tidiedFile); while (toscan.size() > 0) { File file = toscan.remove(0); if (file.isFile()) { if (file.getName().toLowerCase().endsWith(".jar")) { result.add(new URL("file://"+file.getAbsolutePath())); } } else if (file.isDirectory()) { for (File subfile : file.listFiles()) { toscan.add(subfile); } } else { log.info("Cannot read "+file+"; not a file or directory"); } } } else { result.add(new URL("file://"+tidiedFile)); } } return result; }

Target:
public static List<URL> toJarUrls(String url) throws MalformedURLException { if (url==null) throw new NullPointerException("Cannot read from null"); if (url=="") throw new NullPointerException("Cannot read from empty string"); List<URL> result = Lists.newArrayList(); String protocol = Urls.getProtocol(url); if (protocol!=null) { if ("file".equals(protocol)) { url = ResourceUtils.tidyFileUrl(url); } result.add(new URL(url)); } else { String tidiedPath = Os.tidyPath(url); File tidiedFile = new File(tidiedPath); if (tidiedFile.isDirectory()) { List<File> toscan = Lists.newLinkedList(); toscan.add(tidiedFile); while (toscan.size() > 0) { File file = toscan.remove(0); if (file.isFile()) { if (file.getName().toLowerCase().endsWith(".jar")) { result.add(new URL("file://"+file.getAbsolutePath())); } } else if (file.isDirectory()) { for (File subfile : file.listFiles()) { toscan.add(subfile); } } else { log.info("Cannot read "+file+"; not a file or directory"); } } } else { result.add(tidiedFile.toURI().toURL()); } } return result; }
Source:
public void testAcquire() throws Exception { final Environment env = Mockito.mock(Environment.class); final InetAddress address = Mockito.mock(InetAddress.class); final Environments server = Mockito.mock(Environments.class); Mockito.doReturn(env).when(server).acquire(); Mockito.doReturn(address).when(env).address(); MatcherAssert.assertThat( env, Matchers.equalTo(server.acquire()) ); MatcherAssert.assertThat( address, Matchers.equalTo(env.address()) ); Mockito.verify(env, Mockito.times(1)).address(); }

Target:
public void testAcquire() throws Exception { final Environment env = Mockito.mock(Environment.class); final InetAddress address = Mockito.mock(InetAddress.class); final Environments server = Mockito.mock(Environments.class); Mockito.doReturn(env).when(server).acquire(); Mockito.doReturn(address).when(env).address(); MatcherAssert.assertThat( server.acquire(), Matchers.equalTo(env) ); MatcherAssert.assertThat( env.address() , Matchers.equalTo(address) ); Mockito.verify(env); }
Source:
private synchronized void scheduleTaskIfNecessary(TaskHandle taskHandle) { if (taskHandle.getRunningLeafSplits() < min(minimumNumberOfDriversPerTask, taskHandle.getMaxDriversPerTask().orElse(Integer.MAX_VALUE))) { PrioritizedSplitRunner split = taskHandle.pollNextSplit(); if (split != null) { startSplit(split); splitQueuedTime.add(Duration.nanosSince(split.getCreatedNanos())); } } }

Target:
private synchronized void scheduleTaskIfNecessary(TaskHandle taskHandle) { if (taskHandle.getRunningLeafSplits() < min(guaranteedNumberOfDriversPerTask, taskHandle.getMaxDriversPerTask().orElse(Integer.MAX_VALUE))) { PrioritizedSplitRunner split = taskHandle.pollNextSplit(); if (split != null) { startSplit(split); splitQueuedTime.add(Duration.nanosSince(split.getCreatedNanos())); } } }
Source:
public void mouseClicked(final MouseEvent e) { try { VirtualFile virtualFile = editorDocOps.getVirtualFile(fileName, displayFileName, windowObjects.getFileNameContentsMap().get(fileName)); FileEditorManager.getInstance(windowObjects.getProject()). openFile(virtualFile, true, true); Document document = EditorFactory.getInstance().createDocument(windowObjects. getFileNameContentsMap().get(fileName)); editorDocOps.addHighlighting(windowObjects. getFileNameNumbersMap().get(fileName), document); editorDocOps.gotoLine(windowObjects. getFileNameNumbersMap().get(fileName).get(0), document); } catch (Exception exception) { exception.printStackTrace(); } }

Target:
public void mouseClicked(final MouseEvent e) { try { VirtualFile virtualFile = editorDocOps.getVirtualFile(fileName, displayFileName, windowObjects.getFileNameContentsMap().get(fileName)); FileEditorManager.getInstance(windowObjects.getProject()). openFile(virtualFile, true, true); Document document = EditorFactory.getInstance().createDocument(windowObjects. getFileNameContentsMap().get(fileName)); editorDocOps.addHighlighting(windowObjects. getFileNameNumbersMap().get(fileName), document); editorDocOps.gotoLine(windowObjects. getFileNameNumbersMap().get(fileName).get(0), document); } catch (Exception exception) { KBNotification.getInstance().error(exception); exception.printStackTrace(); } }
Source:
public static Appenderator createOffline( DataSchema schema, AppenderatorConfig config, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, ObjectMapper objectMapper, IndexIO indexIO, IndexMerger indexMerger ) { return new AppenderatorImpl( schema, config, metrics, dataSegmentPusher, objectMapper, null, new DataSegmentAnnouncer() { @Override public void announceSegment(DataSegment segment) throws IOException { } @Override public void unannounceSegment(DataSegment segment) throws IOException { } @Override public void announceSegments(Iterable<DataSegment> segments) throws IOException { } @Override public void unannounceSegments(Iterable<DataSegment> segments) throws IOException { } @Override public boolean isAnnounced(DataSegment segment) { return false; } }, null, null, indexIO, indexMerger, MapCache.create(500000), new CacheConfig() ); }

Target:
public static Appenderator createOffline( DataSchema schema, AppenderatorConfig config, FireDepartmentMetrics metrics, DataSegmentPusher dataSegmentPusher, ObjectMapper objectMapper, IndexIO indexIO, IndexMerger indexMerger ) { return new AppenderatorImpl( schema, config, metrics, dataSegmentPusher, objectMapper, null, new DataSegmentAnnouncer() { @Override public void announceSegment(DataSegment segment) throws IOException { } @Override public void unannounceSegment(DataSegment segment) throws IOException { } @Override public void announceSegments(Iterable<DataSegment> segments) throws IOException { } @Override public void unannounceSegments(Iterable<DataSegment> segments) throws IOException { } @Override public boolean isAnnounced(DataSegment segment) { return false; } }, null, null, indexIO, indexMerger, null, null ); }
Source:
private boolean isEnabled(ProviderFactory factory, Config.Scope scope) { if (!scope.getBoolean("enabled", true)) { return false; } if (factory instanceof EnvironmentDependentProviderFactory) { return ((EnvironmentDependentProviderFactory) factory).isSupported(); } if (factory instanceof FeatureDependentProviderFactory) { return Optional.ofNullable(((FeatureDependentProviderFactory) factory).getRequiredFeatures()).orElse(Collections.emptySet()) .stream().allMatch(requiredFeature -> Profile.isFeatureEnabled(requiredFeature)); } return true; }

Target:
private boolean isEnabled(ProviderFactory factory, Config.Scope scope) { if (!scope.getBoolean("enabled", true)) { return false; } if (factory instanceof EnvironmentDependentProviderFactory) { return ((EnvironmentDependentProviderFactory) factory).isSupported(); } return true; }
Source:
private void updateNics(List<NetworkInterfaceModel> nics) { nicList.clear(); Collections.sort(nics); List<NetworkGroup> groups = new ArrayList<>(); for (NetworkInterfaceModel nic : nics) { groups.add(new NetworkGroup(nic, eventBus, style)); } nicList.addAll(groups, !rendered); nicGroups = groups; }

Target:
private void updateNics(List<NetworkInterfaceModel> nics) { nicList.clear(); Collections.sort(nics); nicGroups = new ArrayList<>(); for (NetworkInterfaceModel nic : nics) { nicGroups.add(new NetworkGroup(nic, eventBus, style)); } nicList.addAll(nicGroups, !rendered); }
Source:
void handleTerminationSignal() { UserConsole.getLogger().info("Intercepted a signal, terminating job"); killService.kill(KillService.KillSource.SYSTEM_SIGNAL); }

Target:
void handleTerminationSignal() { UserConsole.getLogger().info("Kill requested, terminating job"); killService.kill(KillService.KillSource.SYSTEM_SIGNAL); }
Source:
public ContainerProcesses top(String container, String... psArgs) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", "text/plain")); headers.add(Pair.of("Content-Length", 0)); final DockerConnection connection = openConnection(dockerDaemonUri).method("GET") .path("/containers/" + container + "/top") .headers(headers); if (psArgs != null && psArgs.length != 0) { StringBuilder psArgsQueryBuilder = new StringBuilder(); for (int i = 0, l = psArgs.length; i < l; i++) { if (i > 0) { psArgsQueryBuilder.append('+'); } psArgsQueryBuilder.append(URLEncoder.encode(psArgs[i], "UTF-8")); } connection.query("ps_args", psArgsQueryBuilder.toString()); } try { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (200 != status) { throw new DockerException(getDockerExceptionMessage(response), status); } return parseResponseStreamAndClose(response.getInputStream(), ContainerProcesses.class); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } finally { connection.close(); } }

Target:
public ContainerProcesses top(String container, String... psArgs) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); headers.add(Pair.of("Content-Type", MediaType.TEXT_PLAIN)); headers.add(Pair.of("Content-Length", 0)); final DockerConnection connection = openConnection(dockerDaemonUri).method("GET") .path("/containers/" + container + "/top") .headers(headers); if (psArgs != null && psArgs.length != 0) { StringBuilder psArgsQueryBuilder = new StringBuilder(); for (int i = 0, l = psArgs.length; i < l; i++) { if (i > 0) { psArgsQueryBuilder.append('+'); } psArgsQueryBuilder.append(URLEncoder.encode(psArgs[i], "UTF-8")); } connection.query("ps_args", psArgsQueryBuilder.toString()); } try { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (OK.getStatusCode() != status) { throw new DockerException(getDockerExceptionMessage(response), status); } return parseResponseStreamAndClose(response.getInputStream(), ContainerProcesses.class); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } finally { connection.close(); } }
Source:
private void removeFromMap(Map<String, Map<ServerLocationAndMemberId, LoadHolder>> map, String[] groups, ServerLocation location, String memberId) { ServerLocationAndMemberId locationAndMemberId = new ServerLocationAndMemberId(location, memberId); for (String group : groups) { Map<ServerLocationAndMemberId, LoadHolder> groupMap = map.get(group); if (groupMap != null) { groupMap.remove(locationAndMemberId); if (groupMap.size() == 0) { map.remove(group); } } } Map groupMap = map.get(null); groupMap.remove(locationAndMemberId); }

Target:
void removeFromMap(Map<String, Map<ServerLocationAndMemberId, LoadHolder>> map, String[] groups, ServerLocation location, String memberId) { ServerLocationAndMemberId locationAndMemberId = new ServerLocationAndMemberId(location, memberId); for (String group : groups) { Map<ServerLocationAndMemberId, LoadHolder> groupMap = map.get(group); if (groupMap != null) { groupMap.remove(locationAndMemberId); if (groupMap.size() == 0) { map.remove(group); } } } Map groupMap = map.get(null); groupMap.remove(locationAndMemberId); }
Source:
public void initComponent() { final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); boolean shownAlready; synchronized (propertiesComponent) { String storedVersion = propertiesComponent.getValue(GO_PROJECT_TUTORIAL_NOTIFICATION_SHOWN, "0.0"); shownAlready = VersionComparatorUtil.compare(storedVersion, PLUGIN_VERSION) == 0; if (!shownAlready) { propertiesComponent.setValue(GO_PROJECT_TUTORIAL_NOTIFICATION_SHOWN, PLUGIN_VERSION); } } if (shownAlready) { return; } NotificationGroup group = NotificationGroup.findRegisteredGroup("Plugins Suggestion"); if (group == null) { return; } final Notification notification = group.createNotification( "Learn how to setup a new Go project", "Please visit our " + "<a href=\"<LINK_0>\">wiki page<a/>" + " to learn how to setup a new Go project", NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER ); Notifications.Bus.notify(notification); }

Target:
public void initComponent() { final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); boolean shownAlready; synchronized (propertiesComponent) { String storedVersion = propertiesComponent.getValue(GO_PROJECT_TUTORIAL_NOTIFICATION_SHOWN, "0.0"); shownAlready = VersionComparatorUtil.compare(storedVersion, PLUGIN_VERSION) == 0; propertiesComponent.setValue(GO_PROJECT_TUTORIAL_NOTIFICATION_SHOWN, PLUGIN_VERSION); } if (shownAlready) { return; } Notifications.Bus.notify(new Notification( "Go plugin notifications", "Learn how to setup a new Go project", "Please visit our " + "<a href=\"<LINK_0>\">wiki page<a/>" + " to learn how to setup a new Go project", NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER)); }
Source:
private void invokeQueuedHandlers(Object rv, Throwable throwable) { if (trace) log.tracef("Resuming invocation of command %s with %d handlers", command, queueSize()); while (true) { InvocationCallback function = queuePoll(); if (function == null) { if (throwable == null) { future.complete(rv); } else { future.completeExceptionally(throwable); } return; } try { if (throwable != null) { throwable = CompletableFutures.extractException(throwable); } rv = function.apply(ctx, command, rv, throwable); throwable = null; } catch (Throwable t) { rv = null; throwable = t; } if (rv instanceof InvocationStage) { InvocationStage currentStage = (InvocationStage) rv; if (!currentStage.isDone()) { currentStage.toCompletableFuture().whenComplete(this); return; } else { try { rv = currentStage.get(); } catch (Throwable t) { throwable = t; } } } } }

Target:
private void invokeQueuedHandlers(Object rv, Throwable throwable) { if (trace) log.tracef("Resuming invocation of command %s with %d handlers", command, queueSize()); while (true) { InvocationCallback function = queuePoll(); if (function == null) { if (throwable == null) { future.complete(rv); } else { future.completeExceptionally(throwable); } return; } try { if (throwable != null) { throwable = CompletableFutures.extractException(throwable); } rv = function.apply(ctx, command, rv, throwable); throwable = null; } catch (Throwable t) { rv = null; throwable = t; } if (rv instanceof InvocationStage) { InvocationStage currentStage = (InvocationStage) rv; currentStage.addCallback(ctx, command, this); return; } } }
Source:
public void beforeCompletion() throws EJBException, RemoteException { log.info("beforeCompletion called"); checker.setSynchronizedBefore(); }

Target:
public void beforeCompletion() throws EJBException, RemoteException { log.trace("beforeCompletion called"); checker.setSynchronizedBefore(); }
Source:
public EventProducer(TransportProvider transportProvider, CheckpointProvider checkpointProvider, Properties config, boolean customCheckpointing, Consumer<EventProducer> onUnrecoverableError) { Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); _checkpointRWLock = new ReentrantReadWriteLock( true); _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = customCheckpointing ? CheckpointPolicy.CUSTOM : CheckpointPolicy.DATASTREAM; _safeCheckpoints = new ConcurrentHashMap<>(); _onUnrecoverableError = onUnrecoverableError; _checkpointHandler = new CheckpointHandler(config); _producerId = UUID.randomUUID().toString(); _logger = LoggerFactory.getLogger(String.format("%s:%s", MODULE, _producerId)); _logger.info(String.format("Created event producer with customCheckpointing=%s, sendCallback=%s", customCheckpointing, onUnrecoverableError != null)); }

Target:
public EventProducer(TransportProvider transportProvider, CheckpointProvider checkpointProvider, Properties config, boolean customCheckpointing, Consumer<EventProducer> onUnrecoverableError) { Validate.notNull(transportProvider, "null transport provider"); Validate.notNull(checkpointProvider, "null checkpoint provider"); Validate.notNull(config, "null config"); _checkpointRWLock = new ReentrantReadWriteLock( true); _transportProvider = transportProvider; _checkpointProvider = checkpointProvider; _checkpointPolicy = customCheckpointing ? CheckpointPolicy.CUSTOM : CheckpointPolicy.DATASTREAM; _safeCheckpoints = new ConcurrentHashMap<>(); _onUnrecoverableError = onUnrecoverableError; _checkpointHandler = new CheckpointHandler(config); _producerId = PRODUCER_ID_SEED.getAndIncrement(); _logger = LoggerFactory.getLogger(String.format("%s:%s", MODULE, _producerId)); _logger.info(String .format("Created event producer with customCheckpointing=%s, sendCallback=%s", customCheckpointing, onUnrecoverableError != null)); }
Source:
private String filterCommentContent(Type type, String comment) { if (type == Type.JSDOC) { for (Pattern p : JSDOC_REPLACEMENTS_WITH_KEEP) { Matcher m = p.matcher(comment); if (m.find() && m.group("keep") != null && m.group("keep").trim().length() > 0) { comment = m.replaceAll("${block}${keep}"); } else { comment = m.replaceAll(""); } } for (Pattern p : JSDOC_REPLACEMENTS_NO_KEEP) { Matcher m = p.matcher(comment); boolean hasAMatch = m.find(); if (hasAMatch) { if (m.group("eol") != null && m.group("eol").trim().length() == 0) { comment = m.replaceAll(""); } else { comment = p.matcher(comment).replaceAll("${block}"); } } } } else { for (Pattern p : COMMENT_REPLACEMENTS) { comment = p.matcher(comment).replaceAll(""); } } return isWhitespaceOnly(comment) ? "" : comment; }

Target:
private String filterCommentContent(Type type, String comment) { if (type == Type.JSDOC) { for (Pattern p : JSDOC_REPLACEMENTS_WITH_KEEP) { Matcher m = p.matcher(comment); if (m.find() && m.group("keep") != null && m.group("keep").trim().length() > 0) { comment = m.replaceAll("${block}${keep}"); } else { comment = m.replaceAll(""); } } for (Pattern p : JSDOC_REPLACEMENTS_NO_KEEP) { Matcher m = p.matcher(comment); if (m.find()) { if (m.group("eol") != null && m.group("eol").trim().length() == 0) { comment = m.replaceAll(""); } else { comment = p.matcher(comment).replaceAll("${block}"); } } } } else { for (Pattern p : COMMENT_REPLACEMENTS) { comment = p.matcher(comment).replaceAll(""); } } return isWhitespaceOnly(comment) ? "" : comment; }
Source:
public DefaultArtifactVersion apply(final Release release) { final Release.Smart rel = new Release.Smart(release); try { final String tag = rel.tag(); return new DefaultArtifactVersion(tag); } catch (final IOException exception) { Logger.error(this, "IOException caused from rel.tag()"); return null; } }

Target:
public DefaultArtifactVersion apply(final Release release) { final Release.Smart rel = new Release.Smart(release); try { final String tag = rel.tag(); return new DefaultArtifactVersion(tag); } catch (final IOException exception) { Logger.error(this, "IOException caused from rel.tag()"); throw new RuntimeException(exception); } }
Source:
public void touch(PyObject[] args, String[] kws) { ArgParser ap = JythonUtils.createArgParser(args, kws); Preconditions.checkNotNull(ap); int x = ap.getInt(0); int y = ap.getInt(1); TouchPressType type = TouchPressType.fromIdentifier(ap.getString(2)); if (type == null) type = TouchPressType.DOWN_AND_UP; impl.touch(x, y, type); }

Target:
public void touch(PyObject[] args, String[] kws) { ArgParser ap = JythonUtils.createArgParser(args, kws); Preconditions.checkNotNull(ap); int x = ap.getInt(0); int y = ap.getInt(1); TouchPressType type = TouchPressType.fromIdentifier(ap.getString(2)); if (type == null) { LOG.warning(String.format("Invalid TouchPressType specified (%s) default used instead", ap.getString(2))); type = TouchPressType.DOWN_AND_UP; } impl.touch(x, y, type); }
Source:
public AsyncStorageModeValidator( @Named("che.infra.kubernetes.pvc.strategy") String pvcStrategy, @Named("che.infra.kubernetes.namespace.allow_user_defined") boolean allowUserDefinedNamespaces, @Nullable @Named("che.infra.kubernetes.namespace.default") String defaultNamespaceName, @Named("che.limits.user.workspaces.run.count") int runtimesPerUser) { this.pvcStrategy = pvcStrategy; this.allowUserDefinedNamespaces = allowUserDefinedNamespaces; this.runtimesPerUser = runtimesPerUser; this.isPvcStrategyNotValid = !COMMON_STRATEGY.equals(pvcStrategy); this.runtimesPerUserLimited = runtimesPerUser > 1; this.isNamespaceStrategyNotValid = isNullOrEmpty(defaultNamespaceName) || !defaultNamespaceName.contains("<username>"); }

Target:
public AsyncStorageModeValidator( @Named("che.infra.kubernetes.pvc.strategy") String pvcStrategy, @Named("che.infra.kubernetes.namespace.allow_user_defined") boolean allowUserDefinedNamespaces, @Nullable @Named("che.infra.kubernetes.namespace.default") String defaultNamespaceName, @Named("che.limits.user.workspaces.run.count") int runtimesPerUser) { this.pvcStrategy = pvcStrategy; this.allowUserDefinedNamespaces = allowUserDefinedNamespaces; this.runtimesPerUser = runtimesPerUser; this.isPvcStrategyNotValid = !COMMON_STRATEGY.equals(pvcStrategy); this.singleRuntimeAllowed = runtimesPerUser == 1; this.isNamespaceStrategyNotValid = isNullOrEmpty(defaultNamespaceName) || !defaultNamespaceName.contains("<username>"); }
Source:
public void comment(CommentNode node) { String code = node.getCode(); if (!Syntax.isSightlyComment(code) && !isException(code)) { createViolation(node.getStartLinePosition(), RULE_MESSAGE); } }

Target:
public void comment(CommentNode node) { String code = StringUtils.deleteWhitespace(node.getCode()); if (!Syntax.isSightlyComment(code) && !isException(code)) { createViolation(node.getStartLinePosition(), RULE_MESSAGE); } }
Source:
protected AsyncTaskResult<KeyPair> doInBackground(Void... voids) { AsyncTaskResult<KeyPair> retval = null; while(resolving){ if(!paused) { for (PemToKeyPairConverter converter : converters) { KeyPair keyPair = converter.convert(new String(pemFile)); if (keyPair != null) { retval = new AsyncTaskResult<KeyPair>(keyPair); resolving = false; break; } } if (retval == null) { if(this.passwordFinder != null) this.errorMessage = AppConfig.getInstance().getString(R.string.ssh_key_invalid_passphrase); this.paused = true; publishProgress(new AsyncTaskResult<KeyPair>(new IOException("No converter available to parse selected PEM"))); } } } return retval; }

Target:
protected KeyPair doInBackground(Void... voids) { while(true) { if (isCancelled()) return null; if (paused) continue; for (PemToKeyPairConverter converter : converters) { KeyPair keyPair = converter.convert(new String(pemFile)); if (keyPair != null) { paused = false; return keyPair; } } if (this.passwordFinder != null) { this.errorMessage = AppConfig.getInstance().getString(R.string.ssh_key_invalid_passphrase); } paused = true; publishProgress(new IOException("No converter available to parse selected PEM")); } }
Source:
public void setOverlap(Expression overlap) { if(overlap == null) { return; } OverlapBehavior overlapBehavior = OverlapBehavior.valueOf(overlap.toString()); setOverlapBehavior(overlapBehavior); }

Target:
public void setOverlap(Expression overlap) { if(overlap == null) { return; } OverlapBehavior overlapBehavior = OverlapBehavior .valueOf(overlap.evaluate(null, String.class)); setOverlapBehavior(overlapBehavior); }
Source:
public void propertyValidation() { String PROPERTIES_NO_EXECUTABLE_NAME = "applicationName = testApp \n" + "streamName = fakeStream \n" + "AWSCredentialsProvider = DefaultAWSCredentialsProviderChain\n" + "processingLanguage = malbolge"; ClassLoader classLoader = Mockito.mock(ClassLoader.class); Mockito.doReturn(new ByteArrayInputStream(PROPERTIES_NO_EXECUTABLE_NAME.getBytes())).when(classLoader) .getResourceAsStream(FILENAME); MultiLangDaemonConfig config; try { config = new MultiLangDaemonConfig(FILENAME, classLoader, buildMockConfigurator()); Assert.fail("Construction of the config should have failed due to property validation failing."); } catch (IllegalArgumentException e) { } catch (IOException e) { Assert.fail(); } }

Target:
public void propertyValidation() { String propertiesNoExecutableName = "applicationName = testApp \n" + "streamName = fakeStream \n" + "AWSCredentialsProvider = DefaultAWSCredentialsProviderChain\n" + "processingLanguage = malbolge"; ClassLoader classLoader = Mockito.mock(ClassLoader.class); Mockito.doReturn(new ByteArrayInputStream(propertiesNoExecutableName.getBytes())).when(classLoader) .getResourceAsStream(FILENAME); MultiLangDaemonConfig config; try { config = new MultiLangDaemonConfig(FILENAME, classLoader, buildMockConfigurator()); Assert.fail("Construction of the config should have failed due to property validation failing."); } catch (IllegalArgumentException e) { } catch (IOException e) { Assert.fail(); } }
Source:
public static <T> Sequence<Result<T>> makeCursorBasedQuery( final StorageAdapter adapter, List<Interval> queryIntervals, Filter filter, VirtualColumns virtualColumns, boolean descending, Granularity granularity, final Function<Cursor, Result<T>> mapFn ) { Preconditions.checkArgument( queryIntervals.size() == 1, "Can only handle a single interval, got[%s]", queryIntervals ); return Sequences.filter( Sequences.map( adapter.makeCursors(filter, queryIntervals.get(0), virtualColumns, granularity, descending, null), new Function<Cursor, Result<T>>() { @Override public Result<T> apply(Cursor input) { log.debug("Running over cursor[%s]", input.getTime()); return mapFn.apply(input); } } ), Predicates.<Result<T>>notNull() ); }

Target:
public static <T> Sequence<Result<T>> makeCursorBasedQuery( final StorageAdapter adapter, List<Interval> queryIntervals, Filter filter, VirtualColumns virtualColumns, boolean descending, Granularity granularity, final Function<Cursor, Result<T>> mapFn ) { Preconditions.checkArgument( queryIntervals.size() == 1, "Can only handle a single interval, got[%s]", queryIntervals ); return Sequences.filter( Sequences.map( adapter.makeCursors(filter, queryIntervals.get(0), virtualColumns, granularity, descending, null), new Function<Cursor, Result<T>>() { @Override public Result<T> apply(Cursor input) { return mapFn.apply(input); } } ), Predicates.<Result<T>>notNull() ); }
Source:
protected boolean registerRemoteInstance() throws IOException, ConfigurationException, PackageException { String username; String password; String project; String description = ""; NuxeoClientInstanceType type = null; if (System.console() != null) { username = LauncherRegisterPromptHelper.promptUsername(); password = LauncherRegisterPromptHelper.promptPassword(); List<ConnectProject> projs = getConnectRegisterationBroker().getAvailableProjects(username, password); project = LauncherRegisterPromptHelper.promptProjectId(projs); type = LauncherRegisterPromptHelper.promptInstanceType(); description = LauncherRegisterPromptHelper.promptDescription(); } else { String[] input = new String(IOUtils.toByteArray(System.in)).split("\n"); if (input.length < 4) { throw new IOException("Wrong number of arguments."); } username = input[0]; password = input[1]; project = input[2]; type = NuxeoClientInstanceType.fromString(input[3]); if (input.length > 3) { description = StringUtils.join(Arrays.copyOfRange(input, 4, input.length), "\n"); } } if (type == null) { type = NuxeoClientInstanceType.DEV; } getConnectRegisterationBroker().registerRemote(username, password, project, type, description); log.info("Your server is correctly registered to: " + username); return true; }

Target:
public boolean registerRemoteInstance() throws IOException, ConfigurationException, PackageException { if (params.length > 5) { throw new ConfigurationException("Wrong number of arguments."); } String username; if (params.length > 0) { username = params[0]; } else { username = prompt("Username: ", s -> Pattern.matches(REGISTRATION_USERNAME_REGEX, s), "Username cannot be empty."); } char[] password; if (params.length == 3 || params.length == 5) { password = params[params.length - 1].toCharArray(); } else { password = promptPassword(false); } ConnectProject project; List<ConnectProject> projs = getConnectRegistrationBroker().getAvailableProjects(username, password); if (params.length > 1) { String projectName = params[1]; project = getConnectRegistrationBroker().getProjectByName(projectName, projs); if (project == null) { throw new ConfigurationException("Unknown project: " + projectName); } } else { project = promptProject(projs); } NuxeoClientInstanceType type; String description; if (params.length > 3) { type = NuxeoClientInstanceType.fromString(params[2]); if (type == null) { throw new ConfigurationException("Unknown type: " + params[2]); } description = params[3]; } else { type = promptInstanceType(); description = promptDescription(); } getConnectRegistrationBroker().registerRemote(username, password, project.getUuid(), type, description); log.info(String.format("Server registered to %s for project %s\nType: %s\nDescription: %s", username, project, type, description)); return true; }
Source:
public void setForeground(Color color) { checkWidget(); Color disabledFg = getDisplay().getSystemColor(SWT.COLOR_WIDGET_DISABLED_FOREGROUND); boolean foregroundDisabled = false; if (!this.enabled && color == null) { if (foreground != null) { if (foreground.equals(disabledFg)) { return; } else { color = new Color (getDisplay(), disabledFg.getRGBA()); foregroundDisabled = true; } } } customForeground = color != null && !this.enableDisableCall && !foregroundDisabled; foreground = color; super.setForeground(color); resetCache(0, content.getLineCount()); setCaretLocation(); super.redraw(); }

Target:
public void setForeground(Color color) { checkWidget(); boolean foregroundDisabled = false; if (!this.enabled && color == null) { if (foreground != null) { Color disabledFg = getDisplay().getSystemColor(SWT.COLOR_WIDGET_DISABLED_FOREGROUND); if (foreground.equals(disabledFg)) { return; } else { color = new Color (getDisplay(), disabledFg.getRGBA()); foregroundDisabled = true; } } } customForeground = color != null && !this.insideSetEnableCall && !foregroundDisabled; foreground = color; super.setForeground(color); resetCache(0, content.getLineCount()); setCaretLocation(); super.redraw(); }
Source:
public void visitFunctionCall(FunctionCallTree tree) { String functionName = CheckUtils.getFunctionName(tree); if (CAKE_DEBUG_FUNCTIONS.contains(functionName) && tree.arguments().size() == 2) { ExpressionTree firstArg = tree.arguments().get(0); ExpressionTree secondArg = tree.arguments().get(1); if (firstArg.is(Tree.Kind.REGULAR_STRING_LITERAL) && trimQuotes((LiteralTree) firstArg).equals("debug") && isTrueValue(secondArg)) { context().newIssue(this, tree, MESSAGE); } } super.visitFunctionCall(tree); }

Target:
public void visitFunctionCall(FunctionCallTree tree) { String functionName = CheckUtils.getFunctionName(tree); if (CAKE_DEBUG_FUNCTIONS.contains(functionName) && tree.arguments().size() == 2) { ExpressionTree firstArg = tree.arguments().get(0); ExpressionTree secondArg = tree.arguments().get(1); if (firstArg.is(Tree.Kind.REGULAR_STRING_LITERAL) && trimQuotes((LiteralTree) firstArg).equals("debug") && isTrue(secondArg)) { context().newIssue(this, tree, MESSAGE); } } super.visitFunctionCall(tree); }