auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ClassLoader buildClassLoader() { String baseDirectoryPath = System.getProperty("user.dir"); File apiLibDirectory = libDirectory(new File(baseDirectoryPath, IsolationUtils.APPLICATION_MASTER_API_DIRECTORY)); LOG.info("Using API lib directory: {}", apiLibDirectory); File infrastructureLibDirectory = libDirectory(new File(baseDirectoryPath, IsolationUtils.APPLICATION_MASTER_INFRASTRUCTURE_DIRECTORY)); LOG.info("Using infrastructure lib directory: {}", infrastructureLibDirectory); File applicationLibDirectory = libDirectory(new File(baseDirectoryPath, IsolationUtils.APPLICATION_MASTER_APPLICATION_DIRECTORY)); LOG.info("Using application lib directory: {}", applicationLibDirectory); ClassLoader apiClassLoader = buildApiClassLoader(apiLibDirectory); ClassLoader applicationClassLoader = buildApplicationClassLoader(applicationLibDirectory, apiLibDirectory, apiClassLoader); return buildInfrastructureClassLoader(infrastructureLibDirectory, apiLibDirectory, apiClassLoader, applicationClassLoader); }

Target:
public ClassLoader buildClassLoader() { String baseDirectoryPath = System.getProperty("user.dir"); File apiLibDirectory = libDirectory(new File(baseDirectoryPath, DependencyIsolationUtils.FRAMEWORK_API_DIRECTORY)); LOG.info("Using API lib directory: {}", apiLibDirectory); File infrastructureLibDirectory = libDirectory(new File(baseDirectoryPath, DependencyIsolationUtils.FRAMEWORK_INFRASTRUCTURE_DIRECTORY)); LOG.info("Using infrastructure lib directory: {}", infrastructureLibDirectory); File applicationLibDirectory = libDirectory(new File(baseDirectoryPath, DependencyIsolationUtils.APPLICATION_DIRECTORY)); LOG.info("Using application lib directory: {}", applicationLibDirectory); ClassLoader apiClassLoader = buildApiClassLoader(apiLibDirectory); ClassLoader applicationClassLoader = buildApplicationClassLoader(applicationLibDirectory, apiLibDirectory, apiClassLoader); return buildInfrastructureClassLoader(infrastructureLibDirectory, apiLibDirectory, apiClassLoader, applicationClassLoader); }
Source:
public void onItemClick(AdapterView<?> adapterView, View view, int position, long listId) { SnapshotMetadata selected = (SnapshotMetadata) adapterView.getItemAtPosition(position); Intent intent = new Intent(Intent.ACTION_DEFAULT); intent.putExtra(SNAPSHOT_METADATA, ( selected).freeze()); if (mConflictId != null) { intent.putExtra(CONFLICT_ID, mConflictId); intent.putExtra(RETRY_COUNT, mRetryCount); } setResult(RESULT_OK, intent); finish(); }

Target:
public void onItemClick(AdapterView<?> adapterView, View view, int position, long listId) { SnapshotMetadata selected = (SnapshotMetadata) adapterView.getItemAtPosition(position); Intent intent = new Intent(Intent.ACTION_DEFAULT); intent.putExtra(SNAPSHOT_METADATA, selected.freeze()); if (mConflictId != null) { intent.putExtra(CONFLICT_ID, mConflictId); intent.putExtra(RETRY_COUNT, mRetryCount); } setResult(RESULT_OK, intent); finish(); }
Source:
private static Set<StagingEntry.Action> getAvailableActions(IStructuredSelection selection) { Set<StagingEntry.Action> availableActions = EnumSet.noneOf(StagingEntry.Action.class); for (Iterator it = selection.iterator(); it.hasNext(); ) { StagingEntry stagingEntry = (StagingEntry) it.next(); if (availableActions.isEmpty()) { availableActions.addAll(stagingEntry.getAvailableActions()); } else { availableActions.retainAll(stagingEntry.getAvailableActions()); } } return availableActions; }

Target:
private static Set<StagingEntry.Action> getAvailableActions(IStructuredSelection selection) { Set<StagingEntry.Action> availableActions = EnumSet.noneOf(StagingEntry.Action.class); for (Iterator it = selection.iterator(); it.hasNext(); ) { StagingEntry stagingEntry = (StagingEntry) it.next(); if (availableActions.isEmpty()) availableActions.addAll(stagingEntry.getAvailableActions()); else availableActions.retainAll(stagingEntry.getAvailableActions()); } return availableActions; }
Source:
public void setAvailability(AvailabilityMode availability) { if (partitionHandlingManager != null) { try { localTopologyManager.setCacheAvailability(getName(), availability); } catch (Exception e) { throw new CacheException(e); } } }

Target:
public void setAvailability(AvailabilityMode availability) { if (localTopologyManager != null) { try { localTopologyManager.setCacheAvailability(getName(), availability); } catch (Exception e) { throw new CacheException(e); } } }
Source:
public void testCheckOutEvictCheckOut() throws Exception { Service service = mock(Service.class); when(_factory.create(any(ServiceEndPoint.class))).thenReturn(service); MultiThreadedClientServiceCache<Service> cache = newCache(0); ServiceHandle<Service> handle = cache.checkOut(_endPoint); assertSame(handle.getService(), service); assertSame(1, cache.getNumActiveInstances(_endPoint)); assertSame(1, cache.getNumIdleInstances(_endPoint)); cache.evict(_endPoint); verify(_factory, timeout(100).times(1)).destroy(_endPoint, handle.getService()); assertSame(0, cache.getNumActiveInstances(_endPoint)); assertSame(0, cache.getNumIdleInstances(_endPoint)); handle = cache.checkOut(_endPoint); assertSame(handle.getService(), service); assertSame(1, cache.getNumActiveInstances(_endPoint)); assertSame(1, cache.getNumIdleInstances(_endPoint)); }

Target:
public void testCheckOutEvictCheckOut() throws Exception { Service service = mock(Service.class); when(_factory.create(any(ServiceEndPoint.class))).thenReturn(service); MultiThreadedClientServiceCache<Service> cache = newCache(0); ServiceHandle<Service> handle1 = cache.checkOut(_endPoint); assertSame(service, handle1.getService()); assertEquals(1, cache.getNumActiveInstances(_endPoint)); assertEquals(1, cache.getNumIdleInstances(_endPoint)); cache.evict(_endPoint); verify(_factory, timeout(100).times(1)).destroy(_endPoint, handle1.getService()); assertEquals(0, cache.getNumActiveInstances(_endPoint)); assertEquals(0, cache.getNumIdleInstances(_endPoint)); ServiceHandle<Service> handle2 = cache.checkOut(_endPoint); assertSame(service, handle2.getService()); assertEquals(1, cache.getNumActiveInstances(_endPoint)); assertEquals(1, cache.getNumIdleInstances(_endPoint)); assertNotSame(handle1, handle2); }
Source:
private Object createWriter(Context sinkContext) { @SuppressWarnings("rawtypes") Optional<EncodingFormat> encodingFormat = discoverOptionalEncodingFormat(BulkWriterFactory.class) .map(Optional::of).orElseGet(() -> discoverOptionalEncodingFormat(EncoderFactory.class)); if (encodingFormat.isPresent()) { return encodingFormat.get().createRuntimeEncoder(sinkContext, getFormatDataType()); } FileSystemFormatFactory formatFactory = createFormatFactory(); FileSystemFormatFactory.WriterContext context = new FileSystemFormatFactory.WriterContext() { @Override public TableSchema getSchema() { return schema; } @Override public ReadableConfig getFormatOptions() { return formatOptions(formatFactory.factoryIdentifier()); } @Override public List<String> getPartitionKeys() { return partitionKeys; } }; Optional<Encoder<RowData>> encoder = formatFactory.createEncoder(context); Optional<BulkWriter.Factory<RowData>> bulk = formatFactory.createBulkWriterFactory(context); if (encoder.isPresent()) { return encoder.get(); } else if (bulk.isPresent()) { return bulk.get(); } else { throw new TableException( formatFactory + " format should implement at least one Encoder or BulkWriter"); } }

Target:
private Object createWriter(Context sinkContext) { if (bulkWriterFormat != null) { return bulkWriterFormat.createRuntimeEncoder(sinkContext, getFormatDataType()); } else if (formatFactory != null) { return createWriterFromFormatFactory(); } else if (serializationFormat != null) { throw new UnsupportedOperationException("The serializationFormat is under developing."); } else { throw new TableException("Can not find format factory."); } }
Source:
private int toIntWithCheck(long size) { if (size > Integer.MAX_VALUE) { throw new ParquetEncodingException( "Cannot write page larger than " + Integer.MAX_VALUE + " bytes: " + size); } return (int)size; }

Target:
private int toIntWithCheck(long size) { if ((int)size != size) { throw new ParquetEncodingException("Cannot write page larger than " + Integer.MAX_VALUE + " bytes: " + size); } return (int)size; }
Source:
public void testOne() throws Exception { RestClientBuilderImpl builder = new RestClientBuilderImpl(); MPCollectionServiceIntf mpc = builder.baseUri(URI.create(generateURL(""))) .build(MPCollectionServiceIntf.class); List<String> l = mpc.getList(); Assert.assertEquals(3, l.size()); }

Target:
public void testOne() throws Exception { RestClientBuilder builder = RestClientBuilder.newBuilder(); MPCollectionServiceIntf mpc = builder.baseUri(URI.create(generateURL(""))) .build(MPCollectionServiceIntf.class); List<String> l = mpc.getList(); Assert.assertEquals(3, l.size()); }
Source:
private void processEvents() { while ( state.get() == State.STARTED ) { try { int lastNegotiatedSessionTimeoutMs = client.getZookeeperClient().getLastNegotiatedSessionTimeoutMs(); int useSessionTimeoutMs = (lastNegotiatedSessionTimeoutMs > 0) ? lastNegotiatedSessionTimeoutMs : sessionTimeoutMs; useSessionTimeoutMs = sessionExpirationPercent > 0 && startOfSuspendedEpoch != 0 ? (useSessionTimeoutMs * sessionExpirationPercent) / 100 : useSessionTimeoutMs; long elapsedMs = startOfSuspendedEpoch == 0 ? useSessionTimeoutMs / 2 : System.currentTimeMillis() - startOfSuspendedEpoch; long pollMaxMs = useSessionTimeoutMs - elapsedMs; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( sessionExpirationPercent > 0 ) { synchronized(this) { checkSessionExpiration(); } } } catch ( InterruptedException e ) { } } }

Target:
private void processEvents() { while ( state.get() == State.STARTED ) { try { int useSessionTimeoutMs = getUseSessionTimeoutMs(); long elapsedMs = startOfSuspendedEpoch == 0 ? useSessionTimeoutMs / 2 : System.currentTimeMillis() - startOfSuspendedEpoch; long pollMaxMs = useSessionTimeoutMs - elapsedMs; final ConnectionState newState = eventQueue.poll(pollMaxMs, TimeUnit.MILLISECONDS); if ( newState != null ) { if ( listeners.size() == 0 ) { log.warn("There are no ConnectionStateListeners registered."); } listeners.forEach ( new Function<ConnectionStateListener, Void>() { @Override public Void apply(ConnectionStateListener listener) { listener.stateChanged(client, newState); return null; } } ); } else if ( sessionExpirationPercent > 0 ) { synchronized(this) { checkSessionExpiration(); } } } catch ( InterruptedException e ) { } } }
Source:
public FormValidation doCheckWebHookName(@QueryParameter final String value) { if (StringUtils.isBlank(value)) { return FormValidation.warning("Please provide a value"); } return FormValidation.ok(); }

Target:
public FormValidation doCheckWebHookName(@QueryParameter final String value) { if (StringUtils.isBlank(value)) { return FormValidation.error("Please provide a value"); } String pattern = "^[A-Za-z0-9_-]+$"; if (!value.matches(pattern)) { return FormValidation.error("Only allowed characters are alphaphetic, numeric, hypen and underscore"); } return FormValidation.ok(); }
Source:
public String displayConnectionAccepted(int playerId) { return "Player " + playerId + " has been added to the game."; }

Target:
public String displayConnectionAccepted(int playerId) { return null;}
Source:
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { String destString = dest.toString(); if (source.equals("") || destString.equals("")) { return null; } String part1 = destString.substring(0, dstart); String part2 = destString.substring(dend); String newString = part1 + (String)source + part2; try { Integer x = Integer.parseInt((String)newString); return null; } catch (NumberFormatException e) { return ""; } }

Target:
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { String destString = dest.toString(); if (source.equals("") || destString.equals("")) { return null; } String part1 = destString.substring(0, dstart); String part2 = destString.substring(dend); String newString = part1 + (String)source.subSequence(start, end) + part2; try { Integer x = Integer.parseInt((String)newString); return null; } catch (NumberFormatException e) { return ""; } }
Source:
public static void main(String[] args) throws Exception { Preconditions.checkArgument(args.length == 5, "Illegal number of arguments. Expected: 5, Actual: " + args.length); String stormId = args[0]; String assignmentId = args[1]; String supervisorPort = args[2]; String portStr = args[3]; String workerId = args[4]; Map<String, Object> conf = ConfigUtils.readStormConfig(); Utils.setupDefaultUncaughtExceptionHandler(); StormCommon.validateDistributedMode(conf); Worker worker = new Worker(conf, null, stormId, assignmentId, Integer.parseInt(supervisorPort), Integer.parseInt(portStr), workerId); worker.start(); LOG.info("Adding shutdown hook with kill in secs", ObjectReader.getInt(conf.get(Config.SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS))); Utils.addShutdownHookWithDelayedForceKill(worker::shutdown, ObjectReader.getInt(conf.get(Config.SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS))); }

Target:
public static void main(String[] args) throws Exception { Preconditions.checkArgument(args.length == 5, "Illegal number of arguments. Expected: 5, Actual: " + args.length); String stormId = args[0]; String assignmentId = args[1]; String supervisorPort = args[2]; String portStr = args[3]; String workerId = args[4]; Map<String, Object> conf = ConfigUtils.readStormConfig(); Utils.setupDefaultUncaughtExceptionHandler(); StormCommon.validateDistributedMode(conf); Worker worker = new Worker(conf, null, stormId, assignmentId, Integer.parseInt(supervisorPort), Integer.parseInt(portStr), workerId); worker.start(); int workerShutdownSleepSecs = ObjectReader.getInt(conf.get(Config.SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS)); LOG.info("Adding shutdown hook with kill in secs", workerShutdownSleepSecs); Utils.addShutdownHookWithDelayedForceKill(worker::shutdown, workerShutdownSleepSecs); }
Source:
public String handleMdsException(final MdsException exception) throws IOException { LOGGER.error("Error: " + exception.getMessage(), exception); if (exception instanceof ObjectCreateException || exception instanceof ObjectUpdateException) { return exception.getMessage(); } if (exception.getMessageKey() == null) { return "error"; } else if (exception.getParams() == null) { return String.format("key:%s", exception.getMessageKey()); } else { return String.format("key:%s\nparams:%s", exception.getMessageKey(), exception.getParams()); } }

Target:
public String handleMdsException(final MdsException exception) throws IOException { LOGGER.error("Error: " + exception.getMessage(), exception); if (exception.getMessageKey() == null) { return "error"; } else if (exception.getParams() == null) { return String.format("key:%s", exception.getMessageKey()); } else { return String.format("key:%s\nparams:%s", exception.getMessageKey(), exception.getParams()); } }
Source:
public void search_for_members() { String orgKey = createOrganization(); String user1 = createUser(); String user2 = createUser("sameprefixuser"); createUser("sameprefixuser"); adminClient.organizations().addMember(orgKey, user1); adminClient.organizations().addMember(orgKey, user2); MembersPage page = nav.openOrganizationMembers(orgKey); page .searchForMember("sameprefixuser") .shouldHaveTotal(1); page.getMembersByIdx(0).shouldBeNamed(user2, user2); page .searchForMember(user1) .shouldHaveTotal(1); page.getMembersByIdx(0).shouldBeNamed(user1, user1); }

Target:
public void search_for_members() { String orgKey = createOrganization(); String user1 = createUser(); adminClient.organizations().addMember(orgKey, user1); String user2 = createUser("sameprefixuser"); adminClient.organizations().addMember(orgKey, user2); createUser("sameprefixuser"); MembersPage page = nav.openOrganizationMembers(orgKey); page .searchForMember("sameprefixuser") .shouldHaveTotal(1); page.getMembersByIdx(0).shouldBeNamed(user2, user2); page .searchForMember(user1) .shouldHaveTotal(1); page.getMembersByIdx(0).shouldBeNamed(user1, user1); }
Source:
public void rename(boolean save) { renamePopUpPresenter.show(versionRecordManager.getPathToLatest(), fileNameValidator, details -> { view.showBusyIndicator(org.kie.workbench.common.widgets.client.resources.i18n.CommonConstants.INSTANCE.Renaming()); editorService.call(getRenameSuccessCallback(renamePopUpPresenter.getView()), getRenameErrorCallback(renamePopUpPresenter.getView())).rename(versionRecordManager.getPathToLatest(), details.getNewFileName(), details.getCommitMessage(), save, editorHelper.getContent(), metadata); }); }

Target:
public void rename(boolean save) { if(save) { synchronizeFormLayout(); } renamePopUpPresenter.show(versionRecordManager.getPathToLatest(), fileNameValidator, getRenameCommand(save)); }
Source:
public static FWTile loadTile(String blockID) { try { Block block = createBlock(blockID); FWTile tile = (block instanceof Updater) ? updaterInjector.inject(block, new Class[] { String.class }, new Object[] { blockID }) : injector.inject(block, new Class[] { String.class }, new Object[] { blockID }); tile.setBlock(block); WrapperEvent.FWTileCreate event = new WrapperEvent.FWTileCreate(block, tile); Game.events().publish(event); return tile; } catch (Exception e) { throw new RuntimeException("Fatal error when trying to create a new NOVA tile.", e); } }

Target:
public static FWTile loadTile(String blockID) { try { Block block = createBlock(blockID); ComponentInjector<? extends FWTile> inject = (block instanceof Updater) ? updaterInjector : injector; FWTile tile = inject.inject(block, new Class<?>[] { String.class }, new Object[] { blockID }); tile.setBlock(block); WrapperEvent.FWTileCreate event = new WrapperEvent.FWTileCreate(block, tile); Game.events().publish(event); return tile; } catch (Exception e) { throw new RuntimeException("Fatal error when trying to create a new NOVA tile.", e); } }
Source:
private void validateParentOrThrow(Library library) { if (!isDetailedLibrary(library)) return; if (!isAliquotSample(library.getSample())) { String sc = null; if (isDetailedSample(library.getSample())) { DetailedSample sample = (DetailedSample) library.getSample(); sc = sample.getSampleClass() == null ? "not set" : sample.getSampleClass().getAlias(); } else { sc = "Plain Sample"; } throw new IllegalArgumentException(String.format("Sample Class '%s' is not valid for Library parent. Must be an aliquot", sc)); } }

Target:
private void validateParentOrThrow(Library library) { if (!isDetailedLibrary(library)) return; if (!isAliquotSample(library.getSample())) { String sc = null; if (isDetailedSample(library.getSample())) { DetailedSample sample = (DetailedSample) library.getSample(); sc = sample.getSampleClass() == null ? "not set" : sample.getSampleClass().getAlias(); } else { sc = "Plain Sample"; } throw new IllegalArgumentException(String.format("Sample Class '%s' is not a valid parent for Libraries. Must be an aliquot", sc)); } }
Source:
public void addRoleInUserManager(Role role) { String setName = role.getName(); if (userManager.getPermissionSetList().contains(setName)) { Collection<Permission> oldPermissions = userManager.getAllPermissionsFromPermissionSet(setName); userManager.removePermissionFromSet(setName, oldPermissions.toArray(new Permission[oldPermissions.size()])); userManager.removePermissionSetFromPermissionSet(setName, role.getRoles().toArray(new String[role.getRoles().size()])); } else { try { LOGGER.debug("Create permissionset: " + setName); userManager.createPermissionSet(setName); } catch (PermissionSetAlreadyExistsException e) { LOGGER.error("This is Impossible."); } catch (Exception e) { LOGGER.error("Entry exists exception. This seems impossible. Message: " + e.getMessage()); } } Collection<Permission> permissionList = Sets.newHashSet(); for (String permission : role.getPermissions()) { permissionList.add(new WicketPermission(permission)); } userManager.addPermissionToSet(setName, permissionList.toArray(new Permission[permissionList.size()])); userManager.addPermissionSetToPermissionSet(setName, role.getRoles().toArray(new String[role.getRoles().size()])); }

Target:
public void addRoleInUserManager(Role role) { String setName = role.getName(); if (userManager.getPermissionSetList().contains(setName)) { Collection<Permission> oldPermissions = userManager.getAllPermissionsFromPermissionSet(setName); userManager.removePermissionFromSet(setName, oldPermissions.toArray(new Permission[oldPermissions.size()])); userManager.removePermissionSetFromPermissionSet(setName, role.getRoles().toArray(new String[role.getRoles().size()])); } else { try { LOGGER.debug("Create permissionset: " + setName); userManager.createPermissionSet(setName); } catch (PermissionSetAlreadyExistsException e) { LOGGER.error("This is Impossible."); } catch (Exception e) { LOGGER.error("Entry exists exception. This seems impossible.", e); } } Collection<Permission> permissionList = Sets.newHashSet(); for (String permission : role.getPermissions()) { permissionList.add(new WicketPermission(permission)); } userManager.addPermissionToSet(setName, permissionList.toArray(new Permission[permissionList.size()])); userManager.addPermissionSetToPermissionSet(setName, role.getRoles().toArray(new String[role.getRoles().size()])); }
Source:
public Collection<Guid> getRoleIds() { if (roleIds == null) { roleIds = Collections.emptyList(); } return new ArrayList<Guid>(roleIds); }

Target:
public Collection<Guid> getRoleIds() { if (roleIds == null) { roleIds = Collections.emptyList(); } return new HashSet<Guid>(roleIds); }
Source:
public U getFinalResult() { PollingContext<T> currentTerminalPollContext = this.terminalPollContext; if (currentTerminalPollContext != null) { return this.fetchResultOperation .apply(currentTerminalPollContext) .block(); } else { PollingContext<T> context = this.pollingContext.clone(); AsyncPollResponse<T, U> finalAsyncPollResponse = pollingLoop(context) .blockLast(); this.terminalPollContext = context; return finalAsyncPollResponse.getFinalResult().block(); } }

Target:
public U getFinalResult() { PollingContext<T> currentTerminalPollContext = this.terminalPollContext; if (currentTerminalPollContext != null) { return this.fetchResultOperation .apply(currentTerminalPollContext) .block(); } else { PollingContext<T> context = this.pollingContext.copy(); AsyncPollResponse<T, U> finalAsyncPollResponse = pollingLoop(context) .blockLast(); this.terminalPollContext = context; return finalAsyncPollResponse.getFinalResult().block(); } }
Source:
public boolean isAutoConfExplorerBanned(String address) { return getDevFilter() != null && getDevFilter().getBannedAutoConfExplorers().stream() .anyMatch(e -> e.equals(address)); }

Target:
public boolean isAutoConfExplorerBanned(String address) { return getFilter() != null && getFilter().getBannedAutoConfExplorers().stream() .anyMatch(e -> e.equals(address)); }
Source:
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory) { if (newCapacity < 0 || newCapacity > buf.maxCapacity()) { throw new IllegalArgumentException("newCapacity: " + newCapacity); } int oldCapacity = buf.length; if (oldCapacity == newCapacity) { return; } PoolChunk<T> oldChunk = buf.chunk; ByteBuffer olNioBuffer = buf.tmpNioBuf; long oldHandle = buf.handle; T oldMemory = buf.memory; int oldOffset = buf.offset; int oldMaxLength = buf.maxLength; int readerIndex = buf.readerIndex(); int writerIndex = buf.writerIndex(); allocate(parent.threadCache(), buf, newCapacity); if (newCapacity > oldCapacity) { memoryCopy( oldMemory, oldOffset, buf.memory, buf.offset, oldCapacity); } else if (newCapacity < oldCapacity) { if (readerIndex < newCapacity) { if (writerIndex > newCapacity) { writerIndex = newCapacity; } memoryCopy( oldMemory, oldOffset + readerIndex, buf.memory, buf.offset + readerIndex, writerIndex - readerIndex); } else { readerIndex = writerIndex = newCapacity; } } buf.setIndex(readerIndex, writerIndex); if (freeOldMemory) { free(oldChunk, olNioBuffer, oldHandle, oldMaxLength, buf.cache); } }

Target:
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory) { if (newCapacity < 0 || newCapacity > buf.maxCapacity()) { throw new IllegalArgumentException("newCapacity: " + newCapacity); } int oldCapacity = buf.length; if (oldCapacity == newCapacity) { return; } PoolChunk<T> oldChunk = buf.chunk; ByteBuffer oldNioBuffer = buf.tmpNioBuf; long oldHandle = buf.handle; T oldMemory = buf.memory; int oldOffset = buf.offset; int oldMaxLength = buf.maxLength; int readerIndex = buf.readerIndex(); int writerIndex = buf.writerIndex(); allocate(parent.threadCache(), buf, newCapacity); if (newCapacity > oldCapacity) { memoryCopy( oldMemory, oldOffset, buf.memory, buf.offset, oldCapacity); } else if (newCapacity < oldCapacity) { if (readerIndex < newCapacity) { if (writerIndex > newCapacity) { writerIndex = newCapacity; } memoryCopy( oldMemory, oldOffset + readerIndex, buf.memory, buf.offset + readerIndex, writerIndex - readerIndex); } else { readerIndex = writerIndex = newCapacity; } } buf.setIndex(readerIndex, writerIndex); if (freeOldMemory) { free(oldChunk, oldNioBuffer, oldHandle, oldMaxLength, buf.cache); } }
Source:
default boolean validateRequest(RequestMsg req, ChannelHandlerContext ctx) { HeaderMsg requestHeader = req.getHeader(); if (!requestHeader.getIgnoreEpoch() && !epochIsValid(requestHeader)) { sendWrongEpochError(requestHeader, ctx); return false; } if (!requestHeader.getIgnoreClusterId()) { return getCurrentLayout() .map(layout -> { final UuidMsg currentClusterID = getUuidMsg(layout.getClusterId()); if (!clusterIdIsValid(requestHeader, currentClusterID)) { sendWrongClusterError(requestHeader, ctx, currentClusterID); return false; } return true; }).orElseGet(() -> { sendNoBootstrapError(requestHeader, ctx); return false; }); } return true; }

Target:
default boolean validateRequest(RequestMsg req, ChannelHandlerContext ctx) { HeaderMsg requestHeader = req.getHeader(); if (!requestHeader.getIgnoreEpoch() && !epochIsValid(requestHeader)) { sendWrongEpochError(requestHeader, ctx); return false; } if (requestHeader.getIgnoreClusterId()) { return true; } return getCurrentLayout() .map(layout -> { final UuidMsg currentClusterID = getUuidMsg(layout.getClusterId()); if (!clusterIdIsValid(requestHeader, currentClusterID)) { sendWrongClusterError(requestHeader, ctx, currentClusterID); return false; } return true; }).orElseGet(() -> { sendNoBootstrapError(requestHeader, ctx); return false; }); }
Source:
public boolean uploadInputfiles(TaskFlowJob job, String localInputFolderPath) throws NotConnectedException, PermissionException { try { List<String> userSpaces = getUserSpaceURIs(); List<String> inputSpaces = Arrays.asList(Tools.dataSpaceConfigPropertyToUrls(job.getInputSpace())); String remotePath = extractRemotePath(userSpaces, inputSpaces); if (remotePath == null) { throw new IllegalArgumentException("Could not extract remote path using inputSpace=" + inputSpaces + " and userSpace=" + userSpaces); } String jname = job.getName(); logger.debug("Pushing files for job " + jname + " from " + localInputFolderPath + " to " + remotePath); TaskFlowJob tfj = job; for (Task t : tfj.getTasks()) { logger.debug("Pushing files for task " + t.getName()); List<String> includes = Lists.newArrayList(); List<String> excludes = Lists.newArrayList(); List<InputSelector> inputFilesList = t.getInputFilesList(); if (inputFilesList != null) { for (InputSelector is : inputFilesList) { addfileSelection(is.getInputFiles(), includes, excludes); } } LocalDirSource source = new LocalDirSource(localInputFolderPath); source.setIncludes(includes); source.setExcludes(excludes); RemoteDestination dest = new RemoteDestination(USER, remotePath); restDataSpaceClient.upload(source, dest); } logger.debug("Finished push operation from " + localInputFolderPath + " to " + remotePath); } catch (Throwable error) { throw Throwables.propagate(error); } return true; }

Target:
public boolean uploadInputfiles(TaskFlowJob job, String localInputFolderPath) throws NotConnectedException, PermissionException { try { List<String> userSpaces = getUserSpaceURIs(); List<String> inputSpaces = Arrays.asList(Tools.dataSpaceConfigPropertyToUrls(job.getInputSpace())); String remotePath = extractRelativePath(userSpaces, inputSpaces); if (remotePath == null) { throw new IllegalArgumentException("Could not extract remote path using inputSpace=" + inputSpaces + " and userSpace=" + userSpaces); } String jname = job.getName(); logger.debug("Pushing files for job " + jname + " from " + localInputFolderPath + " to " + remotePath); TaskFlowJob tfj = job; for (Task task : tfj.getTasks()) { uploadInputFilesForTask(localInputFolderPath, remotePath, task); } logger.debug("Finished push operation from " + localInputFolderPath + " to " + remotePath); } catch (Exception error) { throw Throwables.propagate(error); } return true; }
Source:
public synchronized void connect() throws IOException { try { IDeploymentConfig dc = OpenShiftServerUtils.getDeploymentConfig(server); DebuggingContext debugContext = OpenShiftDebugUtils.get().getDebuggingContext(dc); HashMap<String, Object> env = new HashMap<>(); env.put(JMXConnector.CREDENTIALS, new String[] { debugContext.getAdminUsername(), debugContext.getAdminPassword() }); IPod firstPod = OpenShiftDebugUtils.get().getFirstPod(dc); if (firstPod != null) { int port = getLocalAdminPort(firstPod); String url = "service:jmx:remoting-jmx://localhost:" + port; connector = factory.newJMXConnector(new JMXServiceURL(url), env); connector.connect(); connection = connector.getMBeanServerConnection(); isConnected = true; provider.fireChanged(this); } } catch (CoreException e) { throw new IOException(e); } }

Target:
public synchronized void connect() throws IOException { try { IDeploymentConfig dc = OpenShiftServerUtils.getDeploymentConfig(server); if (dc != null) { DebuggingContext debugContext = OpenShiftDebugUtils.get().getDebuggingContext(dc); HashMap<String, Object> env = new HashMap<>(); env.put(JMXConnector.CREDENTIALS, new String[] { debugContext.getAdminUsername(), debugContext.getAdminPassword() }); IPod firstPod = OpenShiftDebugUtils.get().getFirstPod(dc); if (firstPod != null) { int port = getLocalAdminPort(firstPod); String url = "service:jmx:remoting-jmx://localhost:" + port; connector = factory.newJMXConnector(new JMXServiceURL(url), env); connector.connect(); connection = connector.getMBeanServerConnection(); isConnected = true; provider.fireChanged(this); } } } catch (CoreException e) { throw new IOException(e); } }
Source:
public void setLastQuestion(boolean isLast) { if (SHORT_APPEARANCE.equalsIgnoreCase(mPrompt.getAppearanceHint()) || isInCompactMode()) { if (isLast) { mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_DONE); } else { mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_NEXT); } } }

Target:
public void setLastQuestion(boolean isLast) { if (shouldSupportIMEAction()) { if (isLast) { mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_DONE); } else { mAnswer.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_NEXT); } } }
Source:
void addMismatchReadFeatures(final int alignmentStart, final List<ReadFeature> features, final int fromPosInRead, final int alignmentStartOffset, final int nofReadBases, final byte[] bases, final byte[] qualityScore) { int oneBasedPositionInRead = fromPosInRead + 1; int refIndex = alignmentStart + alignmentStartOffset - 1; byte refBase; for (int i = 0; i < nofReadBases; i++, oneBasedPositionInRead++, refIndex++) { if (refIndex >= refBases.length) refBase = 'N'; else refBase = refBases[refIndex]; refBase = SequenceUtil.upperCase(refBase); final byte readBase = SequenceUtil.upperCase(bases[i + fromPosInRead]); if (readBase != refBase) { final boolean isSubstitution = SequenceUtil.isACGTN(readBase) && SequenceUtil.isACGTN(refBase); if (isSubstitution) { features.add(new Substitution(oneBasedPositionInRead, readBase, refBase)); } else { final byte score = qualityScore[i + fromPosInRead]; features.add(new ReadBase(oneBasedPositionInRead, readBase, score)); } } } }

Target:
void addMismatchReadFeatures(final int alignmentStart, final List<ReadFeature> features, final int fromPosInRead, final int alignmentStartOffset, final int nofReadBases, final byte[] bases, final byte[] qualityScore) { int oneBasedPositionInRead = fromPosInRead + 1; int refIndex = alignmentStart + alignmentStartOffset - 1; byte refBase; for (int i = 0; i < nofReadBases; i++, oneBasedPositionInRead++, refIndex++) { if (refIndex >= refBases.length) refBase = 'N'; else refBase = refBases[refIndex]; final byte readBase = bases[i + fromPosInRead]; if (readBase != refBase) { final boolean isSubstitution = SequenceUtil.isUpperACGTN(readBase) && SequenceUtil.isUpperACGTN(refBase); if (isSubstitution) { features.add(new Substitution(oneBasedPositionInRead, readBase, refBase)); } else { final byte score = qualityScore[i + fromPosInRead]; features.add(new ReadBase(oneBasedPositionInRead, readBase, score)); } } } }
Source:
private boolean isValidVersion(Tag tag) { SortedSet<VersionValidation> versionValidations = tag.getValidations(); boolean validDockerfile = isVersionTypeValidated(versionValidations, SourceFile.FileType.DOCKERFILE); boolean validCwl = isVersionTypeValidated(versionValidations, SourceFile.FileType.DOCKSTORE_CWL); boolean validWdl = isVersionTypeValidated(versionValidations, SourceFile.FileType.DOCKSTORE_WDL); boolean validCwlTestParameters = isVersionTypeValidated(versionValidations, SourceFile.FileType.CWL_TEST_JSON); boolean validWdlTestParameters = isVersionTypeValidated(versionValidations, SourceFile.FileType.WDL_TEST_JSON); boolean hasCwl = tag.getSourceFiles().stream().anyMatch(file -> file.getType() == SourceFile.FileType.DOCKSTORE_CWL); boolean hasWdl = tag.getSourceFiles().stream().anyMatch(file -> file.getType() == SourceFile.FileType.DOCKSTORE_WDL); return validDockerfile && ((hasCwl && validCwl && validCwlTestParameters) || (hasWdl && validWdl && validWdlTestParameters)); }

Target:
private boolean isValidVersion(Tag tag) { SortedSet<Validation> versionValidations = tag.getValidations(); boolean validDockerfile = isVersionTypeValidated(versionValidations, SourceFile.FileType.DOCKERFILE); boolean validCwl = isVersionTypeValidated(versionValidations, SourceFile.FileType.DOCKSTORE_CWL); boolean validWdl = isVersionTypeValidated(versionValidations, SourceFile.FileType.DOCKSTORE_WDL); boolean validCwlTestParameters = isVersionTypeValidated(versionValidations, SourceFile.FileType.CWL_TEST_JSON); boolean validWdlTestParameters = isVersionTypeValidated(versionValidations, SourceFile.FileType.WDL_TEST_JSON); boolean hasCwl = tag.getSourceFiles().stream().anyMatch(file -> file.getType() == SourceFile.FileType.DOCKSTORE_CWL); boolean hasWdl = tag.getSourceFiles().stream().anyMatch(file -> file.getType() == SourceFile.FileType.DOCKSTORE_WDL); return validDockerfile && ((hasCwl && validCwl && validCwlTestParameters) || (hasWdl && validWdl && validWdlTestParameters)); }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); WikipediaApp.getInstance().checkCrashes(this); ActivityUtil.requestFullUserOrientation(this); setTheme(WikipediaApp.getInstance().getCurrentTheme().getResourceId()); removeSplashBackground(); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } forceOverflowMenuIcon(this); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityUtil.requestFullUserOrientation(this); setTheme(WikipediaApp.getInstance().getCurrentTheme().getResourceId()); removeSplashBackground(); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } forceOverflowMenuIcon(this); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryTreeNode selectedNode = getSelectedNodes(event).get(0); final String configName; if (selectedNode instanceof RemoteNode) { configName = ((RemoteNode) selectedNode).getObject(); } else if (selectedNode instanceof FetchNode) { configName = ((RemoteNode) selectedNode.getParent()).getObject(); } else { return null; } WizardDialog dlg = new WizardDialog( getView(event).getSite().getShell(), new ConfigureRemoteWizard( selectedNode.getRepository(), configName, false)); dlg.open(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositoryTreeNode selectedNode = getSelectedNodes(event).get(0); final String configName; if (selectedNode instanceof RemoteNode) configName = ((RemoteNode) selectedNode).getObject(); else if (selectedNode instanceof FetchNode) configName = ((RemoteNode) selectedNode.getParent()).getObject(); else return null; WizardDialog dlg = new WizardDialog( getView(event).getSite().getShell(), new ConfigureRemoteWizard( selectedNode.getRepository(), configName, false)); dlg.open(); return null; }
Source:
public static Intent createExternalIntent(Context context, Uri uri) { CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() .setToolbarColor(context.getResources().getColor(R.color.theme_primary)) .setShowTitle(true) .build(); Intent intent = customTabsIntent.intent; intent.setData(uri); intent.putExtra(ShareCompat.EXTRA_CALLING_PACKAGE, context.getPackageName()); if (context instanceof Activity) { intent.putExtra(ShareCompat.EXTRA_CALLING_ACTIVITY, ((Activity) context).getComponentName()); } intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); return intent; }

Target:
public static Intent createExternalIntent(Context context, Uri uri) { CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder() .setToolbarColor(context.getResources().getColor(R.color.theme_primary)) .setShowTitle(true) .build(); Intent intent = customTabsIntent.intent; intent.setData(uri); return intent; }
Source:
public AttributeSet(String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions) { this.name = name; this.attributes = new LinkedHashMap<>(attributeDefinitions.length + attributeSet.attributes.size()); for (Attribute<? extends Object> attribute : attributeSet.attributes.values()) { this.attributes.put(attribute.name(), attribute.getAttributeDefinition().toAttribute()); } for (AttributeDefinition<?> def : attributeDefinitions) { Attribute<Object> attribute = (Attribute<Object>) def.toAttribute(); if (!attribute.isImmutable()) attribute.addListener(this); this.attributes.put(def.name(), attribute); } }

Target:
public AttributeSet(String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions) { this.name = name; this.attributes = new HashMap<>(attributeDefinitions.length + attributeSet.attributes.size()); for (Attribute<? extends Object> attribute : attributeSet.attributes.values()) { this.attributes.put(attribute.name(), attribute.getAttributeDefinition().toAttribute()); } for (AttributeDefinition<?> def : attributeDefinitions) { Attribute<Object> attribute = (Attribute<Object>) def.toAttribute(); if (!attribute.isImmutable()) attribute.addListener(this); this.attributes.put(def.name(), attribute); } }
Source:
private void start() throws IOException { long now = 0; reportManager.init(); initCommandHandlerThread(conf); jvmPauseMonitor = new JvmPauseMonitor(); jvmPauseMonitor.init(conf); jvmPauseMonitor.start(); while (context.getState() != DatanodeStates.SHUTDOWN) { try { LOG.debug("Executing cycle Number : {}", context.getExecutionCount()); long heartbeatFrequency = context.getHeartbeatFrequency(); nextHB.set(Time.monotonicNow() + heartbeatFrequency); context.execute(executorService, heartbeatFrequency, TimeUnit.MILLISECONDS); now = Time.monotonicNow(); if (now < nextHB.get()) { if(!Thread.interrupted()) { Thread.sleep(nextHB.get() - now); } } } catch (InterruptedException e) { } catch (Exception e) { LOG.error("Unable to finish the execution.", e); } } if (context.getShutdownStateMachine()) { LOG.error("DatanodeStateMachine Shutdown due to an critical error"); hddsDatanodeService.terminateDatanode(); } }

Target:
private void start() throws IOException { long now = 0; reportManager.init(); initCommandHandlerThread(conf); jvmPauseMonitor = new JvmPauseMonitor(); jvmPauseMonitor.init(conf); jvmPauseMonitor.start(); while (context.getState() != DatanodeStates.SHUTDOWN) { try { LOG.debug("Executing cycle Number : {}", context.getExecutionCount()); long heartbeatFrequency = context.getHeartbeatFrequency(); nextHB.set(Time.monotonicNow() + heartbeatFrequency); context.execute(executorService, heartbeatFrequency, TimeUnit.MILLISECONDS); now = Time.monotonicNow(); if (now < nextHB.get()) { if(!Thread.interrupted()) { Thread.sleep(nextHB.get() - now); } } } catch (InterruptedException e) { } catch (Exception e) { LOG.error("Unable to finish the execution.", e); } } if (context.getShutdownOnError()) { LOG.error("DatanodeStateMachine Shutdown due to an critical error"); hddsDatanodeStopService.stopService(); } }
Source:
public boolean assign(final Map<UUID, ClientState> clients, final Set<TaskId> allTaskIds, final Set<TaskId> statefulTaskIds, final AssignmentConfigs configs) { final SortedSet<TaskId> statefulTasks = new TreeSet<>(statefulTaskIds); final TreeMap<UUID, ClientState> clientStates = new TreeMap<>(clients); final SortedMap<TaskId, SortedSet<RankedClient>> statefulTasksToRankedCandidates = buildClientRankingsByTask(statefulTasks, clients, configs.acceptableRecoveryLag); final Map<TaskId, SortedSet<UUID>> tasksToCaughtUpClients = tasksToCaughtUpClients(statefulTasksToRankedCandidates); final Map<TaskId, Integer> tasksToRemainingStandbys = statefulTasks.stream().collect(Collectors.toMap(task -> task, t -> configs.numStandbyReplicas)); assignActiveStatefulTasks(clientStates, statefulTasks); assignStandbyReplicaTasks( tasksToRemainingStandbys, clientStates, statefulTasksToRankedCandidates, configs.numStandbyReplicas ); final boolean probingRebalanceNeeded = assignTaskMovements( tasksToCaughtUpClients, clientStates, configs.maxWarmupReplicas ); assignStatelessActiveTasks(clientStates, diff(TreeSet::new, allTaskIds, statefulTasks)); log.info("Decided on assignment: " + clientStates + " with " + (probingRebalanceNeeded ? "" : "no") + " followup probing rebalance."); return probingRebalanceNeeded; }

Target:
public boolean assign(final Map<UUID, ClientState> clients, final Set<TaskId> allTaskIds, final Set<TaskId> statefulTaskIds, final AssignmentConfigs configs) { final SortedSet<TaskId> statefulTasks = new TreeSet<>(statefulTaskIds); final TreeMap<UUID, ClientState> clientStates = new TreeMap<>(clients); assignActiveStatefulTasks(clientStates, statefulTasks); assignStandbyReplicaTasks( clientStates, statefulTasks, configs.numStandbyReplicas ); final boolean probingRebalanceNeeded = assignTaskMovements( tasksToCaughtUpClients(statefulTasks, clientStates, configs.acceptableRecoveryLag), clientStates, configs.maxWarmupReplicas ); assignStatelessActiveTasks(clientStates, diff(TreeSet::new, allTaskIds, statefulTasks)); log.info("Decided on assignment: " + clientStates + " with " + (probingRebalanceNeeded ? "" : "no") + " followup probing rebalance."); return probingRebalanceNeeded; }
Source:
public void close() { lastUsed.set(System.currentTimeMillis()); useCnt.decrementAndGet(); if (RepositoryCache.isCached(this)) { evict(0); } }

Target:
public void close() { lastUsed.set(System.currentTimeMillis()); useCnt.decrementAndGet(); if (!RepositoryCache.isCached(this)) { evict(0); } }
Source:
public void updated(Provider<Rule> provider, Rule oldElement, Rule element) { String uid = element.getUID(); if (oldElement != null && uid.equals(oldElement.getUID())) { try { Rule resolvedRule = resolveRuleByTemplate(element); super.updated(provider, oldElement, resolvedRule); postRuleUpdatedEvent(resolvedRule, oldElement); if (resolvedRule.getTemplateUID() == null) { RuleStatusInfo statusInfo = disabledRulesStorage != null && disabledRulesStorage.get(uid) == null ? new RuleStatusInfo(RuleStatus.INITIALIZING) : new RuleStatusInfo(RuleStatus.DISABLED); addToRuleEngine(resolvedRule, statusInfo); } } catch (Exception e) { logger.error("The rule '{}' is not updated, the new version is invalid", uid, e); } } else { throw new IllegalArgumentException( String.format("The rule '%s' is not updated, not matching with any existing rule", uid)); } }

Target:
public void updated(Provider<Rule> provider, Rule oldElement, Rule element) { String uid = element.getUID(); if (oldElement != null && uid.equals(oldElement.getUID())) { Rule resolvedRule = element; try { resolvedRule = resolveRuleByTemplate(element); } catch (IllegalArgumentException e) { logger.error("The rule '{}' is not updated, the new version is invalid", uid, e); } if (element != resolvedRule && provider instanceof ManagedRuleProvider) { update(resolvedRule); } else { super.updated(provider, oldElement, resolvedRule); } } else { throw new IllegalArgumentException( String.format("The rule '%s' is not updated, not matching with any existing rule", uid)); } }
Source:
private void doBgSearch(ITmfStateSystem ss, int resolution, @NonNull IProgressMonitor monitor, Map<TimeGraphEntry, List<ITimeEvent>> gaps, @NonNull Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates) { for (Map.Entry<TimeGraphEntry, List<ITimeEvent>> entryGap: gaps.entrySet()) { List<ITimeEvent> gapEvents = entryGap.getValue(); TimeGraphEntry entry = entryGap.getKey(); for (ITimeEvent event : gapEvents) { queryFullStates(ss, event.getTime(), event.getTime() + event.getDuration(), resolution, monitor, new IQueryHandler() { @Override public void handle(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) { List<ITimeEvent> eventList = getEventList(Objects.requireNonNull(entry), ss, fullStates, prevFullState, monitor); if (eventList != null && !eventList.isEmpty() && !monitor.isCanceled()) { doFilterEvents(entry, eventList, predicates, true); for (ITimeEvent e : eventList) { if ((e.getActiveProperties() & IFilterProperty.DIMMED) == 0) { event.setProperty(IFilterProperty.DIMMED, false); } if ((e.getActiveProperties() & IFilterProperty.EXCLUDE) == 0) { event.setProperty(IFilterProperty.EXCLUDE, false); applyResults(() -> { entry.updateZoomedEvent(event); }); } } } } }); } refresh(); } }

Target:
private void doBgSearch(ITmfStateSystem ss, int resolution, @NonNull IProgressMonitor monitor, Map<TimeGraphEntry, List<ITimeEvent>> gaps, @NonNull Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates) { try (TraceCompassLogUtils.ScopeLog poc = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.INFO, "TimegraphBgSearch")) { for (Map.Entry<TimeGraphEntry, List<ITimeEvent>> entryGap : gaps.entrySet()) { List<ITimeEvent> gapEvents = entryGap.getValue(); TimeGraphEntry entry = entryGap.getKey(); for (ITimeEvent event : gapEvents) { queryFullStates(ss, event.getTime(), event.getTime() + event.getDuration(), resolution, monitor, new IQueryHandler() { @Override public void handle(@NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState) { List<ITimeEvent> eventList = getEventList(Objects.requireNonNull(entry), ss, fullStates, prevFullState, monitor); TimeEventFilterDialog timeEventFilterDialog = getTimeEventFilterDialog(); boolean hasActiveSavedFilters = timeEventFilterDialog.hasActiveSavedFilters(); if (eventList != null && !eventList.isEmpty() && !monitor.isCanceled()) { doFilterEvents(entry, eventList, predicates); boolean dimmed = (event.getActiveProperties() & IFilterProperty.DIMMED) == 1; boolean exclude = hasActiveSavedFilters; for (ITimeEvent e : eventList) { if (dimmed && (e.getActiveProperties() & IFilterProperty.DIMMED) == 0) { event.setProperty(IFilterProperty.DIMMED, false); dimmed = false; } if (exclude && (e.getActiveProperties() & IFilterProperty.EXCLUDE) == 0) { event.setProperty(IFilterProperty.EXCLUDE, false); applyResults(() -> { entry.updateZoomedEvent(event); }); exclude = false; } } } } }); } refresh(); } } }