auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeQueryCommand() { Disk diskFromDao = getDbFacade().getDiskDao().get(getParameters().getEntityId()); if (diskFromDao != null) { getQueryReturnValue().setReturnValue(null); return; } Volume Volume = getVolumeProviderProxy().getVolumeById(getParameters().getEntityId().toString()); Guid storageDomainId = getParameters().getId(); CinderDisk unregisteredDisk = CinderBroker.volumeToCinderDisk(Volume, storageDomainId); getQueryReturnValue().setReturnValue(unregisteredDisk); }

Target:
protected void executeQueryCommand() { Disk diskFromDao = getDbFacade().getDiskDao().get(getParameters().getEntityId()); if (diskFromDao != null) { log.info("The disk already exist in the DB, hence, should not be fetched from Cinder."); getQueryReturnValue().setReturnValue(null); return; } Volume Volume = getVolumeProviderProxy().getVolumeById(getParameters().getEntityId().toString()); Guid storageDomainId = getParameters().getId(); CinderDisk unregisteredDisk = CinderBroker.volumeToCinderDisk(Volume, storageDomainId); getQueryReturnValue().setReturnValue(unregisteredDisk); }
Source:
private ActionBarDrawerToggle setupDrawerToggle() { return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; }

Target:
private ActionBarDrawerToggle setupDrawerToggle() { return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close); }
Source:
public void setSessionProperty(String sessionId, String key, String value) throws SqlExecutionException { ExecutionContext<?> context = getExecutionContext(sessionId); Environment env = context.getEnvironment(); Environment newEnv = Environment.enrich(env, ImmutableMap.of(key, value), ImmutableMap.of()); ExecutionContext.SessionState sessionState = context.getSessionState(); newEnv.getConfiguration().asMap().forEach((k, v) -> sessionState.config.getConfiguration().setString(k, v)); ExecutionContext<?> newContext = createExecutionContextBuilder( context.getOriginalSessionContext()) .env(newEnv) .sessionState(sessionState) .build(); this.contextMap.put(sessionId, newContext); }

Target:
public void setSessionProperty(String sessionId, String key, String value) throws SqlExecutionException { ExecutionContext<?> context = getExecutionContext(sessionId); Environment env = context.getEnvironment(); Environment newEnv = Environment.enrich(env, ImmutableMap.of(key, value), ImmutableMap.of()); ExecutionContext<?> newContext = createExecutionContextBuilder( context.getOriginalSessionContext()) .env(newEnv) .sessionState(context.getSessionState()) .build(); this.contextMap.put(sessionId, newContext); }
Source:
public Attribute fillAttribute(PerunSessionImpl sess, Group group, Resource resource, AttributeDefinition attributeDefinition) throws InternalErrorException, WrongAttributeAssignmentException { Attribute attribute = new Attribute(attributeDefinition); Attribute unixGIDNamespaceAttribute; try { unixGIDNamespaceAttribute = sess.getPerunBl().getModulesUtilsBl().getUnixGIDNamespaceAttributeWithNotNullValue(sess, resource); } catch(WrongReferenceAttributeValueException ex) { return attribute; } Attribute gidAttribute; try { gidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + unixGIDNamespaceAttribute.getValue()); } catch(AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } try { sess.getPerunBl().getAttributesManagerBl().checkAttributeSyntax(sess, group, gidAttribute); sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSemantics(sess, group, gidAttribute); attribute.setValue(gidAttribute.getValue()); return attribute; } catch(WrongAttributeValueException ex) { gidAttribute.setValue(null); gidAttribute = sess.getPerunBl().getAttributesManagerBl().fillAttribute(sess, group, gidAttribute); attribute.setValue(gidAttribute.getValue()); return attribute; } catch(WrongReferenceAttributeValueException ex) { return attribute; } }

Target:
public Attribute fillAttribute(PerunSessionImpl sess, Group group, Resource resource, AttributeDefinition attributeDefinition) throws InternalErrorException, WrongAttributeAssignmentException { Attribute attribute = new Attribute(attributeDefinition); Attribute unixGIDNamespaceAttribute; try { unixGIDNamespaceAttribute = sess.getPerunBl().getModulesUtilsBl().getUnixGIDNamespaceAttributeWithNotNullValue(sess, resource); } catch(WrongReferenceAttributeValueException ex) { return attribute; } Attribute gidAttribute; try { gidAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF + ":unixGID-namespace:" + unixGIDNamespaceAttribute.getValue()); } catch(AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } try { sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSyntax(sess, group, gidAttribute); sess.getPerunBl().getAttributesManagerBl().forceCheckAttributeSemantics(sess, group, gidAttribute); attribute.setValue(gidAttribute.getValue()); return attribute; } catch(WrongAttributeValueException ex) { gidAttribute.setValue(null); gidAttribute = sess.getPerunBl().getAttributesManagerBl().fillAttribute(sess, group, gidAttribute); attribute.setValue(gidAttribute.getValue()); return attribute; } catch(WrongReferenceAttributeValueException ex) { return attribute; } }
Source:
private void addActiveTask(HashSet<ITask> relevantTasks) { ITask activeTask = taskActivityManager.getActiveTask(); if (activeTask != null) { relevantTasks.add(activeTask); } }

Target:
private void addActiveTask(HashSet<ITask> relevantTasks) { ITask activeTask = taskActivityManager.getActiveTask(); if (activeTask != null && !(activeTask instanceof LocalTask)) { relevantTasks.add(activeTask); } }
Source:
private NewSessionPayload(Reader source, boolean forceMobileJSONWP) throws IOException { this.forceMobileJSONWP = forceMobileJSONWP; int threshold = (int) Math.min( Integer.MAX_VALUE, Math.min( Runtime.getRuntime().freeMemory() / 5, Runtime.getRuntime().maxMemory() / 10)); backingStore = new FileBackedOutputStream(threshold); try (Writer writer = new OutputStreamWriter(backingStore, UTF_8)) { CharStreams.copy(source, writer); } ImmutableSet.Builder<CapabilitiesFilter> adapters = ImmutableSet.builder(); ServiceLoader.load(CapabilitiesFilter.class).forEach(adapters::add); adapters .add(new ChromeFilter()) .add(new EdgeFilter()) .add(new FirefoxFilter()) .add(new InternetExplorerFilter()) .add(new OperaFilter()) .add(new SafariFilter()); this.adapters = adapters.build(); ImmutableSet.Builder<CapabilityTransform> transforms = ImmutableSet.builder(); ServiceLoader.load(CapabilityTransform.class).forEach(transforms::add); transforms .add(new ProxyTransform()) .add(new StripAnyPlatform()) .add(new W3CPlatformNameNormaliser()); this.transforms = transforms.build(); ImmutableSet.Builder<Dialect> dialects = ImmutableSet.builder(); if (getOss() != null) { dialects.add(Dialect.OSS); } if (getAlwaysMatch() != null || getFirstMatches() != null) { dialects.add(Dialect.W3C); } this.dialects = dialects.build(); validate(); }

Target:
private NewSessionPayload(Reader source, boolean forceMobileJSONWP) throws IOException { this.forceMobileJSONWP = forceMobileJSONWP; int threshold = (int) Math.min( Integer.MAX_VALUE, Math.min( Runtime.getRuntime().freeMemory() / 5, Runtime.getRuntime().maxMemory() / 10)); backingStore = new FileBackedOutputStream(threshold); try (Writer writer = new OutputStreamWriter(backingStore, UTF_8)) { CharStreams.copy(source, writer); } ImmutableSet.Builder<CapabilitiesFilter> adapters = ImmutableSet.builder(); ServiceLoader.load(CapabilitiesFilter.class).forEach(adapters::add); adapters .add(new ChromeFilter()) .add(new EdgeFilter()) .add(new FirefoxFilter()) .add(new InternetExplorerFilter()) .add(new OperaFilter()) .add(new SafariFilter()); this.adapters = adapters.build(); ImmutableSet.Builder<CapabilityTransform> transforms = ImmutableSet.builder(); ServiceLoader.load(CapabilityTransform.class).forEach(transforms::add); transforms .add(new ProxyTransform()) .add(new StripAnyPlatform()) .add(new W3CPlatformNameNormaliser()); this.transforms = transforms.build(); ImmutableSet.Builder<Dialect> dialects = ImmutableSet.builder(); if (getOss() != null) { dialects.add(Dialect.OSS); } if (getAlwaysMatch() != null || getFirstMatch() != null) { dialects.add(Dialect.W3C); } validate(); }
Source:
private MessageTemplate(MessageTemplate copyFrom) { if (copyFrom != null) { this.ttl = copyFrom.getTtl(); tags.addAll(copyFrom.getTags()); } }

Target:
private MessageTemplate(MessageTemplate copyFrom) { this(); if (copyFrom != null) { this.ttl = copyFrom.getTtl(); tags.addAll(copyFrom.getTags()); } }
Source:
public void setKeyStroke(String k) { ScoutKeystroke scoutKeystroke = new ScoutKeystroke(k); scoutKeystroke.parse(); if (scoutKeystroke.isValid()) { propertySupport.setPropertyString(PROP_KEYSTROKE, scoutKeystroke.getNormalizedKeystroke()); } else { LOG.warn("Could not create keystroke '" + k + "' because he is invalid!"); } }

Target:
public void setKeyStroke(String k) { KeyStrokeNormalizer scoutKeystroke = new KeyStrokeNormalizer(k); scoutKeystroke.normalize(); if (scoutKeystroke.isValid()) { propertySupport.setPropertyString(PROP_KEYSTROKE, scoutKeystroke.getNormalizedKeystroke()); } else { LOG.warn("Could not create keystroke '" + k + "' because it is invalid!"); } }
Source:
protected boolean requestCookie(HttpConnectionInterceptorContext context) { return requestCookie(context, sessionURL, sessionRequestBody, "application/x-www-form-urlencoded", "application/json", new OnExecuteCallable() { @Override public boolean call(HttpConnection connection) throws IOException { if (sessionHasStarted(connection.responseAsInputStream())) { return storeCookiesFromResponse(connection.getConnection()); } else { return false; } } } ); }

Target:
boolean requestCookie(HttpConnectionInterceptorContext context) { return requestCookie(context, sessionURL, sessionRequestBody, sessionRequestMimeType, "application/json", new OnExecuteCallable() { @Override public boolean call(HttpConnection connection) throws IOException { if (sessionHasStarted(connection.responseAsInputStream())) { return storeCookiesFromResponse(connection.getConnection()); } else { return false; } } } ); }
Source:
public CrateConnection(ClientHandleRegistry.ClientHandle handle, Properties properties) { this.clientHandle = handle; this.readOnly = false; this.strict = Boolean.valueOf(properties.getProperty("strict", "false")); this.properties = properties; }

Target:
public CrateConnection(ClientHandleRegistry.ClientHandle handle, Properties properties) { this.clientHandle = handle; this.readOnly = false; this.properties = properties; setDefaultProperty("strict", "false"); }
Source:
public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(name); out.writeUTF(managerPrefix); out.writeUTF(uriString); out.writeInt(backupCount); out.writeInt(asyncBackupCount); out.writeUTF(inMemoryFormat.name()); out.writeObject(evictionConfig); out.writeObject(wanReplicationRef); writeKeyValueTypes(out); writeTenant(out); writeFactories(out); out.writeBoolean(isReadThrough); out.writeBoolean(isWriteThrough); out.writeBoolean(isStoreByValue); out.writeBoolean(isManagementEnabled); out.writeBoolean(isStatisticsEnabled); out.writeBoolean(hotRestartConfig.isEnabled()); out.writeBoolean(hotRestartConfig.isFsync()); out.writeObject(eventJournalConfig); out.writeUTF(quorumName); out.writeBoolean(hasListenerConfiguration()); if (hasListenerConfiguration()) { writeListenerConfigurations(out); } out.writeUTF(mergePolicy); out.writeBoolean(disablePerEntryInvalidationEvents); }

Target:
public void writeData(ObjectDataOutput out) throws IOException { out.writeUTF(name); out.writeUTF(managerPrefix); out.writeUTF(uriString); out.writeInt(backupCount); out.writeInt(asyncBackupCount); out.writeUTF(inMemoryFormat.name()); out.writeObject(evictionConfig); out.writeObject(wanReplicationRef); writeKeyValueTypes(out); writeTenant(out); writeFactories(out); out.writeBoolean(isReadThrough); out.writeBoolean(isWriteThrough); out.writeBoolean(isStoreByValue); out.writeBoolean(isManagementEnabled); out.writeBoolean(isStatisticsEnabled); out.writeObject(hotRestartConfig); out.writeObject(eventJournalConfig); out.writeUTF(quorumName); out.writeBoolean(hasListenerConfiguration()); if (hasListenerConfiguration()) { writeListenerConfigurations(out); } out.writeUTF(mergePolicy); out.writeBoolean(disablePerEntryInvalidationEvents); }
Source:
public static void main(String[] args) throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host("127.0.0.1") .port(ConfigurationProperties.DEFAULT_HOTROD_PORT) .clientIntelligence(ClientIntelligence.BASIC) .marshaller(ProtoStreamMarshaller.class); RemoteCacheManager client = new RemoteCacheManager(builder.build()); RemoteCache<String, InstaPost> instaPostsCache = client.administration().getOrCreateCache(CACHE_NAME, "default"); addInstapostsSchema(client); QueryFactory queryFactory = Search.getQueryFactory(instaPostsCache); Query query = queryFactory.create("FROM tutorial.InstaPost p where p.user = :userName"); query.setParameter("userName", "belen_esteban"); ContinuousQuery<String, InstaPost> continuousQuery = Search.getContinuousQuery(instaPostsCache); ContinuousQueryListener<String, InstaPost> listener = new ContinuousQueryListener<String, InstaPost>() { @Override public void resultJoining(String id, InstaPost post) { System.out.println(String.format("@%s has posted again! Hashtag: #%s", post.user, post.hashtag)); } }; continuousQuery.removeAllListeners(); continuousQuery.addContinuousQueryListener(query, listener); for (int i = 0; i < 1000; i++) { addRandomPost(instaPostsCache); Thread.sleep(10); } client.administration().removeCache(CACHE_NAME); client.stop(); }

Target:
public static void main(String[] args) throws Exception { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host("127.0.0.1") .port(ConfigurationProperties.DEFAULT_HOTROD_PORT) .marshaller(ProtoStreamMarshaller.class); RemoteCacheManager client = new RemoteCacheManager(builder.build()); RemoteCache<String, InstaPost> instaPostsCache = client.administration().getOrCreateCache(CACHE_NAME, "default"); addInstapostsSchema(client); QueryFactory queryFactory = Search.getQueryFactory(instaPostsCache); Query query = queryFactory.create("FROM tutorial.InstaPost p where p.user = :userName"); query.setParameter("userName", "belen_esteban"); ContinuousQuery<String, InstaPost> continuousQuery = Search.getContinuousQuery(instaPostsCache); List<InstaPost> queryPosts = new ArrayList<>(); ContinuousQueryListener<String, InstaPost> listener = new ContinuousQueryListener<String, InstaPost>() { @Override public void resultJoining(String key, InstaPost post) { System.out.println(String.format("@%s has posted again! Hashtag: #%s", post.user, post.hashtag)); queryPosts.add(post); } }; continuousQuery.addContinuousQueryListener(query, listener); for (int i = 0; i < 1000; i++) { addRandomPost(instaPostsCache); Thread.sleep(10); } System.out.println("Total posts " + instaPostsCache.size()); System.out.println("Total posts by @belen_esteban " + queryPosts.size()); continuousQuery.removeContinuousQueryListener(listener); client.administration().removeCache(CACHE_NAME); client.stop(); }
Source:
public void testDetermineMessageReturnsClassNameForNoParameterExpansion() throws Exception { Log log = mock(Log.class); when(log.isDebugEnabled()).thenReturn(false); assertEquals("LoggedUtils.determineMessage shouldn't return parameter expansion for a disabled log level.", Object.class.getName(), LoggedUtils.determineMessage(log, LoggedOverridingSubclassNoParameters.class.getAnnotation(Logged.class), new Object())); assertEquals("LoggedUtils.determineMessage shouldn't return parameter expansion when diabled completely.", Object.class.getName(), LoggedUtils.determineMessage(log, LoggedClass.class.getAnnotation(Logged.class), new Object())); }

Target:
public void testDetermineMessageReturnsClassNameForNoParameterExpansion() throws Exception { Log log = mock(Log.class); assertEquals("LoggedUtils.determineMessage shouldn't return parameter expansion for a disabled log level.", Object.class.getName(), LoggedUtils.determineMessage(log, LoggedOverridingSubclassNoParameters.class.getAnnotation(Logged.class), new Object())); assertEquals("LoggedUtils.determineMessage shouldn't return parameter expansion when diabled completely.", Object.class.getName(), LoggedUtils.determineMessage(log, LoggedClass.class.getAnnotation(Logged.class), new Object())); }
Source:
private static boolean isGetter(ASTMethodDeclaration node, Map<String, String> fieldNames) { if (node.getFirstDescendantOfType(ASTFormalParameters.class).getParameterCount() != 0 || node.getFirstDescendantOfType(ASTResultType.class).isVoid()) { return false; } return fieldNames.containsKey(node.getName()); }

Target:
private static boolean isGetter(ASTMethodDeclaration node, Map<String, String> fieldNames) { if (node.getFirstDescendantOfType(ASTFormalParameters.class).getParameterCount() != 0 || node.getFirstDescendantOfType(ASTResultType.class).isVoid()) { return false; } if (node.getName().startsWith("get")) { return containsIgnoreCase(fieldNames.keySet(), node.getName().substring(3)); } else if (node.getName().startsWith("is")) { return containsIgnoreCase(fieldNames.keySet(), node.getName().substring(2)); } return fieldNames.containsKey(node.getName()); }
Source:
private Map<?,?> loadValues() { String pathWithLocaleAndFilename = "/" + locale.getLanguage() + "/" + this.filename; String pathWithFilename = "/" + filename + ".yml"; String pathWithLocale = "/" + locale.getLanguage() + ".yml"; List<String> paths = Arrays.asList(pathWithLocaleAndFilename, pathWithFilename, pathWithLocale); InputStream stream = null; for (String path : paths) { stream = findStream(path); if (stream != null) { break; } } if (stream == null) { return null; } final Map<?,?> valuesMap = new Yaml().loadAs(stream, Map.class); Map<?,?> localeBased = (Map<?,?>) valuesMap.get(locale.getLanguage()); if (localeBased == null) { localeBased = (Map<?,?>) valuesMap.get(filename); } return (Map<?,?>) localeBased.get("faker"); }

Target:
private Map loadValues() { String pathWithLocaleAndFilename = "/" + locale.getLanguage() + "/" + this.filename; String pathWithFilename = "/" + filename + ".yml"; String pathWithLocale = "/" + locale.getLanguage() + ".yml"; List<String> paths = Arrays.asList(pathWithLocaleAndFilename, pathWithFilename, pathWithLocale); InputStream stream = null; for (String path : paths) { stream = findStream(path); if (stream != null) { break; } } if (stream == null) { return null; } final Map valuesMap = new Yaml().loadAs(stream, Map.class); Map localeBased = (Map) valuesMap.get(locale.getLanguage()); if (localeBased == null) { localeBased = (Map) valuesMap.get(filename); } return (Map) localeBased.get("faker"); }
Source:
private void removeRemoteSourceHelper(RequestErrorTracker errorTracker, Request request, SettableFuture<?> future) { errorTracker.startRequest(); FutureCallback<StatusResponse> callback = new FutureCallback<StatusResponse>() { @Override public void onSuccess(@Nullable StatusResponse response) { if (response == null) { throw new RuntimeException("Request failed with null response"); } if (response.getStatusCode() != HttpStatus.OK.code()) { throw new RuntimeException("Request failed with HTTP status " + response.getStatusCode()); } future.set(null); } @Override public void onFailure(Throwable failedReason) { if (failedReason instanceof RejectedExecutionException && httpClient.isClosed()) { log.error("Unable to destroy exchange source at %s. HTTP client is closed", request.getUri()); return; } try { errorTracker.requestFailed(failedReason); } catch (PrestoException e) { future.setException(e); return; } ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (errorRateLimit.isDone()) { removeRemoteSourceHelper(errorTracker, request, future); } else { errorRateLimit.addListener(() -> removeRemoteSourceHelper(errorTracker, request, future), errorScheduledExecutor); } } }; addCallback(httpClient.executeAsync(request, createStatusResponseHandler()), callback, directExecutor()); }

Target:
private void removeRemoteSourceHelper(RequestErrorTracker errorTracker, Request request, SettableFuture<?> future) { errorTracker.startRequest(); FutureCallback<StatusResponse> callback = new FutureCallback<StatusResponse>() { @Override public void onSuccess(@Nullable StatusResponse response) { if (response == null) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with null response"); } if (response.getStatusCode() != OK.code()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Request failed with HTTP status " + response.getStatusCode()); } future.set(null); } @Override public void onFailure(Throwable failedReason) { if (failedReason instanceof RejectedExecutionException && httpClient.isClosed()) { LOG.error("Unable to destroy exchange source at %s. HTTP client is closed", request.getUri()); future.setException(failedReason); return; } try { errorTracker.requestFailed(failedReason); } catch (PrestoException e) { future.setException(e); return; } ListenableFuture<?> errorRateLimit = errorTracker.acquireRequestPermit(); if (errorRateLimit.isDone()) { removeRemoteSourceHelper(errorTracker, request, future); } else { errorRateLimit.addListener(() -> removeRemoteSourceHelper(errorTracker, request, future), errorScheduledExecutor); } } }; addCallback(httpClient.executeAsync(request, createStatusResponseHandler()), callback, directExecutor()); }
Source:
protected void succeeded(long nanos, Description description) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "{} execution time: {}", description.getMethodName(), DurationFormatUtils.formatDuration(TimeUnit.NANOSECONDS.toMillis(nanos), "HH:mm:ss.S")); } }

Target:
protected void succeeded(long nanos, Description description) { if (LOGGER.isDebugEnabled()) { LOGGER.debug( "{}.{} execution time: {}", description.getClassName(), description.getMethodName(), DurationFormatUtils.formatDuration(TimeUnit.NANOSECONDS.toMillis(nanos), "HH:mm:ss.S")); } }
Source:
private List<TabletMetadata> findOverlappingTablets(KeyExtent loadRange, Iterator<TabletMetadata> tabletIter) { try { List<TabletMetadata> tablets = new ArrayList<>(); TabletMetadata currTablet = tabletIter.next(); int cmp; while ((cmp = PREV_COMP.compare(currTablet.getPrevEndRow(), loadRange.getPrevEndRow())) < 0) { currTablet = tabletIter.next(); } if (cmp != 0) { throw new IllegalStateException("Unexpected prev end row " + currTablet + " " + loadRange); } tablets.add(currTablet); while ((cmp = END_COMP.compare(currTablet.getEndRow(), loadRange.getEndRow())) < 0) { currTablet = tabletIter.next(); tablets.add(currTablet); } if (cmp != 0) { throw new IllegalStateException("Unexpected end row " + currTablet + " " + loadRange); } return tablets; } catch (NoSuchElementException e) { NoSuchElementException ne2 = new NoSuchElementException("Failed to find overlapping tablets for " + loadRange); ne2.initCause(e); throw ne2; } }

Target:
private List<TabletMetadata> findOverlappingTablets(KeyExtent loadRange, Iterator<TabletMetadata> tabletIter) { TabletMetadata currTablet = null; try { List<TabletMetadata> tablets = new ArrayList<>(); currTablet = tabletIter.next(); int cmp; while ((cmp = PREV_COMP.compare(currTablet.getPrevEndRow(), loadRange.getPrevEndRow())) < 0) { currTablet = tabletIter.next(); } if (cmp != 0) { throw new IllegalStateException("Unexpected prev end row " + currTablet + " " + loadRange); } tablets.add(currTablet); while ((cmp = END_COMP.compare(currTablet.getEndRow(), loadRange.getEndRow())) < 0) { currTablet = tabletIter.next(); tablets.add(currTablet); } if (cmp != 0) { throw new IllegalStateException("Unexpected end row " + currTablet + " " + loadRange); } return tablets; } catch (NoSuchElementException e) { NoSuchElementException ne2 = new NoSuchElementException( "Failed to find overlapping tablets " + currTablet + " " + loadRange); ne2.initCause(e); throw ne2; } }
Source:
public PluginInterface findPlugin( Instance instance ) { PluginInterface result = null; if( this.simulatePlugins ) { result = new PluginMock(); } else { String installerName = null; if( instance.getComponent() != null ) installerName = ComponentHelpers.findComponentInstaller( instance.getComponent()); for( PluginInterface pi : this.plugins ) { if( pi.getPluginName().equalsIgnoreCase( installerName )) { result = pi; break; } } if( result == null ) this.logger.severe( "No plugin was found for instance '" + instance.getName() + "' with installer '" + installerName + "'." ); } if( result != null ) result.setNames( this.applicationName, this.scopedInstancePath ); return (result == null ? null : new PluginProxy(result)); }

Target:
public PluginInterface findPlugin( Instance instance ) { PluginInterface result = null; if( this.simulatePlugins ) { result = new PluginMock(); } else { String installerName = null; if( instance.getComponent() != null ) installerName = ComponentHelpers.findComponentInstaller( instance.getComponent()); for( PluginInterface pi : this.plugins ) { if( pi.getPluginName().equalsIgnoreCase( installerName )) { result = pi; break; } } if( result == null ) this.logger.severe( "No plugin was found for instance '" + instance.getName() + "' with installer '" + installerName + "'." ); } if( result != null ) result.setNames( this.applicationName, this.scopedInstancePath ); return result == null ? null : new PluginProxy(result); }
Source:
public void checkSpecificAccessControl() { AccountAttributes account = logic.getAccount(userInfo.getId()); if (account == null) { throw new UnauthorizedAccessException("This account is not registered"); } gateKeeper.verifyInstructorPrivileges(account); }

Target:
public void checkSpecificAccessControl() { String entityType = getNonNullRequestParamValue(Const.ParamsNames.ENTITY_TYPE); if (!((entityType.equals(Const.EntityType.STUDENT) && userInfo.isStudent) || (entityType.equals(Const.EntityType.INSTRUCTOR) && userInfo.isInstructor))) { throw new UnauthorizedAccessException("Current account cannot access to courses of request entity type"); } }
Source:
public void testStaticGroupsAlphabeticalOrder() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class); checkConfig.addAttribute("option", "top"); checkConfig.addAttribute("groups", "org, java"); checkConfig.addAttribute("sortStaticImportsAlphabetically", "true"); checkConfig.addAttribute("separated", "true"); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checkConfig, getPath("InputImportOrderStaticGroupOrder.java"), expected); }

Target:
public void testStaticGroupsAlphabeticalOrder() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class); checkConfig.addAttribute("option", "top"); checkConfig.addAttribute("groups", "org, java"); checkConfig.addAttribute("sortStaticImportsAlphabetically", "true"); final String[] expected = { "6: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.*"), "8: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), }; verify(checkConfig, getPath("InputImportOrderStaticGroupOrder.java"), expected); }
Source:
public Query getRevisionAndjobsInfoQuery(final String user, final boolean pending, final boolean running, final boolean finished, String startCursor, String endCursor, int pageSize, boolean first, FilterModel filterModel) { try { Jobs.Builder jobsBuilder = new Jobs.Builder().excludeDataManagement().excludeRemovedTime(); if (startCursor != null) jobsBuilder.after(startCursor); if (endCursor != null) jobsBuilder.before(endCursor); if (first) jobsBuilder.first(pageSize); else jobsBuilder.last(pageSize); List<JobInput> input = new ArrayList<>(); jobsBuilder.input(input); for (JobStatus status : JobStatus.values()) { boolean fetch; switch (status) { case PENDING: fetch = pending; break; case RUNNING: fetch = running; break; case FINISHED: fetch = finished; break; default: fetch = true; } if (fetch) { if (filterModel.isMatchAny() && !filterModel.getConstraints().isEmpty()) { for (Constraint constraint : filterModel.getConstraints()) { input.add(getJobInputWithStatus(status, user, constraint.getFilteringString(Field.ID), constraint.getFilteringString(Field.PRIORITY), constraint.getFilteringString(Field.NAME))); } } else { String id = null; String priority = null; String name = null; for (Constraint contraint : filterModel.getConstraints()) { id = getValue(id, contraint.getFilteringString(Field.ID)); priority = getValue(priority, contraint.getFilteringString(Field.PRIORITY)); name = getValue(name, contraint.getFilteringString(Field.NAME)); } input.add(getJobInputWithStatus(status, user, id, priority, name)); } } } Query.Builder queryBuilder = new Query.Builder().query(jobsBuilder.build().getQueryString()); return queryBuilder.build(); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage()); return null; } }

Target:
public Query getRevisionAndjobsInfoQuery(final String user, final boolean pending, final boolean running, final boolean finished, String startCursor, String endCursor, int pageSize, boolean first, FilterModel filterModel) { try { Jobs.Builder jobsBuilder = new Jobs.Builder().excludeDataManagement().excludeRemovedTime(); if (startCursor != null) jobsBuilder.after(startCursor); if (endCursor != null) jobsBuilder.before(endCursor); if (first) jobsBuilder.first(pageSize); else jobsBuilder.last(pageSize); List<JobInput> input = getJobInputs(user, pending, running, finished, filterModel); jobsBuilder.input(input); Query.Builder queryBuilder = new Query.Builder().query(jobsBuilder.build().getQueryString()); return queryBuilder.build(); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage()); return null; } }
Source:
public SerializationConfigurationBuilder addContextInitializer(SerializationContextInitializer sci) { if (sci != null) attributes.attribute(SERIALIZATION_CONTEXT_INITIALIZERS).computeIfAbsent(ArrayList::new).add(sci); return this; }

Target:
public SerializationConfigurationBuilder addContextInitializer(SerializationContextInitializer sci) { if (sci == null) throw new CacheConfigurationException("SerializationContextInitializer cannot be null"); attributes.attribute(SERIALIZATION_CONTEXT_INITIALIZERS).computeIfAbsent(ArrayList::new).add(sci); return this; }
Source:
public void testAttemptLoadAsResourceFileDNE() throws Exception { Properties testProperties = PropertiesLoader.attemptLoadAsResource(NON_EXISTENT_FILENAME, null); assertThat(testProperties.entrySet(), equalTo(Collections.emptySet())); }

Target:
public void testAttemptLoadAsResourceFileDNE() throws Exception { Properties testProperties = PropertiesLoader.attemptLoadAsResource(NON_EXISTENT_FILENAME, null); assertThat(testProperties.entrySet(), is(empty())); }
Source:
public void putWithAuthentication(String url, String username, String password, int id, Model model, AsyncHttpResponseHandler response) throws UnsupportedEncodingException { Header[] headers = { createBasicAuthenticationHeader(username, password) }; String body = model.getData().toString().substring(0); put(url, id, new ArrayList<Header>(Arrays.asList(headers)), body, response); }

Target:
public void putWithAuthentication(String url, String username, String password, int id, Model model, AsyncHttpResponseHandler response) throws UnsupportedEncodingException { Header[] headers = { createBasicAuthenticationHeader(username, password) }; String body = model.getData().toString(); put(url, id, new ArrayList<Header>(Arrays.asList(headers)), body, response); }
Source:
public ManagedArtifact getArtifact(String pathInfo) { try { repositorySynchronizationLock.lock(); LOGGER.entering(); ManagedArtifact managedArtifact = getMatchedArtifact(pathInfo); if (managedArtifact.isExpired()) { throw new ArtifactDownloadException("The requested artifact: " + managedArtifact.getArtifactName() + " has expired"); } LOGGER.exiting(managedArtifact); return managedArtifact; } finally { repositorySynchronizationLock.unlock(); } }

Target:
public ManagedArtifact getArtifact(String pathInfo) { LOGGER.entering(pathInfo); try { repositorySynchronizationLock.lock(); ManagedArtifact managedArtifact = getMatchedArtifact(pathInfo); if (managedArtifact.isExpired()) { throw new ArtifactDownloadException("The requested artifact: " + managedArtifact.getArtifactName() + " has expired"); } LOGGER.exiting(managedArtifact); return managedArtifact; } finally { repositorySynchronizationLock.unlock(); } }
Source:
public void reportMetrics(final Map<MetricName, Gauge> gauges, final Map<MetricName, Counter> counters, final Map<MetricName, Histogram> histograms, final Map<MetricName, Meter> meters, final Map<MetricName, Timer> timers) { if (!elasticsearchClient.isElasticsearchAvailable() && !corePlugin.isOnlyLogElasticsearchMetricReports()) { return; } long timestamp = clock.getTime(); final Timer.Context time = registry.timer(reportingTimeMetricName).time(); final MetricsOutputStreamHandler metricsOutputStreamHandler = new MetricsOutputStreamHandler(gauges, counters, histograms, meters, timers, timestamp); if (!corePlugin.isOnlyLogElasticsearchMetricReports()) { httpClient.send("POST", corePlugin.getElasticsearchUrl() + "/_bulk", null, metricsOutputStreamHandler, new ElasticsearchClient.BulkErrorReportingResponseHandler()); } else { try { final ByteArrayOutputStream os = new ByteArrayOutputStream(); metricsOutputStreamHandler.withHttpURLConnection(os); elasticsearchMetricsLogger.info(os.toString("UTF-8")); } catch (IOException e) { logger.warn(e.getMessage(), e); } } time.stop(); }

Target:
public void reportMetrics(final Map<MetricName, Gauge> gauges, final Map<MetricName, Counter> counters, final Map<MetricName, Histogram> histograms, final Map<MetricName, Meter> meters, final Map<MetricName, Timer> timers) { long timestamp = clock.getTime(); final Timer.Context time = registry.timer(reportingTimeMetricName).time(); final MetricsOutputStreamHandler metricsOutputStreamHandler = new MetricsOutputStreamHandler(gauges, counters, histograms, meters, timers, timestamp); if (!corePlugin.isOnlyLogElasticsearchMetricReports()) { if (!elasticsearchClient.isElasticsearchAvailable()) { return; } httpClient.send("POST", corePlugin.getElasticsearchUrl() + "/_bulk", null, metricsOutputStreamHandler, new ElasticsearchClient.BulkErrorReportingResponseHandler()); } else { try { final ByteArrayOutputStream os = new ByteArrayOutputStream(); metricsOutputStreamHandler.withHttpURLConnection(os); elasticsearchMetricsLogger.info(os.toString("UTF-8")); } catch (IOException e) { logger.warn(e.getMessage(), e); } } time.stop(); }
Source:
public void transientFilesWorkAreCleaned() throws Exception { final File file = feature.resolveAndCreate(new File("pfouh")); Thread.sleep(100); service.schedule(new CreateFile(file)); service.awaitCompletion(5, TimeUnit.SECONDS); }

Target:
public void transientFilesWorkAreCleaned() throws Exception { final File file = feature.resolveAndCreate(new File("pfouh")); service.schedule(new CreateFile(file)); service.awaitCompletion(5, TimeUnit.SECONDS); }
Source:
public static void validateFactoryOptions(Factory factory, ReadableConfig options) { factory.requiredOptions() .forEach(option -> { final Object value = readOption(options, option); if (value == null) { throw new ValidationException( String.format( "A value for required option '%s' is missing.\n\n" + "Required options are:\n\n" + "%s", option.key(), factory.requiredOptions().stream() .map(ConfigOption::key) .sorted() .collect(Collectors.joining("\n")))); } }); factory.optionalOptions() .forEach(option -> readOption(options, option)); }

Target:
public static void validateFactoryOptions(Factory factory, ReadableConfig options) { final List<String> missingRequiredOptions = factory.requiredOptions().stream() .filter(option -> readOption(options, option) == null) .map(ConfigOption::key) .sorted() .collect(Collectors.toList()); if (!missingRequiredOptions.isEmpty()) { throw new ValidationException( String.format( "One or more required options are missing.\n\n" + "Missing required options are:\n\n" + "%s", String.join("\n", missingRequiredOptions))); } factory.optionalOptions() .forEach(option -> readOption(options, option)); }
Source:
FirebaseRecyclerAdapter(Class<T> modelClass, int modelLayout, Class<VH> viewHolderClass, FirebaseArray snapshots) { mModelClass = modelClass; mModelLayout = modelLayout; mViewHolderClass = viewHolderClass; mSnapshots = snapshots; mSnapshots.setOnChangedListener(new FirebaseArray.OnChangedListener() { @Override public void onChanged(EventType type, int index, int oldIndex) { switch (type) { case Added: notifyItemInserted(index); break; case Changed: notifyItemChanged(index); break; case Removed: notifyItemRemoved(index); break; case Moved: notifyItemMoved(oldIndex, index); break; default: throw new IllegalStateException("Incomplete case statement"); } } @Override public void onCancelled(DatabaseError databaseError) { FirebaseRecyclerAdapter.this.onCancelled(databaseError); } }); }

Target:
FirebaseRecyclerAdapter(Class<T> modelClass, int modelLayout, Class<VH> viewHolderClass, FirebaseArray snapshots) { mModelClass = modelClass; mModelLayout = modelLayout; mViewHolderClass = viewHolderClass; mSnapshots = snapshots; mSnapshots.setOnChangedListener(new FirebaseArray.OnChangedListener() { @Override public void onChanged(EventType type, int index, int oldIndex) { switch (type) { case ADDED: notifyItemInserted(index); break; case CHANGED: notifyItemChanged(index); break; case REMOVED: notifyItemRemoved(index); break; case MOVED: notifyItemMoved(oldIndex, index); break; default: throw new IllegalStateException("Incomplete case statement"); } } @Override public void onCancelled(DatabaseError databaseError) { FirebaseRecyclerAdapter.this.onCancelled(databaseError); } }); }
Source:
public void click(){ B86_ZK_4016FileDealer.writeMsg("click"); }

Target:
public void click(){ Clients.log("click"); }
Source:
private String internalGetUserEnv(final Map<String, String> overrideEnv ) throws IOException, InterruptedException { WindowsProcess envProcess = new WindowsProcess(this.domain, this.user, this.password); try { envProcess.startWithLogon(new String[]{"cmd.exe", "/c", "set"}, null, null); int exitCode = envProcess.waitFor(); if (exitCode != 0) { throw win32ErrorIOException("Unable to read user environment from cmd.exe, exitCode=" + exitCode); } final InputStreamReader isr = new InputStreamReader(envProcess.inputStream); final BufferedReader br = new BufferedReader(isr); try { String[] vals; String line, varname, value; while ((line = br.readLine()) != null) { vals = line.split("="); varname = vals[0]; value = overrideEnv.get(varname); if (value == null) { overrideEnv.put(varname, vals[1]); } } } catch (IOException e) { throw e; } finally { try { br.close(); } catch (Exception e) { } try { isr.close(); } catch (Exception e) { } } String block = null; try { Class<?> cl = Class.forName("java.lang.ProcessEnvironment"); for (final Method method : cl.getDeclaredMethods()) { if ("toEnvironmentBlock".equals(method.getName()) && (method.getParameterTypes().length == 1)) { method.setAccessible(true); block = (String) method.invoke(null, overrideEnv); break; } } } catch (Exception e) { e.printStackTrace(); } return block; } finally { envProcess.destroy(); envProcess.close(); } }

Target:
private String internalGetUserEnv(final Map<String, String> overrideEnv ) throws IOException, InterruptedException { WindowsProcess envProcess = new WindowsProcess(this.domain, this.user, this.password); try { envProcess.startWithLogon(new String[]{"cmd.exe", "/c", "set"}, null, null); int exitCode = envProcess.waitFor(); if (exitCode != 0) { throw win32ErrorIOException("Unable to read user environment from cmd.exe, exitCode=" + exitCode); } final InputStreamReader isr = new InputStreamReader(envProcess.inputStream); final BufferedReader br = new BufferedReader(isr); try { String[] vals; String line, varname, value; while ((line = br.readLine()) != null) { vals = line.split("="); varname = vals[0]; value = overrideEnv.get(varname); if (value == null) { overrideEnv.put(varname, vals[1]); } } } catch (IOException e) { throw e; } finally { try { br.close(); } catch (Exception e) { } try { isr.close(); } catch (Exception e) { } } String block = null; try { Class<?> cl = Class.forName("java.lang.ProcessEnvironment"); for (final Method method : cl.getDeclaredMethods()) { if (isToEnvironmentBlockMethodWithMapParameter(method)) { method.setAccessible(true); block = (String) method.invoke(null, overrideEnv); break; } } } catch (Exception e) { e.printStackTrace(); } return block; } finally { envProcess.destroy(); envProcess.close(); } }
Source:
public String unpackString() throws IOException { int strLen = unpackRawStringHeader(); if(strLen > 0) { if(strLen > config.getMaxUnpackStringSize()) { throw new MessageSizeException(String.format("cannot unpack a String of size larger than %,d: %,d", config.getMaxUnpackStringSize(), strLen), strLen); } prepareDecoder(); assert(decoder != null); decoder.reset(); try { int cursor = 0; decodeBuffer.clear(); StringBuilder sb = new StringBuilder(); while(cursor < strLen) { if (!ensure(strLen-cursor)) throw new EOFException(); int readLen = Math.min(buffer.size() - position, strLen-cursor); ByteBuffer bb = buffer.toByteBuffer(position, readLen); while(bb.hasRemaining()) { boolean endOfInput = (cursor + readLen) >= strLen; CoderResult cr = decoder.decode(bb, decodeBuffer, endOfInput); if(endOfInput && cr.isUnderflow()) cr = decoder.flush(decodeBuffer); if(cr.isOverflow()) { decoder.reset(); } if(cr.isUnderflow() && bb.hasRemaining()) { if(config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) { throw new MalformedInputException(strLen); } while (bb.hasRemaining()) bb.get(); } if(cr.isError()) { if((cr.isMalformed() && config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) || (cr.isUnmappable() && config.getActionOnUnmappableCharacter() == CodingErrorAction.REPORT)) { cr.throwException(); } } decodeBuffer.flip(); sb.append(decodeBuffer); decodeBuffer.clear(); } cursor += readLen; consume(readLen); } return sb.toString(); } catch(CharacterCodingException e) { throw new MessageStringCodingException(e); } } else return EMPTY_STRING; }

Target:
public String unpackString() throws IOException { int strLen = unpackRawStringHeader(); if(strLen > 0) { if(strLen > config.getMaxUnpackStringSize()) { throw new MessageSizeException(String.format("cannot unpack a String of size larger than %,d: %,d", config.getMaxUnpackStringSize(), strLen), strLen); } prepareDecoder(); assert(decoder != null); decoder.reset(); try { int cursor = 0; decodeBuffer.clear(); StringBuilder sb = new StringBuilder(); while(cursor < strLen) { int readLen = Math.min(position < buffer.size() ? buffer.size() - position : buffer.size(), strLen-cursor); if (!ensure(readLen)) throw new EOFException(); ByteBuffer bb = buffer.toByteBuffer(position, readLen); while(bb.hasRemaining()) { boolean endOfInput = (cursor + readLen) >= strLen; CoderResult cr = decoder.decode(bb, decodeBuffer, endOfInput); if(endOfInput && cr.isUnderflow()) cr = decoder.flush(decodeBuffer); if(cr.isOverflow()) { decoder.reset(); } if(cr.isUnderflow() && bb.hasRemaining()) { if(config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) { throw new MalformedInputException(strLen); } while (bb.hasRemaining()) bb.get(); } if(cr.isError()) { if((cr.isMalformed() && config.getActionOnMalFormedInput() == CodingErrorAction.REPORT) || (cr.isUnmappable() && config.getActionOnUnmappableCharacter() == CodingErrorAction.REPORT)) { cr.throwException(); } } decodeBuffer.flip(); sb.append(decodeBuffer); decodeBuffer.clear(); } cursor += readLen; consume(readLen); } return sb.toString(); } catch(CharacterCodingException e) { throw new MessageStringCodingException(e); } } else return EMPTY_STRING; }
Source:
public GHPoint intermediatePoint(double f, double lat1, double lon1, double lat2, double lon2) { double lat1radians = Math.toRadians(lat1); double lon1radians = Math.toRadians(lon1); double lat2radians = Math.toRadians(lat2); double lon2radians = Math.toRadians(lon2); double deltaLat = lat2radians - lat1radians; double deltaLon = lon2radians - lon1radians; double a = Math.sin(deltaLat/2) * Math.sin(deltaLat/2) + Math.cos(lat1radians) * Math.cos(lat2radians) * Math.sin(deltaLon/2) * Math.sin(deltaLon/2); double angularDistance = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); if (angularDistance == 0) return new GHPoint(lat1, lon1); double A = Math.sin((1-f)*angularDistance) / Math.sin(angularDistance); double B = Math.sin(f*angularDistance) / Math.sin(angularDistance); double x = A * Math.cos(lat1radians) * Math.cos(lon1radians) + B * Math.cos(lat2radians) * Math.cos(lon2radians); double y = A * Math.cos(lat1radians) * Math.sin(lon1radians) + B * Math.cos(lat2radians) * Math.sin(lon2radians); double z = A * Math.sin(lat1radians) + B * Math.sin(lat2radians); double midLat = Math.toDegrees(Math.atan2(z, Math.sqrt(x*x + y*y))); double midLon = Math.toDegrees(Math.atan2(y, x)); return new GHPoint(midLat, midLon); }

Target:
public GHPoint intermediatePoint(double f, double lat1, double lon1, double lat2, double lon2) { double lat1radians = Math.toRadians(lat1); double lon1radians = Math.toRadians(lon1); double lat2radians = Math.toRadians(lat2); double lon2radians = Math.toRadians(lon2); double deltaLat = lat2radians - lat1radians; double deltaLon = lon2radians - lon1radians; double cosLat1 = cos(lat1radians); double cosLat2 = cos(lat2radians); double sinHalfDeltaLat = sin(deltaLat / 2); double sinHalfDeltaLon = sin(deltaLon / 2); double a = sinHalfDeltaLat * sinHalfDeltaLat + cosLat1 * cosLat2 * sinHalfDeltaLon * sinHalfDeltaLon; double angularDistance = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); double sinDistance = sin(angularDistance); if (angularDistance == 0) return new GHPoint(lat1, lon1); double A = Math.sin((1-f)*angularDistance) / sinDistance; double B = Math.sin(f*angularDistance) / sinDistance; double x = A * cosLat1 * cos(lon1radians) + B * cosLat2 * cos(lon2radians); double y = A * cosLat1 * sin(lon1radians) + B * cosLat2 * sin(lon2radians); double z = A * sin(lat1radians) + B * sin(lat2radians); double midLat = Math.toDegrees(Math.atan2(z, Math.sqrt(x*x + y*y))); double midLon = Math.toDegrees(Math.atan2(y, x)); return new GHPoint(midLat, midLon); }
Source:
public boolean matches(ITmfEvent event) { boolean match = false; if (event.getTrace().getClass().equals(fTraceClass)) { if (fTraceClass == CustomTxtTrace.class || fTraceClass == CustomXmlTrace.class) { if (fTraceTypeId.endsWith(':' + event.getType().getName())) { match = true; } } else { match = true; } } if (match) { for (ITmfFilterTreeNode node : getChildren()) { if (! node.matches(event)) { return false; } } return true; } return false; }

Target:
public boolean matches(ITmfEvent event) { boolean match = false; ITmfTrace trace = event.getTrace(); if (trace.getClass().equals(fTraceClass)) { if (fTraceTypeId != null) { if (fTraceTypeId.equals(trace.getTraceTypeId())) { match = true; } } else { match = true; } } if (match) { for (ITmfFilterTreeNode node : getChildren()) { if (! node.matches(event)) { return false; } } return true; } return false; }