auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Iterable<VirtualMachine> listNodes() { ImmutableList.Builder<VirtualMachine> nodes = builder(); for (final String location : regionIds.get()) { nodes.addAll(api.getVirtualMachineApi(null).listByLocation(location)); } return nodes.build(); }

Target:
public Iterable<VirtualMachine> listNodes() { ImmutableList.Builder<VirtualMachine> nodes = builder(); if (regionIds.get().isEmpty()) { nodes.addAll(api.getVirtualMachineApi(null).listAll()); } else { for (final String location : regionIds.get()) { nodes.addAll(api.getVirtualMachineApi(null).listByLocation(location)); } } return nodes.build(); }
Source:
protected final void removeGroup(String groupName, EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { final Transaction tx = suspendOngoingTransactionIfExists(); try { Set<K> keys = getGroup(groupName, explicitFlags, explicitClassLoader); tryBegin(); try { InvocationContext context = getInvocationContextWithImplicitTransaction(false, explicitClassLoader, keys.size()); for (K key : keys) { removeInternal(key, explicitFlags, context); } tryCommit(); } catch (RuntimeException e) { tryRollback(); throw e; } } finally { resumePreviousOngoingTransaction(tx, false, "Error while trying to resume a transaction after removeGroup()"); } }

Target:
protected final void removeGroup(String groupName, EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { if (transactionManager == null) { nonTransactionalRemoveGroup(groupName, explicitFlags, explicitClassLoader); } else { transactionalRemoveGroup(groupName, explicitFlags, explicitClassLoader); } }
Source:
private void dispatchAssignmentChangeIfNeeded(String connectorType, DatastreamContext context, Map<String, List<DatastreamTask>> currentAssignment) { if (!_allStreamsByConnectorType.containsKey(connectorType)) { _connectors.get(connectorType).onAssignmentChange(context, currentAssignment.get(connectorType)); } else if (_allStreamsByConnectorType.get(connectorType).size() != currentAssignment.get(connectorType).size()) { _connectors.get(connectorType).onAssignmentChange(context, currentAssignment.get(connectorType)); } else { List<DatastreamTask> oldList = _allStreamsByConnectorType.get(connectorType); List<DatastreamTask> newList = currentAssignment.get(connectorType); List<DatastreamTask> diffList1 = new ArrayList<>(oldList); List<DatastreamTask> diffList2 = new ArrayList<>(newList); diffList1.removeAll(newList); diffList2.removeAll(oldList); if(diffList1.size() > 0 || diffList2.size() > 0) { _connectors.get(connectorType).onAssignmentChange(context, currentAssignment.get(connectorType)); } } }

Target:
private void dispatchAssignmentChangeIfNeeded(String connectorType, DatastreamContext context, Map<String, List<DatastreamTask>> currentAssignment) { if (!_allStreamsByConnectorType.containsKey(connectorType)) { _connectors.get(connectorType).onAssignmentChange(context, currentAssignment.get(connectorType)); } else if (_allStreamsByConnectorType.get(connectorType).size() != currentAssignment.get(connectorType).size()) { _connectors.get(connectorType).onAssignmentChange(context, currentAssignment.get(connectorType)); } else { Set<DatastreamTask> oldSet = new HashSet<>(_allStreamsByConnectorType.get(connectorType)); Set<DatastreamTask> newSet = new HashSet<>(currentAssignment.get(connectorType)); Set<DatastreamTask> diffList1 = new HashSet<>(oldSet); Set<DatastreamTask> diffList2 = new HashSet<>(newSet); diffList1.removeAll(newSet); diffList2.removeAll(oldSet); if(diffList1.size() > 0 || diffList2.size() > 0) { _connectors.get(connectorType).onAssignmentChange(context, currentAssignment.get(connectorType)); } } }
Source:
public void setup() { ctx = new SessionContext(); headers = new Headers(); headers.add("lah", "deda"); params = new HttpQueryParams(); params.add("k1", "v1"); request = new HttpRequestMessageImpl(ctx, "HTTP/1.1", "post", "/some/where", params, headers, "9.9.9.9", "https", 80, "localhost",new InetSocketAddress("api.netflix.com", 443)); request.setBodyAsText("some text"); request.storeInboundRequest(); response = new HttpResponseMessageImpl(ctx, headers, request, 200); response.setBodyAsText("response text"); }

Target:
public void setup() { ctx = new SessionContext(); headers = new Headers(); headers.add("lah", "deda"); params = new HttpQueryParams(); params.add("k1", "v1"); request = new HttpRequestMessageImpl(ctx, "HTTP/1.1", "post", "/some/where", params, headers, "9.9.9.9", "https", 80, "localhost", new SocketAddress() {}); request.setBodyAsText("some text"); request.storeInboundRequest(); response = new HttpResponseMessageImpl(ctx, headers, request, 200); response.setBodyAsText("response text"); }
Source:
public List<Index> listIndexes() throws QueryException { try { return dbQueue.submit(new ListIndexesCallable()).get(); } catch (InterruptedException e) { String msg = "Failed to list indexes"; logger.log(Level.SEVERE, msg, e); throw new QueryException(msg, e); } catch (ExecutionException e) { String msg = "Failed to list indexes"; logger.log(Level.SEVERE, msg, e); throw new QueryException(msg, e); } }

Target:
public List<Index> listIndexes() throws QueryException { try { return DatabaseImpl.get(dbQueue.submit(new ListIndexesCallable())); } catch (ExecutionException e) { String msg = "Failed to list indexes"; logger.log(Level.SEVERE, msg, e); throw new QueryException(msg, e); } }
Source:
protected void fillMacAddressIfMissing(VmNic iface) { final MacPoolManagerStrategy pool = getMacPool(); if (StringUtils.isEmpty(iface.getMacAddress()) && (pool.getAvailableMacsCount() >= 1)) { iface.setMacAddress(pool.allocateNewMac()); } }

Target:
protected void fillMacAddressIfMissing(VmNic iface) { if (StringUtils.isEmpty(iface.getMacAddress()) && (getMacPool().getAvailableMacsCount() >= 1)) { iface.setMacAddress(getMacPool().allocateNewMac()); } }
Source:
public String getDisplayName() { return "Build GitHub pull request"; }

Target:
public String getDisplayName() { return "Build GitHub pull requests"; }
Source:
public void before() { when(source.getBeanNameGenerator()).thenReturn( new RepositoryBeanNameGenerator(Thread.currentThread().getContextClassLoader()) ); }

Target:
public void before() { RepositoryBeanNameGenerator generator = new RepositoryBeanNameGenerator(getClass().getClassLoader()); Answer<Object> answer = invocation -> generator.generateBeanName((BeanDefinition) invocation.getArguments()[0]); when(source.generateBeanName(Mockito.any(BeanDefinition.class))).then(answer); }
Source:
public void onLiquidFlow(BlockFromToEvent e) { Block block = e.getToBlock(); Material type = block.getType(); if (SlimefunTag.FLUID_SENSITIVE_MATERIALS.isTagged(block.getType())) { if (BlockStorage.hasBlockInfo(block)) { e.setCancelled(true); } else { Location loc = block.getLocation(); if (SlimefunPlugin.getTickerTask().isReserved(loc)) { e.setCancelled(true); } } } }

Target:
public void onLiquidFlow(BlockFromToEvent e) { Block block = e.getToBlock(); Material type = block.getType(); if (SlimefunTag.FLUID_SENSITIVE_MATERIALS.isTagged(type)) { if (BlockStorage.hasBlockInfo(block)) { e.setCancelled(true); } else { Location loc = block.getLocation(); if (SlimefunPlugin.getTickerTask().isReserved(loc)) { e.setCancelled(true); } } } }
Source:
public void testNotifyAsyncMetadata() throws Exception { MetaData metaData = new MetaData(); metaData.addToTab("animals", "dog", true); client.notify(new RuntimeException("Foo"), metaData); apiClient.awaitReport(); assertNotNull(apiClient.report); MetaData data = apiClient.report.getError().getMetaData(); assertTrue((Boolean) data.getTab("animals").get("dog")); }

Target:
public void testNotifyAsyncMetadata() throws Exception { MetaData metaData = new MetaData(); metaData.addToTab("animals", "dog", true); client.notify(new RuntimeException("Foo"), metaData); assertNull(apiClient.report); apiClient.awaitReport(); assertNotNull(apiClient.report); MetaData data = apiClient.report.getError().getMetaData(); assertTrue((Boolean) data.getTab("animals").get("dog")); }
Source:
@Override protected Map<String, Pair<String, String>> getExclusiveLocks() { final LockMessage lockMessage = createLockMessage(); return templatesLockedForUpdate.stream() .collect(Collectors.toMap( template -> template.getId().toString(), template -> LockMessagesMatchUtil.makeLockingPair(LockingGroup.TEMPLATE, lockMessage))); }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { final LockMessage lockMessage = createLockMessage(); return templatesLockedForUpdate.stream() .collect(Collectors.toMap( template -> template.getId().toString(), template -> LockMessagesMatchUtil.makeLockingPair(LockingGroup.TEMPLATE, lockMessage))); }
Source:
public void getFathers_shouldReturnAllFathers() { RelationshipType type = Context.getPersonService().getRelationshipType(2); Person parent = Context.getPersonService().getPerson(6); Patient child = TestUtils.getPatient(2); parent.setGender("M"); Relationship rel = new Relationship(); rel.setRelationshipType(type); rel.setPersonA(parent); rel.setPersonB(child); Context.getPersonService().saveRelationship(rel); Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size()); SimpleObject[] mother = controller.getFathers(child,ui); Assert.assertTrue(mother.length >= 1); }

Target:
public void getFathers_shouldReturnAllFathers() { RelationshipType type = Context.getPersonService().getRelationshipType(2); Person parent = Context.getPersonService().getPerson(6); Patient child = TestUtils.getPatient(2); parent.setGender("M"); Relationship rel = new Relationship(); rel.setRelationshipType(type); rel.setPersonA(parent); rel.setPersonB(child); Context.getPersonService().saveRelationship(rel); Assert.assertEquals(1, Context.getPersonService().getRelationships(parent, child, type).size()); SimpleObject[] fathers = controller.getFathers(child,ui); Assert.assertTrue(fathers.length >= 1); }
Source:
private void initSqlQueries() { logger.debug("JDBC::initSqlQueries: '{}'", this.getClass().getSimpleName()); SQL_PING_DB = "SELECT 1"; SQL_GET_DB = "SELECT DATABASE()"; SQL_IF_TABLE_EXISTS = "SHOW TABLES LIKE '#searchTable#'"; SQL_CREATE_NEW_ENTRY_IN_ITEMS_TABLE = "INSERT INTO #itemsManageTable# (ItemName) VALUES ('#itemname#')"; SQL_CREATE_ITEMS_TABLE_IF_NOT = "CREATE TABLE IF NOT EXISTS #itemsManageTable# (ItemId INT NOT NULL AUTO_INCREMENT,#colname# #coltype# NOT NULL,PRIMARY KEY (ItemId))"; SQL_DELETE_ITEMS_ENTRY = "DELETE FROM items WHERE ItemName=#itemname#"; SQL_GET_ITEMID_TABLE_NAMES = "SELECT itemid, itemname FROM #itemsManageTable#"; SQL_GET_ITEM_TABLES = "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema=#jdbcUriDatabaseName# AND NOT table_name=#itemsManageTable#"; SQL_CREATE_ITEM_TABLE = "CREATE TABLE IF NOT EXISTS #tableName# (time #TABLEPRIMARYKEY# NOT NULL, value #dbType#, PRIMARY KEY(time))"; SQL_INSERT_ITEM_VALUE = "INSERT INTO #tableName# (TIME, VALUE) VALUES( #TABLEPRIMARYVALUE#, ? ) ON DUPLICATE KEY UPDATE VALUE= ?"; }

Target:
private void initSqlQueries() { logger.debug("JDBC::initSqlQueries: '{}'", this.getClass().getSimpleName()); SQL_PING_DB = "SELECT 1"; SQL_GET_DB = "SELECT DATABASE()"; SQL_IF_TABLE_EXISTS = "SHOW TABLES LIKE '#searchTable#'"; SQL_CREATE_NEW_ENTRY_IN_ITEMS_TABLE = "INSERT INTO #itemsManageTable# (ItemName) VALUES ('#itemname#')"; SQL_CREATE_ITEMS_TABLE_IF_NOT = "CREATE TABLE IF NOT EXISTS #itemsManageTable# (ItemId INT NOT NULL AUTO_INCREMENT,#colname# #coltype# NOT NULL,PRIMARY KEY (ItemId))"; SQL_DELETE_ITEMS_ENTRY = "DELETE FROM items WHERE ItemName=#itemname#"; SQL_GET_ITEMID_TABLE_NAMES = "SELECT itemid, itemname FROM #itemsManageTable#"; SQL_GET_ITEM_TABLES = "SELECT table_name FROM information_schema.tables WHERE table_type='BASE TABLE' AND table_schema=#jdbcUriDatabaseName# AND NOT table_name=#itemsManageTable#"; SQL_CREATE_ITEM_TABLE = "CREATE TABLE IF NOT EXISTS #tableName# (time #tablePrimaryKey# NOT NULL, value #dbType#, PRIMARY KEY(time))"; SQL_INSERT_ITEM_VALUE = "INSERT INTO #tableName# (TIME, VALUE) VALUES( #tablePrimaryValue#, ? ) ON DUPLICATE KEY UPDATE VALUE= ?"; }
Source:
public Flux<Integer> forceCloseHandles(String handleId, boolean recursive) { return azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryName, handleId, null, null, snapshot, recursive, Context.NONE) .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId, recursive)); }

Target:
public Flux<Integer> forceCloseHandles(String handleId, boolean recursive) { return azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryPath, handleId, null, null, snapshot, recursive, Context.NONE) .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId, recursive)); }
Source:
private WorkflowVersion setupServiceFilesForGitHubVersion(Triple<String, Date, String> ref, GHRepository repository, WorkflowVersion version, SourceFile dockstoreYml) { List<String> files; try { final DockstoreYaml12 dockstoreYaml12 = DockstoreYamlHelper.readAsDockstoreYaml12(dockstoreYml.getContent()); final List<Service12> services = dockstoreYaml12.getServices(); if (services.isEmpty()) { LOG.error(".dockstore.yml has no services"); return null; } files = services.get(0).getFiles(); } catch (DockstoreYamlHelper.DockstoreYamlException ex) { String msg = "Invalid .dockstore.yml"; LOG.error(msg, ex); return null; } for (String filePath: files) { String fileContent = this.readFileFromRepo(filePath, ref.getLeft(), repository); if (fileContent != null) { SourceFile file = new SourceFile(); file.setAbsolutePath(filePath); file.setPath(filePath); file.setContent(fileContent); file.setType(DescriptorLanguage.FileType.DOCKSTORE_SERVICE_OTHER); Optional<String> sha = FileFormatHelper.calcSHA1(file.getContent()); if (sha.isPresent()) { file.getChecksums().add(new Checksum(SHA_TYPE_FOR_SOURCEFILES, sha.get())); } version.getSourceFiles().add(file); } else { LOG.info("Could not find file " + filePath + " in repo " + repository); } } return version; }

Target:
private WorkflowVersion setupServiceFilesForGitHubVersion(Triple<String, Date, String> ref, GHRepository repository, WorkflowVersion version, SourceFile dockstoreYml) { List<String> files; try { final DockstoreYaml12 dockstoreYaml12 = DockstoreYamlHelper.readAsDockstoreYaml12(dockstoreYml.getContent()); final List<Service12> services = dockstoreYaml12.getServices(); if (services.isEmpty()) { LOG.error(".dockstore.yml has no services"); return null; } files = services.get(0).getFiles(); } catch (DockstoreYamlHelper.DockstoreYamlException ex) { String msg = "Invalid .dockstore.yml"; LOG.error(msg, ex); return null; } for (String filePath: files) { String fileContent = this.readFileFromRepo(filePath, ref.getLeft(), repository); if (fileContent != null) { SourceFile file = new SourceFile(); file.setAbsolutePath(filePath); file.setPath(filePath); file.setContent(fileContent); file.setType(DescriptorLanguage.FileType.DOCKSTORE_SERVICE_OTHER); version.getSourceFiles().add(file); } else { LOG.info("Could not find file " + filePath + " in repo " + repository); } } return version; }
Source:
protected boolean validate() { return super.validate() && isOperationAllowed(); }

Target:
protected boolean validate() { AutodefineExternalNetworkValidator validator = new AutodefineExternalNetworkValidator(vmDao, getNetwork()); return validate(validator.networkIsSet(getParameters().getId())) && validate(validator.isVmNetwork()) && validate(validator.notExternalNetwork()); }
Source:
public String getRelay(String number) { String content = HttpUtil.executeUrl(GET, createURL() + "/" + XML_PATH + "?" + SUFFIX_PASSWORD + getPassword(), this.timeOut); content = XmlUtils.getContentOfElement(content, SUFFIX_RELAY + number); int status = Integer.parseInt(XmlUtils.getContentOfElement(content, "State")); if(status == 1) { return "ON"; } else { return "OFF"; } }

Target:
public String getRelay(String number) { String URL = createURL() + "/" + XML_PATH + "?" + SUFFIX_PASSWORD + getPassword(); String content = HttpUtil.executeUrl(GET, URL, this.timeOut); content = XmlUtils.getContentOfElement(content, SUFFIX_RELAY + number); int status = Integer.parseInt(XmlUtils.getContentOfElement(content, "State")); if(status == 1) { return "ON"; } else { return "OFF"; } }
Source:
public static Double getSamplingInterval(Map<String, Object> properties) { String samplingInterval = properties.get(LISTEN_SAMPLING_INTERVAL_PROP_NAME).toString(); return Double.parseDouble(samplingInterval); }

Target:
public static double getSamplingInterval(Map<String, Object> properties) { String samplingInterval = properties.get(LISTEN_SAMPLING_INTERVAL_PROP_NAME).toString(); return Double.parseDouble(samplingInterval); }
Source:
public void getFileContentRest() throws Exception { Input in = new Input(); in.content = RestSession.newRawInput(CONTENT_NEW); assertEquals(204, session.putRaw(urlPut(), in.content).getStatusCode()); Optional<ChangeEdit> edit = editUtil.byChange(change); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( edit.get(), FILE_NAME, CONTENT_NEW2)); edit = editUtil.byChange(change); RestResponse r = session.get(urlPut()); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); String content = r.getEntityContent(); assertEquals(new String(CONTENT_NEW2, UTF_8), StringUtils.newStringUtf8( Base64.decodeBase64(content))); }

Target:
public void getFileContentRest() throws Exception { Put.Input in = new Put.Input(); in.content = RestSession.newRawInput(CONTENT_NEW); assertEquals(204, session.putRaw(urlEditFile(), in.content).getStatusCode()); Optional<ChangeEdit> edit = editUtil.byChange(change); assertEquals(RefUpdate.Result.FORCED, modifier.modifyFile( edit.get(), FILE_NAME, CONTENT_NEW2)); edit = editUtil.byChange(change); RestResponse r = session.get(urlEditFile()); assertEquals(HttpStatus.SC_OK, r.getStatusCode()); String content = r.getEntityContent(); assertEquals(StringUtils.newStringUtf8(CONTENT_NEW2), StringUtils.newStringUtf8(Base64.decodeBase64(content))); }
Source:
public int releaseExtraResources() { synchronized (lock) { int numReleasedResources = 0; if (requestsQueue.isEmpty() && delayedRequestsQueue.isEmpty()) { log.debug("Resource Requests Queue is empty."); if (hostAffinityEnabled) { List<String> allocatedHosts = getAllocatedHosts(); for (String host : allocatedHosts) { log.info("Releasing extra resources on host: {}", host); numReleasedResources += releaseResourcesForHost(host); } } else { numReleasedResources += releaseResourcesForHost(ANY_HOST); } clearState(); } return numReleasedResources; } }

Target:
public int releaseExtraResources() { synchronized (lock) { int numReleasedResources = 0; if (requestsQueue.isEmpty()) { log.debug("Resource Requests Queue is empty."); if (hostAffinityEnabled) { List<String> allocatedHosts = getAllocatedHosts(); for (String host : allocatedHosts) { log.info("Releasing extra resources on host: {}", host); numReleasedResources += releaseResourcesForHost(host); } } else { numReleasedResources += releaseResourcesForHost(ANY_HOST); } clearState(); } return numReleasedResources; } }
Source:
private List<HostNetwork> calculateNetworksToConfigure() { List<HostNetwork> networksToConfigure = new ArrayList<>(getParameters().getNetworkAttachments().size()); BusinessEntityMap<VdsNetworkInterface> nics = getExistingNicsBusinessEntityMap(); List<NetworkAttachment> attachmentsWithMissingUpdatedDefaultRoute = getAttachmentsWithMissingUpdatedDefaultRoute(); reportIpv6GatewayRemoval(findPreviousDefaultRouteNic(), attachmentsWithMissingUpdatedDefaultRoute); for (NetworkAttachment attachment : attachmentsWithMissingUpdatedDefaultRoute) { Network network = existingNetworkRelatedToAttachment(attachment); NetworkCluster networkCluster = network.getCluster(); HostNetwork networkToConfigure = new HostNetwork(network, attachment); networkToConfigure.setBonding(isBonding(attachment, nics)); boolean isDefaultRoute = defaultRouteSupported() && networkCluster.isDefaultRoute(); if (isDefaultRoute) { DnsResolverConfiguration dnsResolverConfiguration = getDnsConfigurationFromNetworkOrItsAttachment(attachment, network); if (dnsResolverConfiguration != null) { networkToConfigure.setNameServers(dnsResolverConfiguration.getNameServers()); } } networkToConfigure.setDefaultRoute(isDefaultRoute); if (NetworkUtils.qosConfiguredOnInterface(attachment, network)) { networkToConfigure.setQosConfiguredOnInterface(true); HostNetworkQos hostNetworkQos = effectiveHostNetworkQos.getQos(attachment, network); networkToConfigure.setQos(hostNetworkQos); } networksToConfigure.add(networkToConfigure); } return networksToConfigure; }

Target:
private List<HostNetwork> calculateNetworksToConfigure() { List<HostNetwork> networksToConfigure = new ArrayList<>(getParameters().getNetworkAttachments().size()); BusinessEntityMap<VdsNetworkInterface> nics = getExistingNicsBusinessEntityMap(); List<NetworkAttachment> attachments = getAttachmentsWithMissingUpdatedDefaultRoute(); reportIpv6GatewayRemoval(findPreviousDefaultRouteNic(), attachments); for (NetworkAttachment attachment : attachments) { Network network = existingNetworkRelatedToAttachment(attachment); NetworkCluster networkCluster = network.getCluster(); HostNetwork networkToConfigure = new HostNetwork(network, attachment); networkToConfigure.setBonding(isBonding(attachment, nics)); boolean isDefaultRoute = defaultRouteSupported() && networkCluster.isDefaultRoute(); if (isDefaultRoute) { DnsResolverConfiguration dnsResolverConfiguration = getDnsConfigurationFromNetworkOrItsAttachment(attachment, network); if (dnsResolverConfiguration != null) { networkToConfigure.setNameServers(dnsResolverConfiguration.getNameServers()); } } networkToConfigure.setDefaultRoute(isDefaultRoute); if (NetworkUtils.qosConfiguredOnInterface(attachment, network)) { networkToConfigure.setQosConfiguredOnInterface(true); HostNetworkQos hostNetworkQos = effectiveHostNetworkQos.getQos(attachment, network); networkToConfigure.setQos(hostNetworkQos); } networksToConfigure.add(networkToConfigure); } return networksToConfigure; }
Source:
public void entryRemoved(CacheEntryEvent<? extends String, ? extends CacheEntry> cacheEntryEvent) throws CacheEntryListenerException { AccessTokenDO accessTokenDO = (AccessTokenDO) cacheEntryEvent.getValue(); if (accessTokenDO != null) { if (log.isDebugEnabled()) { log.debug("OAuth cache removed for consumer id : " + accessTokenDO.getConsumerKey()); } String cacheKeyString = accessTokenDO.getConsumerKey() + ":" + accessTokenDO.getAuthzUser().getUserName().toLowerCase() + ":" + OAuth2Util.buildScopeString(accessTokenDO.getScope()); OAuthCacheKey oauthcacheKey = new OAuthCacheKey(cacheKeyString); OAuthCache oauthCache = OAuthCache .getInstance(OAuthServerConfiguration.getInstance().getOAuthCacheTimeout()); oauthCache.clearCacheEntry(accessTokenDO.getAccessToken()); oauthCache.clearCacheEntry(oauthcacheKey); } }

Target:
public void entryRemoved(CacheEntryEvent<? extends String, ? extends CacheEntry> cacheEntryEvent) throws CacheEntryListenerException { AccessTokenDO accessTokenDO = (AccessTokenDO) cacheEntryEvent.getValue(); if (accessTokenDO != null) { if (log.isDebugEnabled()) { log.debug("OAuth cache removed for consumer id : " + accessTokenDO.getConsumerKey()); } boolean isUsernameCaseSensitive = IdentityUtil .isUserStoreInUsernameCaseSensitive(accessTokenDO.getAuthzUser().getUserName()); String cacheKeyString; if (isUsernameCaseSensitive){ cacheKeyString = accessTokenDO.getConsumerKey() + ":" + accessTokenDO.getAuthzUser().getUserName() + ":" + OAuth2Util.buildScopeString(accessTokenDO.getScope()); }else { cacheKeyString = accessTokenDO.getConsumerKey() + ":" + accessTokenDO.getAuthzUser().getUserName().toLowerCase() + ":" + OAuth2Util.buildScopeString(accessTokenDO.getScope()); } OAuthCacheKey oauthcacheKey = new OAuthCacheKey(cacheKeyString); OAuthCache oauthCache = OAuthCache .getInstance(OAuthServerConfiguration.getInstance().getOAuthCacheTimeout()); oauthCache.clearCacheEntry(oauthcacheKey); oauthcacheKey = new OAuthCacheKey(accessTokenDO.getAccessToken()); oauthCache.clearCacheEntry(oauthcacheKey); } }
Source:
public void persistCompletedBatch(CompletedDownloadBatch completedDownloadBatch) { DownloadBatchId downloadBatchId = completedDownloadBatch.downloadBatchId(); DownloadBatchTitle downloadBatchTitle = completedDownloadBatch.downloadBatchTitle(); DownloadBatchStatus.Status downloadBatchStatus = DownloadBatchStatus.Status.DOWNLOADED; long downloadedDateTimeInMillis = completedDownloadBatch.downloadedDateTimeInMillis(); DownloadsBatchPersisted persistedBatch = new LiteDownloadsBatchPersisted( downloadBatchTitle, downloadBatchId, downloadBatchStatus, downloadedDateTimeInMillis, true ); persistBatch(persistedBatch); for (CompletedDownloadBatch.CompletedDownloadFile completedDownloadFile : completedDownloadBatch.completedDownloadFiles()) { String url = completedDownloadFile.originalNetworkAddress(); String rawDownloadFileId = rawFileIdFrom(completedDownloadBatch.downloadBatchTitle(), completedDownloadFile); DownloadFileId downloadFileId = DownloadFileIdCreator.createFrom(rawDownloadFileId); DownloadsFilePersisted persistedFile = new LiteDownloadsFilePersisted( downloadBatchId, downloadFileId, new LiteFilePath(completedDownloadFile.newFileLocation()), completedDownloadFile.fileSize().totalSize(), url, FilePersistenceType.INTERNAL ); persistFile(persistedFile); } }

Target:
public void persistCompletedBatch(CompletedDownloadBatch completedDownloadBatch) { DownloadBatchId downloadBatchId = completedDownloadBatch.downloadBatchId(); DownloadBatchTitle downloadBatchTitle = completedDownloadBatch.downloadBatchTitle(); DownloadBatchStatus.Status downloadBatchStatus = DownloadBatchStatus.Status.DOWNLOADED; long downloadedDateTimeInMillis = completedDownloadBatch.downloadedDateTimeInMillis(); DownloadsBatchPersisted persistedBatch = new LiteDownloadsBatchPersisted( downloadBatchTitle, downloadBatchId, downloadBatchStatus, downloadedDateTimeInMillis, NOTIFICATION_SEEN ); persistBatch(persistedBatch); for (CompletedDownloadBatch.CompletedDownloadFile completedDownloadFile : completedDownloadBatch.completedDownloadFiles()) { String url = completedDownloadFile.originalNetworkAddress(); String rawDownloadFileId = rawFileIdFrom(completedDownloadBatch.downloadBatchTitle(), completedDownloadFile); DownloadFileId downloadFileId = DownloadFileIdCreator.createFrom(rawDownloadFileId); DownloadsFilePersisted persistedFile = new LiteDownloadsFilePersisted( downloadBatchId, downloadFileId, new LiteFilePath(completedDownloadFile.newFileLocation()), completedDownloadFile.fileSize().totalSize(), url, FilePersistenceType.INTERNAL ); persistFile(persistedFile); } }
Source:
public synchronized Iterable<Entity> getAllEntitiesInApplication(Application application) { Predicate<Entity> predicate = EntityPredicates.applicationIdEqualTo(application.getId()); Iterable<Entity> allentities = Iterables.concat(preRegisteredEntitiesById.values(), preManagedEntitiesById.values(), entityProxiesById.values()); Iterable<Entity> result = Iterables.filter(allentities, predicate); return ImmutableList.copyOf(Iterables.transform(result, new Function<Entity, Entity>() { @Override public Entity apply(Entity input) { return (input == null) ? null : input instanceof Proxy ? input : ((AbstractEntity)input).getProxy(); }})); }

Target:
public synchronized Iterable<Entity> getAllEntitiesInApplication(Application application) { Predicate<Entity> predicate = EntityPredicates.applicationIdEqualTo(application.getId()); Iterable<Entity> allentities = Iterables.concat(preRegisteredEntitiesById.values(), preManagedEntitiesById.values(), entityProxiesById.values()); Iterable<Entity> result = Iterables.filter(allentities, predicate); return ImmutableSet.copyOf(Iterables.transform(result, new Function<Entity, Entity>() { @Override public Entity apply(Entity input) { return (input == null) ? null : input instanceof Proxy ? input : ((AbstractEntity)input).getProxyIfAvailable(); }})); }
Source:
public void submitFeedback(List<AlarmFeedback> alarmFeedback) { FeedbackRepository feedbackRepository = getRepository(); if (feedbackRepository == null) { throw new RuntimeException("Could not find a feedback repository"); } List<org.opennms.features.situationfeedback.api.AlarmFeedback> mappedFeedback = alarmFeedback.stream() .map(ModelMappers::fromFeedback) .collect(Collectors.toList()); try { feedbackRepository.persist(mappedFeedback); } catch (Exception e) { throw new RuntimeException("Failed to execute query: " + e.getMessage(), e); } alarmFeedbackListeners.forEach(listener -> { try { listener.handleAlarmFeedback(mappedFeedback); } catch (Exception e) { LOG.warn("Failed to notify listener of alarm feedback", e); } }); }

Target:
public void submitFeedback(List<AlarmFeedback> alarmFeedback) { FeedbackRepository feedbackRepository = getRepository(); if (feedbackRepository == null) { throw new RuntimeException("Could not find a feedback repository"); } List<org.opennms.features.situationfeedback.api.AlarmFeedback> mappedFeedback = alarmFeedback.stream() .map(ModelMappers::fromFeedback) .collect(Collectors.toList()); try { feedbackRepository.persist(mappedFeedback); } catch (Exception e) { throw new RuntimeException("Failed to execute query: " + e.getMessage(), e); } }
Source:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { AddDiskCommand<AddDiskParameters> addDiskCommand = (AddDiskCommand<AddDiskParameters>) command; AddDiskParameters parameters = addDiskCommand.getParameters(); if (addDiskCommand.getChildActionType() != ActionType.AddImageFromScratch) { super.childCommandsExecutionEnded(command, anyFailed, childCmdIds, status, completedChildren); return; } else { DiskImage di = (DiskImage) parameters.getDiskInfo(); log.info("Getting volume info for image '{}/{}'", di.getId(), di.getImageId()); try { DiskImage fromVdsm = imagesHandler.getVolumeInfoFromVdsm(di.getStoragePoolId(), di.getStorageIds().get(0), di.getId(), di.getImageId()); log.info("Updating size from '{}' to '{}'", di.getSize(), fromVdsm.getSize()); TransactionSupport.executeInNewTransaction(() -> { imageDao.updateImageSize(fromVdsm.getImageId(), fromVdsm.getSize()); return null; }); } catch (Exception e) { log.error("Failed to get volume info", e); setCommandEndStatus(command, true, status, childCmdIds); throw e; } setCommandEndStatus(command, false, status, childCmdIds); } }

Target:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { AddDiskCommand<AddDiskParameters> addDiskCommand = (AddDiskCommand<AddDiskParameters>) command; if (addDiskCommand.getChildActionType() != ActionType.AddImageFromScratch) { super.childCommandsExecutionEnded(command, anyFailed, childCmdIds, status, completedChildren); return; } DiskImage diskImage = (DiskImage) addDiskCommand.getParameters().getDiskInfo(); log.info("Getting volume info for image '{}/{}'", diskImage.getId(), diskImage.getImageId()); try { DiskImage fromVdsm = imagesHandler.getVolumeInfoFromVdsm(diskImage.getStoragePoolId(), diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId()); if (fromVdsm.getSize() != diskImage.getSize()) { log.info("Updating size from '{}' to '{}'", diskImage.getSize(), fromVdsm.getSize()); TransactionSupport.executeInNewTransaction(() -> { imageDao.updateImageSize(fromVdsm.getImageId(), fromVdsm.getSize()); return null; }); } } catch (Exception e) { log.error("Failed to get volume info", e); setCommandEndStatus(command, true, status, childCmdIds); throw e; } setCommandEndStatus(command, false, status, childCmdIds); }
Source:
public void reset() { this.netServiceLevel = 0; this.execStartTime = 0.0; this.status = Status.INSTANTIATED; this.priority = 0; this.lastExecutedDatacenterIdx = NOT_ASSIGNED; setBroker(DatacenterBroker.NULL); setFinishTime(NOT_ASSIGNED); setVm(Vm.NULL); setExecStartTime(0.0); datacenterExecutionList.clear(); this.setLastTriedDatacenter(Datacenter.NULL); }

Target:
public final Cloudlet reset() { this.netServiceLevel = 0; this.execStartTime = 0.0; this.status = Status.INSTANTIATED; this.priority = 0; this.lastExecutedDatacenterIdx = NOT_ASSIGNED; setBroker(DatacenterBroker.NULL); setFinishTime(NOT_ASSIGNED); setVm(Vm.NULL); setExecStartTime(0.0); datacenterExecutionList.clear(); this.setLastTriedDatacenter(Datacenter.NULL); return this; }
Source:
public GeometryCollection(final CoordinateReferenceSystem coordinateReferenceSystem, final List<Geometry> geometries) { super(coordinateReferenceSystem); notNull("geometries", geometries); isTrueArgument("geometrys contain only non-null elements", !geometries.contains(null)); this.geometries = Collections.unmodifiableList(geometries); }

Target:
public GeometryCollection(final CoordinateReferenceSystem coordinateReferenceSystem, final List<Geometry> geometries) { super(coordinateReferenceSystem); notNull("geometries", geometries); isTrueArgument("geometries contains only non-null elements", !geometries.contains(null)); this.geometries = Collections.unmodifiableList(geometries); }
Source:
public long create(SprintObject sprint) { long currentTime = System.currentTimeMillis(); IQueryValueSet valueSet = new MySQLQuerySet(); SerialNumberObject serialNumber = SerialNumberDAO.getInstance().get(sprint.getProjectId()); long sprintId = serialNumber.getSprintId() + 1; valueSet.addTableName(SprintEnum.TABLE_NAME); valueSet.addInsertValue(SprintEnum.SERIAL_ID, sprintId); valueSet.addInsertValue(SprintEnum.GOAL, sprint.getSprintGoal()); valueSet.addInsertValue(SprintEnum.INTERVAL, sprint.getInterval()); valueSet.addInsertValue(SprintEnum.MEMBERS, sprint.getMembersNumber()); valueSet.addInsertValue(SprintEnum.AVAILABLE_HOURS, sprint.getHoursCanCommit()); valueSet.addInsertValue(SprintEnum.FOCUS_FACTOR, sprint.getFocusFactor()); valueSet.addInsertValue(SprintEnum.START_DATE, sprint.getStartDate()); valueSet.addInsertValue(SprintEnum.DEMO_DATE, sprint.getDemoDate()); valueSet.addInsertValue(SprintEnum.DEMO_PLACE, sprint.getDemoPlace()); valueSet.addInsertValue(SprintEnum.DAILY_INFO, sprint.getDailyInfo()); valueSet.addInsertValue(SprintEnum.PROJECT_ID, sprint.getProjectId()); if (sprint.getCreateTime() > 0) { valueSet.addInsertValue(SprintEnum.CREATE_TIME, sprint.getCreateTime()); valueSet.addInsertValue(SprintEnum.UPDATE_TIME, sprint.getCreateTime()); } else { valueSet.addInsertValue(SprintEnum.CREATE_TIME, currentTime); valueSet.addInsertValue(SprintEnum.UPDATE_TIME, currentTime); } String query = valueSet.getInsertQuery(); long id = mControl.executeInsert(query); serialNumber.setId(SerialNumberEnum.SPRINT, sprintId); serialNumber.save(); return id; }

Target:
public long create(SprintObject sprint) { long currentTime = System.currentTimeMillis(); IQueryValueSet valueSet = new MySQLQuerySet(); SerialNumberObject serialNumber = SerialNumberDAO.getInstance().get(sprint.getProjectId()); long sprintId = serialNumber.getSprintId() + 1; valueSet.addTableName(SprintEnum.TABLE_NAME); valueSet.addInsertValue(SprintEnum.SERIAL_ID, sprintId); valueSet.addInsertValue(SprintEnum.GOAL, sprint.getSprintGoal()); valueSet.addInsertValue(SprintEnum.INTERVAL, sprint.getInterval()); valueSet.addInsertValue(SprintEnum.MEMBERS, sprint.getMembersNumber()); valueSet.addInsertValue(SprintEnum.AVAILABLE_HOURS, sprint.getHoursCanCommit()); valueSet.addInsertValue(SprintEnum.FOCUS_FACTOR, sprint.getFocusFactor()); valueSet.addInsertValue(SprintEnum.START_DATE, sprint.getStartDate()); valueSet.addInsertValue(SprintEnum.DEMO_DATE, sprint.getDemoDate()); valueSet.addInsertValue(SprintEnum.DEMO_PLACE, sprint.getDemoPlace()); valueSet.addInsertValue(SprintEnum.DAILY_INFO, sprint.getDailyInfo()); valueSet.addInsertValue(SprintEnum.PROJECT_ID, sprint.getProjectId()); if (sprint.getCreateTime() > 0) { valueSet.addInsertValue(SprintEnum.CREATE_TIME, sprint.getCreateTime()); valueSet.addInsertValue(SprintEnum.UPDATE_TIME, sprint.getCreateTime()); } else { valueSet.addInsertValue(SprintEnum.CREATE_TIME, currentTime); valueSet.addInsertValue(SprintEnum.UPDATE_TIME, currentTime); } String query = valueSet.getInsertQuery(); long id = mControl.executeInsert(query); serialNumber.setSprintId(sprintId); serialNumber.save(); return id; }
Source:
public static String createSas(String endpoint, OffsetDateTime expirationTime, AzureKeyCredential keyCredential) { try { String resKey = "r"; String expKey = "e"; String signKey = "s"; Charset charset = StandardCharsets.UTF_8; String encodedResource = URLEncoder.encode(endpoint, charset.name()); String encodedExpiration = URLEncoder.encode(expirationTime.atZoneSameInstant(ZoneOffset.UTC).format( DateTimeFormatter.ofPattern("M/d/yyyy h:m:s a")), charset.name()); String unsignedSas = String.format("%s=%s&%s=%s", resKey, encodedResource, expKey, encodedExpiration); Mac hmac = Mac.getInstance("hmacSHA256"); hmac.init(new SecretKeySpec(Base64.getDecoder().decode(keyCredential.getKey()), "hmacSHA256")); String signature = new String(Base64.getEncoder().encode( hmac.doFinal(unsignedSas.getBytes(charset))), charset); String encodedSignature = URLEncoder.encode(signature, charset.name()); return String.format("%s&%s=%s", unsignedSas, signKey, encodedSignature); } catch (NoSuchAlgorithmException | UnsupportedEncodingException | InvalidKeyException e) { e.printStackTrace(); } return null; }

Target:
public static String createSas(String endpoint, OffsetDateTime expirationTime, AzureKeyCredential keyCredential) { try { String resKey = "r"; String expKey = "e"; String signKey = "s"; Charset charset = StandardCharsets.UTF_8; String encodedResource = URLEncoder.encode(endpoint, charset.name()); String encodedExpiration = URLEncoder.encode(expirationTime.atZoneSameInstant(ZoneOffset.UTC).format( DateTimeFormatter.ofPattern("M/d/yyyy h:m:s a")), charset.name()); String unsignedSas = String.format("%s=%s&%s=%s", resKey, encodedResource, expKey, encodedExpiration); Mac hmac = Mac.getInstance("hmacSHA256"); hmac.init(new SecretKeySpec(Base64.getDecoder().decode(keyCredential.getKey()), "hmacSHA256")); String signature = new String(Base64.getEncoder().encode( hmac.doFinal(unsignedSas.getBytes(charset))), charset); String encodedSignature = URLEncoder.encode(signature, charset.name()); return String.format("%s&%s=%s", unsignedSas, signKey, encodedSignature); } catch (NoSuchAlgorithmException | UnsupportedEncodingException | InvalidKeyException e) { throw logger.logExceptionAsError(new RuntimeException(e)); } }
Source:
private void parseDataSource(XMLExtendedStreamReader reader, DataSourcesConfigurationBuilder dataSourcesBuilder) throws XMLStreamException { String[] attributes = ParseUtils.requireAttributes(reader, Attribute.NAME, Attribute.JNDI_NAME); String name = attributes[0]; String jndiName = attributes[1]; DataSourceConfigurationBuilder dataSourceBuilder = dataSourcesBuilder.dataSource(name, jndiName); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case JNDI_NAME: case NAME: break; case STATISTICS: Boolean.parseBoolean(value); break; default: throw ParseUtils.unexpectedAttribute(reader, i); } } Element element = nextElement(reader); if (element != Element.CONNECTION_FACTORY) { throw ParseUtils.unexpectedElement(reader, element); } parseDataSourceConnectionFactory(reader, dataSourceBuilder); element = nextElement(reader); if (element != Element.CONNECTION_POOL) { throw ParseUtils.unexpectedElement(reader, element); } parseDataSourceConnectionPool(reader, dataSourceBuilder); element = nextElement(reader); if (element != null) { throw ParseUtils.unexpectedElement(reader, element); } }

Target:
private void parseDataSource(XMLExtendedStreamReader reader, DataSourcesConfigurationBuilder dataSourcesBuilder) throws XMLStreamException { String[] attributes = ParseUtils.requireAttributes(reader, Attribute.NAME, Attribute.JNDI_NAME); String name = attributes[0]; String jndiName = attributes[1]; DataSourceConfigurationBuilder dataSourceBuilder = dataSourcesBuilder.dataSource(name, jndiName); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case JNDI_NAME: case NAME: break; case STATISTICS: dataSourceBuilder.statistics(Boolean.parseBoolean(value)); break; default: throw ParseUtils.unexpectedAttribute(reader, i); } } Element element = nextElement(reader); if (element != Element.CONNECTION_FACTORY) { throw ParseUtils.unexpectedElement(reader, element); } parseDataSourceConnectionFactory(reader, dataSourceBuilder); element = nextElement(reader); if (element != Element.CONNECTION_POOL) { throw ParseUtils.unexpectedElement(reader, element); } parseDataSourceConnectionPool(reader, dataSourceBuilder); element = nextElement(reader); if (element != null) { throw ParseUtils.unexpectedElement(reader, element); } }
Source:
public static StorageServiceProperties create(final AccountType accountType, final Date creationTime, final Map<String, String> primaryEndpoints, final String primaryLocation, final Status provisioningState, final Map<String, String> secondaryEndpoints, final String secondaryLocation, final RegionStatus statusOfPrimary, final RegionStatus statusOfSecondary) { return new AutoValue_StorageService_StorageServiceProperties(accountType, creationTime, primaryEndpoints, primaryLocation, provisioningState, secondaryEndpoints, secondaryLocation, statusOfPrimary, statusOfSecondary); }

Target:
public static StorageServiceProperties create(final AccountType accountType, final Date creationTime, final Map<String, String> primaryEndpoints, final String primaryLocation, final Status provisioningState, final Map<String, String> secondaryEndpoints, final String secondaryLocation, final RegionStatus statusOfPrimary, final RegionStatus statusOfSecondary) { return new AutoValue_StorageService_StorageServiceProperties(accountType, creationTime, primaryEndpoints == null ? ImmutableMap.<String, String>builder().build() : ImmutableMap.copyOf(primaryEndpoints), primaryLocation, provisioningState, secondaryEndpoints == null ? ImmutableMap.<String, String>builder().build() : ImmutableMap.copyOf(secondaryEndpoints), secondaryLocation, statusOfPrimary, statusOfSecondary); }
Source:
public Set<String> setNodesAvailable(Set<String> nodeUrls) { waitForRMCoreToBeInitialized(); if (logger.isTraceEnabled()) { logger.trace("Received availability for the following workers: " + nodeUrls); } ImmutableSet.Builder<String> nodeUrlsNotKnownByTheRM = new ImmutableSet.Builder<>(); for (String nodeUrl : nodeUrls) { RMNode node = this.allNodes.get(nodeUrl); if (node == null) { logger.warn("Cannot set node as available, the node is unknown: " + nodeUrl); if (logger.isDebugEnabled()) { logger.warn("Known nodes are: " + Arrays.toString(allNodes.keySet().toArray())); } nodeUrlsNotKnownByTheRM.add(nodeUrl); } else if (node.isDown()) { restoreNodeState(nodeUrl, node); } else { if (logger.isDebugEnabled()) { logger.debug("The node identified by " + nodeUrl + " is known and not DOWN, no action performed"); } } } return nodeUrlsNotKnownByTheRM.build(); }

Target:
public Set<String> setNodesAvailable(Set<String> nodeUrls) { waitForRMCoreToBeInitialized(); if (logger.isTraceEnabled()) { logger.trace("Received availability for the following workers: " + nodeUrls); } ImmutableSet.Builder<String> nodeUrlsNotKnownByTheRM = new ImmutableSet.Builder<>(); for (String nodeUrl : nodeUrls) { RMNode node = this.allNodes.get(nodeUrl); if (node == null) { logger.warn("Cannot set node as available, the node is unknown: " + nodeUrl); if (logger.isDebugEnabled()) { logger.debug("Known nodes are: " + Arrays.toString(allNodes.keySet().toArray())); } nodeUrlsNotKnownByTheRM.add(nodeUrl); } else if (node.isDown()) { restoreNodeState(nodeUrl, node); } else { if (logger.isDebugEnabled()) { logger.debug("The node identified by " + nodeUrl + " is known and not DOWN, no action performed"); } } } return nodeUrlsNotKnownByTheRM.build(); }
Source:
public String removeEndComma(String str) { return str.substring(0, str.length() - 2); }

Target:
private String removeEndComma(String str) { return str.substring(0, str.length() - 2); }
Source:
public void decorateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry, TimeChartEvent parentEvent) { Iterator<ITimeEvent> iterator = timeAnalysisEntry.getTimeEventsIterator(0, Long.MAX_VALUE, Long.MAX_VALUE); TimeChartEvent event = null; int entryPriority = ColorSettingsManager.PRIORITY_NONE; boolean entryIsBookmarked = false; boolean entryIsVisible = false; boolean entryIsSearchMatch = false; boolean hasNext = true; while (!interrupted && hasNext) { synchronized (timeAnalysisEntry) { hasNext = iterator.hasNext(); event = (TimeChartEvent) iterator.next(); } if (hasNext) { if (event.getItemizedEntry() == null) { decorateEvent(event); } else { decorateTraceEntry(event.getItemizedEntry(), event); } entryPriority = Math.min(entryPriority, event.getColorSettingPriority()); entryIsBookmarked |= event.isBookmarked(); entryIsVisible |= event.isVisible(); entryIsSearchMatch |= event.isSearchMatch(); if (++fCount % timeAnalysisEntry.getTrace().getCacheSize() == 0) { redrawViewer(false); } } } if (parentEvent != null) { parentEvent.setColorSettingPriority(entryPriority); parentEvent.setIsBookmarked(entryIsBookmarked); parentEvent.setIsVisible(entryIsVisible); parentEvent.setIsSearchMatch(entryIsSearchMatch); } }

Target:
public void decorateTraceEntry(TimeChartAnalysisEntry timeAnalysisEntry, TimeChartEvent parentEvent) { Iterator<ITimeEvent> iterator = timeAnalysisEntry.getTimeEventsIterator(0, Long.MAX_VALUE, Long.MAX_VALUE); TimeChartEvent event = null; int entryPriority = ColorSettingsManager.PRIORITY_NONE; boolean entryIsBookmarked = false; boolean entryIsVisible = false; boolean entryIsSearchMatch = false; boolean hasNext = true; while (!interrupted && hasNext) { synchronized (timeAnalysisEntry) { while ((hasNext = iterator.hasNext()) == true) { event = (TimeChartEvent) iterator.next(); break; } } if (hasNext && event != null) { if (event.getItemizedEntry() == null) { decorateEvent(event); } else { decorateTraceEntry(event.getItemizedEntry(), event); } entryPriority = Math.min(entryPriority, event.getColorSettingPriority()); entryIsBookmarked |= event.isBookmarked(); entryIsVisible |= event.isVisible(); entryIsSearchMatch |= event.isSearchMatch(); if (++fCount % timeAnalysisEntry.getTrace().getCacheSize() == 0) { redrawViewer(false); } } } if (parentEvent != null) { parentEvent.setColorSettingPriority(entryPriority); parentEvent.setIsBookmarked(entryIsBookmarked); parentEvent.setIsVisible(entryIsVisible); parentEvent.setIsSearchMatch(entryIsSearchMatch); } }
Source:
static Path getConfigDirectory() { Path configPath; if (System.getProperty("os.name").toLowerCase().contains("windows")) { String appdata = System.getenv("APPDATA"); if (appdata == null) { configPath = Paths.get(System.getProperty("user.home")); } else { configPath = Paths.get(appdata); } } else { String configEnv = System.getenv("XDG_CONFIG_HOME"); if (configEnv != null && configEnv.length() > 0) { configPath = Paths.get(configEnv); } else { configPath = Paths.get(System.getProperty("user.home")).resolve(".config"); } } return configPath.resolve("tmc"); }

Target:
static Path getConfigDirectory() { Path configPath; if (SystemUtils.IS_OS_WINDOWS) { String appdata = System.getenv("APPDATA"); if (appdata == null) { configPath = Paths.get(System.getProperty("user.home")); } else { configPath = Paths.get(appdata); } } else { String configEnv = System.getenv("XDG_CONFIG_HOME"); if (configEnv != null && configEnv.length() > 0) { configPath = Paths.get(configEnv); } else { configPath = Paths.get(System.getProperty("user.home")).resolve(".config"); } } return configPath.resolve("tmc"); }