auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBroadcastWithAdditionalEvals() throws InterruptedException { final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREAD); final AtomicInteger operationIdCounter = new AtomicInteger(0); final int numMoves = 5; final int numAdditionalEvals = 2; final int newEvalIdx = NUM_INIT_EVALS; for (int i = 0; i < numAdditionalEvals; i++) { blockManager.registerEvaluator(EVAL_PREFIX + (newEvalIdx + i), NUM_INIT_EVALS); } final int numActiveEvals = NUM_INIT_EVALS + numAdditionalEvals; final int numOtherEvals = numActiveEvals - 2; final CountDownLatch movedLatch = new CountDownLatch(numMoves); final FinishedCallback finishedCallback = new FinishedCallback(movedLatch); runRandomMove(executor, operationIdCounter, numMoves, numActiveEvals, finishedCallback); movedLatch.await(20000, TimeUnit.MILLISECONDS); final int numBroadcasts = numOtherEvals * (numMoves - finishedCallback.getNumFailedMoves()); while (messageSender.getBroadcastCount() < numBroadcasts) { Thread.sleep(1000); } Thread.sleep(2000); assertEquals(numBroadcasts, messageSender.getBroadcastCount()); }

Target:
public void testBroadcastWithAdditionalEvals() throws InterruptedException { final ExecutorService executor = Executors.newFixedThreadPool(NUM_THREAD); final AtomicInteger operationIdCounter = new AtomicInteger(0); final int numMoves = 5; final int numAdditionalEvals = 2; final int newEvalIdx = NUM_INIT_EVALS; for (int i = 0; i < numAdditionalEvals; i++) { blockManager.registerEvaluator(EVAL_PREFIX + (newEvalIdx + i), NUM_INIT_EVALS); } final int numActiveEvals = NUM_INIT_EVALS + numAdditionalEvals; final int numOtherEvals = numActiveEvals - 2; final CountDownLatch movedLatch = new CountDownLatch(numMoves); final FinishedCallback finishedCallback = new FinishedCallback(movedLatch); runRandomMove(executor, operationIdCounter, numMoves, numActiveEvals, finishedCallback); assertTrue("Move does not finish within time", movedLatch.await(20000, TimeUnit.MILLISECONDS)); int loop = 0; final int numBroadcasts = numOtherEvals * (numMoves - finishedCallback.getNumFailedMoves()); while (messageSender.getBroadcastCount() < numBroadcasts) { loop++; Thread.sleep(WAIT_INTERVAL_MS); } Thread.sleep(WAIT_INTERVAL_MS * (loop + 1)); assertEquals("There are more broadcasts above expectation", numBroadcasts, messageSender.getBroadcastCount()); }
Source:
public boolean isPortInUse(int port) { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(port); this.closeTestingServerSocket(serverSocket); } catch (IOException e) { return true; } return false; }

Target:
public boolean isPortInUse(int port) { String message = String.format("Checking if port %s is in use...", port); wizard.showMessage(message); return checkPortUsage(port); }
Source:
public static String resolveAttestationTrustStorePath() { return ConfigUtil.resolvePath(resolveCABasePath(), Config.<String> GetValue(ConfigValues.AttestationTruststore)); }

Target:
public static String resolveAttestationTrustStorePath() { return ConfigUtil.resolvePath(Config.<String> GetValue(ConfigValues.DataDir), Config.<String> GetValue(ConfigValues.AttestationTruststore)); }
Source:
public void toggleAllowAllMechanisms() throws Exception { final SnapshotBackup snapshotBackup = new SnapshotBackup(); client.apply(snapshotBackup.backup()); final Address authenticationConfigurationAddress = createAuthenticationConfiguration(); final boolean initialValue = false; try { page.navigate(); page.switchToAuthenticationConfiguration() .getResourceManager() .selectByName(authenticationConfigurationAddress.getLastPairValue()); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, !initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, !initialValue); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, initialValue); } finally { client.apply(snapshotBackup.restore()); } }

Target:
public void toggleAllowAllMechanisms() throws Exception { final Address authenticationConfigurationAddress = createAuthenticationConfiguration(); final boolean initialValue = false; try { elytronAuthenticationOperations.performActionOnAttributeAndRevertItsValueToOriginal( authenticationConfigurationAddress, ALLOW_ALL_MECHANISMS, () -> { page.navigate(); page.switchToAuthenticationConfiguration() .getResourceManager() .selectByName(authenticationConfigurationAddress.getLastPairValue()); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, !initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, !initialValue); Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); new ConfigChecker.Builder(client, authenticationConfigurationAddress) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.CHECKBOX, ALLOW_ALL_MECHANISMS, initialValue) .verifyFormSaved() .verifyAttribute(ALLOW_ALL_MECHANISMS, initialValue); } ); } finally { ops.removeIfExists(authenticationConfigurationAddress); } }
Source:
public boolean isServiceBlockedOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException { Destination destination = getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManager().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "isServiceBlockedOnDestination"); } return getServicesManagerBl().isServiceBlockedOnDestination(service, destinationId); }

Target:
public boolean isServiceBlockedOnDestination(PerunSession sess, Service service, int destinationId) throws PrivilegeException, DestinationNotExistsException, FacilityNotExistsException { Destination destination = getServicesManagerBl().getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManagerBl().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "isServiceBlockedOnDestination"); } return getServicesManagerBl().isServiceBlockedOnDestination(service, destinationId); }
Source:
public List<User> getUsers(PerunSession sess) throws InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.PERUNADMIN) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "getUsers"); } return getUsersManagerBl().getUsers(sess); }

Target:
public List<User> getUsers(PerunSession sess) throws InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); if(!AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "getUsers"); } return getUsersManagerBl().getUsers(sess); }
Source:
public void searchByPatient_shouldGetRetiredVisitsIfIncludeAllIsTrue() throws Exception { Visit visit = service.getVisitByUuid("e1428fea-6b78-11e0-93c3-18a905e044dc"); Assert.assertTrue(visit.isVoided()); handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("reason", "void test reason"))); SimpleObject resultWithVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", "da7f524f-27ce-4bb2-86d6-6d1d05312bd5"), new Parameter("includeAll", "true")))); SimpleObject resultVithoutVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", "da7f524f-27ce-4bb2-86d6-6d1d05312bd5")))); Assert.assertNotEquals(Util.getResultsSize(resultWithVoidedVisits), Util.getResultsSize(resultVithoutVoidedVisits)); }

Target:
public void searchByPatient_shouldGetRetiredVisitsIfIncludeAllIsTrue() throws Exception { String patientUUid = "da7f524f-27ce-4bb2-86d6-6d1d05312bd5"; SimpleObject resultWithVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid), new Parameter("includeAll", "true")))); SimpleObject resultWithoutVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid)))); int visitIncludingVoidedSize = Util.getResultsSize(resultWithVoidedVisits); int visitExcludingVoidedSize = Util.getResultsSize(resultWithoutVoidedVisits); Assert.assertEquals(visitIncludingVoidedSize, 4); Assert.assertEquals(visitExcludingVoidedSize, 3); handle(newDeleteRequest(getURI() + "/" + getUuid(), new Parameter("reason", "void test reason"))); resultWithVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid), new Parameter("includeAll", "true")))); resultWithoutVoidedVisits = deserialize(handle(newGetRequest(getURI(), new Parameter("patient", patientUUid)))); Assert.assertEquals(Util.getResultsSize(resultWithoutVoidedVisits), 2); Assert.assertEquals(Util.getResultsSize(resultWithVoidedVisits), 4); }
Source:
public void removeFolder(String folderId) { for (String deviceId : deviceFolderMap.keySet()) { if (deviceFolderMap.get(deviceId).containsKey(folderId)) { deviceFolderMap.get(deviceId).remove(folderId); break; } } }

Target:
private void removeFolder(String folderId) { for (HashMap<String, CompletionInfo> folderMap : deviceFolderMap.values()) { if (folderMap.containsKey(folderId)) { folderMap.remove(folderId); break; } } }
Source:
public Map<AnyObjectId, List<AnyObjectId>> getGrafts() throws IOException { return getGraftsDatabase().getGrafts(); }

Target:
public Map<AnyObjectId, List<ObjectId>> getGrafts() throws IOException { return getGraftsDatabase().getGrafts(); }
Source:
private Pair<Map<DataNodeId, List<RemoteReplicaInfo>>, ReplicaThread> getRemoteReplicasAndReplicaThread(int batchSize, ClusterMap clusterMap, Host localHost, Host remoteHost, StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter, Transformer transformer, StoreEventListener listener) { Properties properties = new Properties(); properties.setProperty("replication.quarantine.duration.ms", "3000"); config = new ReplicationConfig(new VerifiableProperties(properties)); ReplicationMetrics replicationMetrics = new ReplicationMetrics(new MetricRegistry(), clusterMap.getReplicaIds(localHost.dataNodeId)); replicationMetrics.populatePerColoMetrics(Collections.singleton(remoteHost.dataNodeId.getDatacenterName())); Map<DataNodeId, List<RemoteReplicaInfo>> replicasToReplicate = Collections.singletonMap(remoteHost.dataNodeId, localHost.getRemoteReplicaInfos(remoteHost, listener)); Map<DataNodeId, Host> hosts = new HashMap<>(); hosts.put(remoteHost.dataNodeId, remoteHost); MockConnectionPool connectionPool = new MockConnectionPool(hosts, clusterMap, batchSize); ReplicaThread replicaThread = new ReplicaThread("threadtest", replicasToReplicate, new MockFindTokenFactory(), clusterMap, new AtomicInteger(0), localHost.dataNodeId, connectionPool, config, replicationMetrics, null, storeKeyFactory, storeKeyConverter, transformer, clusterMap.getMetricRegistry(), false, localHost.dataNodeId.getDatacenterName(), new ResponseHandler(clusterMap), time); return new Pair<>(replicasToReplicate, replicaThread); }

Target:
private Pair<Map<DataNodeId, List<RemoteReplicaInfo>>, ReplicaThread> getRemoteReplicasAndReplicaThread(int batchSize, ClusterMap clusterMap, Host localHost, Host remoteHost, StoreKeyFactory storeKeyFactory, StoreKeyConverter storeKeyConverter, Transformer transformer, StoreEventListener listener) { ReplicationMetrics replicationMetrics = new ReplicationMetrics(new MetricRegistry(), clusterMap.getReplicaIds(localHost.dataNodeId)); replicationMetrics.populatePerColoMetrics(Collections.singleton(remoteHost.dataNodeId.getDatacenterName())); Map<DataNodeId, List<RemoteReplicaInfo>> replicasToReplicate = Collections.singletonMap(remoteHost.dataNodeId, localHost.getRemoteReplicaInfos(remoteHost, listener)); Map<DataNodeId, Host> hosts = new HashMap<>(); hosts.put(remoteHost.dataNodeId, remoteHost); MockConnectionPool connectionPool = new MockConnectionPool(hosts, clusterMap, batchSize); ReplicaThread replicaThread = new ReplicaThread("threadtest", replicasToReplicate, new MockFindTokenFactory(), clusterMap, new AtomicInteger(0), localHost.dataNodeId, connectionPool, config, replicationMetrics, null, storeKeyFactory, storeKeyConverter, transformer, clusterMap.getMetricRegistry(), false, localHost.dataNodeId.getDatacenterName(), new ResponseHandler(clusterMap), time); return new Pair<>(replicasToReplicate, replicaThread); }
Source:
public Map<String, Set<String>> readPluginsStorages() { log.debug("Reading extensions storages from plugins"); Map<String, Set<String>> result = new LinkedHashMap<>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); for (PluginWrapper plugin : plugins) { String pluginId = plugin.getDescriptor().getPluginId(); log.debug("Reading extensions storage from plugin '{}'", pluginId); Set<String> bucket = new HashSet<>(); try { Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource()); if (urls == null || !urls.hasMoreElements()) { log.debug("Cannot find '{}'", getExtensionsResource()); } else { while (urls.hasMoreElements()) { URL url = urls.nextElement(); if (url != null) { log.debug("Read '{}'", url.getFile()); try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { LegacyExtensionStorage.read(reader, bucket); } } else { log.debug("Cannot find '{}'", getExtensionsResource()); } } } debugExtensions(bucket); result.put(pluginId, bucket); } catch (IOException e) { log.error(e.getMessage(), e); } } return result; }

Target:
public Map<String, Set<String>> readPluginsStorages() { log.debug("Reading extensions storages from plugins"); Map<String, Set<String>> result = new LinkedHashMap<>(); List<PluginWrapper> plugins = pluginManager.getPlugins(); for (PluginWrapper plugin : plugins) { String pluginId = plugin.getDescriptor().getPluginId(); log.debug("Reading extensions storage from plugin '{}'", pluginId); Set<String> bucket = new HashSet<>(); try { Enumeration<URL> urls = ((PluginClassLoader) plugin.getPluginClassLoader()).findResources(getExtensionsResource()); if (urls == null || !urls.hasMoreElements()) { log.debug("Cannot find '{}'", getExtensionsResource()); } else { while (urls.hasMoreElements()) { URL url = urls.nextElement(); log.debug("Read '{}'", url.getFile()); try (Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8)) { LegacyExtensionStorage.read(reader, bucket); } } } debugExtensions(bucket); result.put(pluginId, bucket); } catch (IOException e) { log.error(e.getMessage(), e); } } return result; }
Source:
public void testCountNullableExpression() throws Exception { testQuery( "SELECT COUNT(CASE WHEN dim2 = 'abc' THEN 'yes' WHEN dim2 = 'def' THEN 'yes' END) FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .virtualColumns() .aggregators(aggregators( new FilteredAggregatorFactory( new CountAggregatorFactory("a0"), in("dim2", ImmutableList.of("abc", "def"), null) ) )) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }

Target:
public void testCountNullableExpression() throws Exception { testQuery( "SELECT COUNT(CASE WHEN dim2 = 'abc' THEN 'yes' WHEN dim2 = 'def' THEN 'yes' END) FROM druid.foo", ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .aggregators(aggregators( new FilteredAggregatorFactory( new CountAggregatorFactory("a0"), in("dim2", ImmutableList.of("abc", "def"), null) ) )) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ), ImmutableList.of( new Object[]{1L} ) ); }
Source:
protected void resizeAvatar(DocumentModel doc, Blob avatarImage) throws PropertyException { ConversionService conversionService = Framework.getService(ConversionService.class); BlobHolder bh = new SimpleBlobHolder(avatarImage); Map<String, Serializable> parameters = new HashMap<>(); parameters.put("targetWidth", String.valueOf(RESIZED_IMAGE_WIDTH)); parameters.put("targetHeight", String.valueOf(RESIZED_IMAGE_HEIGHT)); try { BlobHolder result = conversionService.convert("resizeAvatar", bh, parameters); if (result != null) { Blob res = result.getBlob(); res.setFilename(avatarImage.getFilename()); doc.setPropertyValue(USER_PROFILE_AVATAR_FIELD, (Serializable) result.getBlob()); } } catch (NuxeoException e) { log.warn("Unable to resize avatar image"); log.debug(e, e); } }

Target:
protected void resizeAvatar(DocumentModel doc, Blob avatarImage) throws PropertyException { ConversionService conversionService = Framework.getService(ConversionService.class); BlobHolder bh = new SimpleBlobHolder(avatarImage); Map<String, Serializable> parameters = new HashMap<>(); parameters.put("targetWidth", String.valueOf(RESIZED_IMAGE_WIDTH)); parameters.put("targetHeight", String.valueOf(RESIZED_IMAGE_HEIGHT)); try { BlobHolder result = conversionService.convert("resizeAvatar", bh, parameters); if (result != null) { Blob blob = result.getBlob(); blob.setFilename(avatarImage.getFilename()); doc.setPropertyValue(USER_PROFILE_AVATAR_FIELD, (Serializable) blob); } } catch (NuxeoException e) { log.warn("Unable to resize avatar image"); log.debug(e, e); } }
Source:
public void memberDeparted(InternalDistributedMember theId, boolean crashed, String reason) { try { boolean wasAdmin = getAdminMemberSet().contains(theId); if (wasAdmin) { AdminConsoleDisconnectMessage message = new AdminConsoleDisconnectMessage(); message.setSender(theId); message.setCrashed(crashed); message.setAlertListenerExpected(true); message.setIgnoreAlertListenerRemovalFailure(true); message.setRecipient(localAddress); message.setReason(reason); handleIncomingDMsg(message); } } catch (DistributedSystemDisconnectedException se) { } dm.handleManagerDeparture(theId, crashed, reason, true); }

Target:
public void memberDeparted(InternalDistributedMember theId, boolean crashed, String reason) { try { boolean wasAdmin = getAdminMemberSet().contains(theId); if (wasAdmin) { AdminConsoleDisconnectMessage message = new AdminConsoleDisconnectMessage(); message.setSender(theId); message.setCrashed(crashed); message.setAlertListenerExpected(true); message.setIgnoreAlertListenerRemovalFailure(true); message.setRecipient(localAddress); message.setReason(reason); handleIncomingDMsg(message); } dm.handleManagerDeparture(theId, crashed, reason); } catch (DistributedSystemDisconnectedException se) { } }
Source:
public SnappyDecompressor(int directBufferSize) { try { SnappyLoader.getVersion(); } catch (Throwable t) { LOG.warn("Error loading snappy libraries: " + t); } this.directBufferSize = directBufferSize; compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); }

Target:
public SnappyDecompressor(int directBufferSize) { this.directBufferSize = directBufferSize; compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize); uncompressedDirectBuf.position(directBufferSize); }
Source:
public Contact createOrUpdateContact(Contact contact) throws WebServiceException { try { LOGGER.debug(CREATING + contact.toString()); ByteArrayOutputStream body = JsonUtils.toOutputStream(contact); InputStream response = client.executePost(CONTACTS_ENDPOINT, body, MediaFormat.JSON, MediaFormat.JSON); return (Contact) JsonUtils.toObject(response, CONTACT_TYPE_REF); } catch (RapidProClientException | JsonUtilException e) { LOGGER.error(e.getMessage()); throw new WebServiceException(ERROR_CREATING_OR_UPDATING + contact.toString(), e); } }

Target:
public Contact createOrUpdateContact(Contact contact) throws WebServiceException { InputStream response = null; try { LOGGER.debug(CREATING + contact.toString()); byte[] body = JsonUtils.toByteArray(contact); response = client.executePost(CONTACTS_ENDPOINT, body, MediaFormat.JSON, MediaFormat.JSON); return (Contact) JsonUtils.toObject(response, CONTACT_TYPE_REF); } catch (RapidProClientException | JsonUtilException e) { throw new WebServiceException(ERROR_CREATING_OR_UPDATING + contact.getName(), e); } finally { closeInputStream(response); } }
Source:
private static String toLuceneDate(Date date) { try { SimpleDateFormat df = new SimpleDateFormat(LUCENE_DATE_FORMAT); String returnValue = df.format(date); return returnValue; } catch (Exception ex) { Logger.error(ESContentFactoryImpl.class, ex.toString()); return ERROR_DATE; } }

Target:
private static String toLuceneDate(Date date) { try { String returnValue = LUCENE_DATE_FORMAT.format(date); return returnValue; } catch (Exception ex) { Logger.error(ESContentFactoryImpl.class, ex.toString()); return ERROR_DATE; } }
Source:
public static Slice stLineString(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { if (input.getPositionCount() == 1) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "LineString cannot have one point"); } MultiPath multipath = new Polyline(); for (int i = 0; i < input.getPositionCount(); i++) { Slice slice = input.getSlice(i, 0, input.getSliceLength(i)); validateType("ST_Point", deserialize(slice), EnumSet.of(POINT)); OGCPoint point = (OGCPoint) deserialize(slice); if (i == 0) { multipath.startPath(point.X(), point.Y()); } else { multipath.lineTo(point.X(), point.Y()); } } OGCLineString linestring = new OGCLineString(multipath, 0, null); return serialize(linestring); }

Target:
public static Slice stLineString(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { int addedPoints = 0; MultiPath multipath = new Polyline(); for (int i = 0; i < input.getPositionCount(); i++) { Slice slice = GEOMETRY.getSlice(input, i); if (slice.getInput().available() == 0) { continue; } OGCGeometry geometry = deserialize(slice); if (!(geometry instanceof OGCPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("ST_LineString takes only an array of valid points, %s was passed", geometry.geometryType())); } OGCPoint point = (OGCPoint) geometry; if (point.isEmpty()) { continue; } if (addedPoints == 0) { multipath.startPath(point.X(), point.Y()); } else { multipath.lineTo(point.X(), point.Y()); } addedPoints++; } OGCLineString linestring = new OGCLineString(multipath, 0, null); return serialize(linestring); }
Source:
public void tearDown() throws PatientNotFoundException { List<Encounter> encounters = encounterService.getEncountersByEncounterType(DEFAULT_CONFIG_NAME, MOTECH_ID, createdEncounterType.getName()); for (Encounter encounter : encounters) { encounterService.deleteEncounter(DEFAULT_CONFIG_NAME, encounter.getUuid()); } encounterService.deleteEncounterType(DEFAULT_CONFIG_NAME, createdEncounterType.getUuid()); providerService.deleteProvider(DEFAULT_CONFIG_NAME, createdProvider.getUuid()); patientService.deletePatient(DEFAULT_CONFIG_NAME, createdPatient.getUuid()); Patient patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, String.format("%staskCreated", MOTECH_ID)); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Robert Kowalski"); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Jan Nowak"); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, TEST_MOTECH_ID); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } }

Target:
public void tearDown() throws PatientNotFoundException { List<Encounter> encounters = encounterService.getEncountersByEncounterType(DEFAULT_CONFIG_NAME, MOTECH_ID, createdEncounterType.getName()); for (Encounter encounter : encounters) { encounterService.deleteEncounter(DEFAULT_CONFIG_NAME, encounter.getUuid()); } encounterService.deleteEncounterType(DEFAULT_CONFIG_NAME, createdEncounterType.getUuid()); providerService.deleteProvider(DEFAULT_CONFIG_NAME, createdProvider.getUuid()); patientService.deletePatient(DEFAULT_CONFIG_NAME, createdPatient.getUuid()); Patient patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, String.format("%staskCreated", MOTECH_ID)); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "John Smith"); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Jacob Lee"); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, TEST_MOTECH_ID); if (patient != null) { patientService.deletePatient(DEFAULT_CONFIG_NAME, patient.getUuid()); } }
Source:
public void started(List<String> initialNames) { if(started != null) { this.started = new TranscriptEvent(Instant.now()); this.initialParticipantNames.addAll(initialNames); } }

Target:
public void started(List<String> initialNames) { if(started == null) { this.started = new TranscriptEvent(Instant.now()); this.initialParticipantNames.addAll(initialNames); } }
Source:
public void useDefaultMTU() { Set<ConstraintViolation<MtuContainer>> validate = validate(new MtuContainer(0)); Assert.assertEquals(0, validate.size()); }

Target:
public void useDefaultMTU() { Set<ConstraintViolation<MtuContainer>> validate = validate(new MtuContainer(0)); assertTrue(validate.isEmpty()); }
Source:
void createContext() { BoundedContextBuilder contextBuilder = contextBuilder(); checkNotNull(contextBuilder, "`contextBuilder()` must return a non-null `BoundedContextBuilder`."); context = BlackBoxBoundedContext.from(contextBuilder); }

Target:
protected void createContext() { BoundedContextBuilder contextBuilder = contextBuilder(); checkNotNull(contextBuilder, "`contextBuilder()` must return a non-null `BoundedContextBuilder`."); context = BlackBoxBoundedContext.from(contextBuilder); }
Source:
protected Provider[] loadServices(final Class<Provider> service, final ClassLoader classLoader) { ArrayList<Provider> list = new ArrayList<>(); ServiceLoader<Provider> loader = ServiceLoader.load(service, classLoader); Iterator<Provider> iterator = loader.iterator(); for (;;) try { if (! iterator.hasNext()) { return list.toArray(Arrays2.createArray(service, list.size())); } Provider provider = iterator.next(); if (! INSTALLED_PROVIDERS_SET.contains(provider.getClass())) { list.add(provider); } } catch (ServiceConfigurationError ignored) { } }

Target:
Provider[] loadServices(final Class<Provider> service, final ClassLoader classLoader) { Provider[] providers = INSTALLED_PROVIDERS.get(); Set<Class<?>> installedProvidersSet = new HashSet<>((providers != null ? providers.length : 0) + (elytronProviderStaticallyAdded ? 1 : 0)); if (elytronProviderStaticallyAdded) { installedProvidersSet.add(WildFlyElytronProvider.class); } if (providers != null) { for (int i = 0; i < providers.length; i++) { installedProvidersSet.add(providers[i].getClass()); } } ArrayList<Provider> list = new ArrayList<>(); ServiceLoader<Provider> loader = ServiceLoader.load(service, classLoader); Iterator<Provider> iterator = loader.iterator(); for (;;) try { if (! iterator.hasNext()) { return list.toArray(new Provider[list.size()]); } Provider provider = iterator.next(); if (! installedProvidersSet.contains(provider.getClass())) { list.add(provider); } } catch (ServiceConfigurationError ignored) { } }
Source:
public void fastSyncCleanUp() { byte[] fastsyncStageBytes = blockchainDB().get(FastSyncManager.FASTSYNC_DB_KEY_SYNC_STAGE); if (fastsyncStageBytes == null) return; if (!systemProperties().blocksLoader().isEmpty()) return; EthereumListener.SyncState syncStage = EthereumListener.SyncState.values()[fastsyncStageBytes[0]]; if ((systemProperties().isSyncEnabled() && !systemProperties().isFastSyncEnabled()) || syncStage == EthereumListener.SyncState.UNSECURE) { logger.warn("Last fastsync was interrupted. Removing inconsistent DBs..."); DbSource bcSource = blockchainDB(); resetDataSource(bcSource); } }

Target:
public void fastSyncCleanUp() { if (!systemProperties().isSyncEnabled()) return; byte[] fastsyncStageBytes = blockchainDB().get(FastSyncManager.FASTSYNC_DB_KEY_SYNC_STAGE); if (fastsyncStageBytes == null) return; if (!systemProperties().blocksLoader().isEmpty()) return; EthereumListener.SyncState syncStage = EthereumListener.SyncState.values()[fastsyncStageBytes[0]]; if (!systemProperties().isFastSyncEnabled() || syncStage == EthereumListener.SyncState.UNSECURE) { logger.warn("Last fastsync was interrupted. Removing inconsistent DBs..."); DbSource bcSource = blockchainDB(); resetDataSource(bcSource); } }
Source:
protected boolean validate() { if (getParameters().getSchedule() == null || (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE && StringUtils.isEmpty(getParameters().getSchedule().getCronExpression()))) { return failValidation(EngineMessage.VALIDATION_INVALID_SCHEDULE); } if (getStorageDomainId() == null || getStorageDomain() == null) { return failValidation(EngineMessage.STORAGE_DOMAIN_DOES_NOT_EXIST); } if (getGeoRepSession() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_GEOREP_SESSION_INVALID); } return super.validate(); }

Target:
protected boolean validate() { if (getParameters().getSchedule() == null || (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE && StringUtils.isEmpty(getParameters().getSchedule().toCronExpression()))) { return failValidation(EngineMessage.VALIDATION_INVALID_SCHEDULE); } if (getStorageDomain() == null) { return failValidation(EngineMessage.STORAGE_DOMAIN_DOES_NOT_EXIST); } if (getGeoRepSession() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_GEOREP_SESSION_INVALID); } return super.validate(); }
Source:
public InstanceAdapter insert(SQLiteDatabase db, InstanceAdapter entityAdapter, boolean isSyncAdapter) { TaskAdapter taskResult = mDelegate.insert(db, entityAdapter.taskAdapter(), false); Cursor c = db.query(TaskDatabaseHelper.Tables.INSTANCES, new String[] { TaskContract.Instances._ID }, TaskContract.Instances.TASK_ID + "=" + taskResult.id(), null, null, null, null); try { c.moveToFirst(); return new ContentValuesInstanceAdapter(c.getLong(0), new ContentValues()); } finally { c.close(); } }

Target:
public InstanceAdapter insert(SQLiteDatabase db, InstanceAdapter entityAdapter, boolean isSyncAdapter) { TaskAdapter taskResult = mDelegate.insert(db, entityAdapter.taskAdapter(), false); try (Cursor c = db.query(TaskDatabaseHelper.Tables.INSTANCES, new String[] { TaskContract.Instances._ID }, TaskContract.Instances.TASK_ID + "=" + taskResult.id(), null, null, null, null)) { c.moveToFirst(); return new ContentValuesInstanceAdapter(c.getLong(0), new ContentValues()); } }
Source:
public void testFederateLatencyMetrics() throws Exception { QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, false, null, properties); when(mockResponse.getProperties()).thenReturn(properties); Source mockSource1 = getMockSource(); Source mockSource2 = getMockSource(); Source mockSource3 = getMockSource(); List<Source> sourceList = ImmutableList.of(mockSource1, mockSource2, mockSource3); QueryResponse federateResponse = federateStrategy.federate(sourceList, fedQueryRequest); List<Map.Entry<String, Serializable>> metrics = federateResponse .getProperties() .entrySet() .stream() .filter(entry -> entry.getKey().startsWith("metrics.source.elapsed.")) .collect(Collectors.toList()); assertThat(metrics.size(), is(sourceList.size())); }

Target:
public void testFederateLatencyMetrics() throws Exception { QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, false, null, properties); when(mockResponse.getProperties()).thenReturn(properties); Source mockSource1 = getMockSource(); Source mockSource2 = getMockSource(); Source mockSource3 = getMockSource(); List<Source> sourceList = ImmutableList.of(mockSource1, mockSource2, mockSource3); QueryResponse federateResponse = federateStrategy.federate(sourceList, fedQueryRequest); List<Map.Entry<String, Serializable>> metrics = federateResponse .getProperties() .entrySet() .stream() .filter(entry -> entry.getKey().startsWith(METRICS_SOURCE_ELAPSED_PREFIX)) .collect(Collectors.toList()); assertThat(metrics.size(), is(sourceList.size())); }
Source:
public DefaultTopologyService(long cacheTimeout) { graphProviderCache = CacheBuilder .newBuilder() .expireAfterWrite(Math.max(0, cacheTimeout), TimeUnit.SECONDS) .maximumSize(50) .build(new CacheLoader<GraphProviderKey, GraphProvider>() { @Override public GraphProvider load(GraphProviderKey key) throws Exception { final MetaTopologyProvider metaTopologyProvider = getMetaTopologyProvider(key.getMetaTopologyId()); metaTopologyProvider.reload(key.getNamespace()); return Optional.ofNullable(metaTopologyProvider.getGraphProviderBy(key.getNamespace())) .orElseThrow(() -> new NoSuchElementException("No GraphProvider with namespace '" + key.getNamespace() + "' found.")); } }); }

Target:
public DefaultTopologyService(long cacheTimeout) { graphProviderCache = CacheBuilder .newBuilder() .expireAfterWrite(Math.max(0, cacheTimeout), TimeUnit.SECONDS) .maximumSize(50) .build(new CacheLoader<GraphProviderKey, GraphProvider>() { @Override public GraphProvider load(GraphProviderKey key) throws Exception { final MetaTopologyProvider metaTopologyProvider = getMetaTopologyProvider(key.getMetaTopologyId()); final GraphProvider graphProvider = Optional.ofNullable(metaTopologyProvider.getGraphProviderBy(key.getNamespace())) .orElseThrow(() -> new NoSuchGraphProviderException(key.getMetaTopologyId(), key.getNamespace())); graphProvider.refresh(); return graphProvider; } }); }
Source:
public void linkExposedInfantToMotherViaARTNumber(Person infant, String motherARTNumber) { log.debug("Linking infant with ID " + infant.getPersonId() + " to mother with ART Number " + motherARTNumber); List<Patient> mothers = patientService.getPatients(null, motherARTNumber, Arrays.asList(Context.getPatientService().getPatientIdentifierTypeByUuid(PatientIdentifierTypes.ART_PATIENT_NUMBER.uuid())), true); if (mothers.size() != 0) { Person potentialMother = mothers.get(0).getPerson(); if (potentialMother.getAge() != null && potentialMother.getAge() > 12 & potentialMother.getGender().equals("F")) { Relationship relationship = new Relationship(); relationship.setRelationshipType(personService.getRelationshipTypeByUuid("8d91a210-c2cc-11de-8d13-0010c6dffd0f")); relationship.setPersonA(potentialMother); relationship.setPersonB(infant); personService.saveRelationship(relationship); log.debug("Infant with ID " + infant.getPersonId() + " linked to mother with ID " + potentialMother.getPersonId()); } } }

Target:
public void linkExposedInfantToMotherViaARTNumber(Person infant, String motherARTNumber) { log.debug("Linking infant with ID " + infant.getPersonId() + " to mother with ART Number " + motherARTNumber); List<PatientIdentifierType> artNumberPatientidentifierTypes = new ArrayList<>(); artNumberPatientidentifierTypes.add(Context.getPatientService().getPatientIdentifierTypeByUuid(PatientIdentifierTypes.ART_PATIENT_NUMBER.uuid())); artNumberPatientidentifierTypes.add(Context.getPatientService().getPatientIdentifierTypeByUuid(PatientIdentifierTypes.HIV_CARE_NUMBER.uuid())); List<Patient> mothers = patientService.getPatients(null, motherARTNumber, artNumberPatientidentifierTypes, true); if (mothers.size() != 0) { Person potentialMother = mothers.get(0).getPerson(); if (potentialMother.getAge() != null && potentialMother.getAge() > 12 & potentialMother.getGender().equals("F")) { Relationship relationship = new Relationship(); relationship.setRelationshipType(personService.getRelationshipTypeByUuid("8d91a210-c2cc-11de-8d13-0010c6dffd0f")); relationship.setPersonA(potentialMother); relationship.setPersonB(infant); personService.saveRelationship(relationship); log.debug("Infant with ID " + infant.getPersonId() + " linked to mother with ID " + potentialMother.getPersonId()); } } }
Source:
public Response clear() { try { final IPluginCacheManager iPluginCacheManager = PentahoSystem.get( IPluginCacheManager.class ); final IReportContentCache cache = iPluginCacheManager.getCache(); cache.cleanup(); final ICacheManager cacheManager = PentahoSystem.get( ICacheManager.class ); cacheManager.clearRegionCache( "report-dataset-cache" ); cacheManager.clearRegionCache( "report-output-handlers" ); return Response.ok().build(); } catch ( final Exception e ) { return Response.serverError().build(); } }

Target:
public Response clear() { try { final IPluginCacheManager iPluginCacheManager = PentahoSystem.get( IPluginCacheManager.class ); final IReportContentCache cache = iPluginCacheManager.getCache(); cache.cleanup(); final ICacheManager cacheManager = PentahoSystem.get( ICacheManager.class ); cacheManager.clearRegionCache( "report-dataset-cache" ); cacheManager.clearRegionCache( "report-output-handlers" ); DataCacheFactory.getCache().getCacheManager().clearAll(); return Response.ok().build(); } catch ( final Exception e ) { return Response.serverError().build(); } }
Source:
public void testThreeResourceCyclicImportThrowsException() throws Exception { String xmlWithCyclicImport = createFilesWithCycleImports( createFileWithContent("hz1", "xml", ""), createFileWithContent("hz2", "xml", ""), createFileWithContent("hz3", "xml", "") ); buildConfig(xmlWithCyclicImport, null); }

Target:
public void testThreeResourceCyclicImportThrowsException() throws Exception { String xmlWithCyclicImport = helper.createFilesWithCycleImports( this::xmlContentWithImportResource, helper.givenConfigFileInWorkDir("hz1.xml", "").getAbsolutePath(), helper.givenConfigFileInWorkDir("hz2.xml", "").getAbsolutePath(), helper.givenConfigFileInWorkDir("hz3.xml", "").getAbsolutePath() ); buildConfig(xmlWithCyclicImport, null); }
Source:
public void testDefaultTheme() { SalesforceSDKTestManager.init(getInstrumentation().getTargetContext(), MainActivity.class); Assert.assertFalse(SalesforceSDKTestManager.getInstance().isDarkTheme()); }

Target:
public void testDefaultTheme() { int currentNightMode = getInstrumentation().getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; Boolean isDarkTheme = currentNightMode == Configuration.UI_MODE_NIGHT_YES; SalesforceSDKTestManager.init(getInstrumentation().getTargetContext(), MainActivity.class); Assert.assertEquals("Default theme does not match OS value.", isDarkTheme, SalesforceSDKTestManager.getInstance().isDarkTheme()); }
Source:
private SynchronizationModel resolveModelsWithLocal(IStorageProviderAccessor storageAccessor, IFile left, IStorage right, IStorage origin, IProgressMonitor monitor) throws InterruptedException { resolvedResources = new LinkedHashSet<URI>(); diagnostic = new BasicDiagnostic(); if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet(); updateDependencies(resourceSet, left, monitor); updateChangedResources(resourceSet, monitor); } final Set<IStorage> leftTraversal = resolveTraversal(left, Collections.<URI> emptySet(), storageAccessor, monitor); while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } final Set<IStorage> rightTraversal = resolveRemoteTraversal(storageAccessor, right, leftTraversal, DiffSide.REMOTE, monitor); final Set<IStorage> originTraversal; if (origin != null) { originTraversal = resolveRemoteTraversal(storageAccessor, origin, leftTraversal, DiffSide.ORIGIN, monitor); } else { originTraversal = Collections.emptySet(); } final SynchronizationModel synchronizationModel = new SynchronizationModel(new StorageTraversal( leftTraversal), new StorageTraversal(rightTraversal), new StorageTraversal(originTraversal), diagnostic); diagnostic = null; resolvedResources = null; return synchronizationModel; }

Target:
private SynchronizationModel resolveModelsWithLocal(IStorageProviderAccessor storageAccessor, IFile left, IStorage right, IStorage origin, IProgressMonitor monitor) throws InterruptedException { if (getResolutionScope() != CrossReferenceResolutionScope.SELF) { final SynchronizedResourceSet resourceSet = new SynchronizedResourceSet(); updateDependencies(resourceSet, left, monitor); updateChangedResources(resourceSet, monitor); } final Set<IStorage> leftTraversal = resolveTraversal(left, Collections.<URI> emptySet(), storageAccessor); while (!currentlyResolving.isEmpty()) { resolutionEnd.await(); } final Set<IStorage> rightTraversal = resolveRemoteTraversal(storageAccessor, right, leftTraversal, DiffSide.REMOTE, monitor); final Set<IStorage> originTraversal; if (origin != null) { originTraversal = resolveRemoteTraversal(storageAccessor, origin, leftTraversal, DiffSide.ORIGIN, monitor); } else { originTraversal = Collections.emptySet(); } final SynchronizationModel synchronizationModel = new SynchronizationModel(new StorageTraversal( leftTraversal), new StorageTraversal(rightTraversal), new StorageTraversal(originTraversal), diagnostic); return synchronizationModel; }
Source:
protected boolean isQuerySatisfied(IntermediateResultsBlock resultsBlock) { if (_queryContext.getOrderByExpressions() == null) { List<Object> result = resultsBlock.getAggregationResult(); assert result != null && result.size() == 1 && result.get(0) instanceof DistinctTable; DistinctTable distinctTable = (DistinctTable) result.get(0); return distinctTable.size() >= _queryContext.getLimit(); } else { return false; } }

Target:
protected boolean isQuerySatisfied(IntermediateResultsBlock resultsBlock) { if (_hasOrderBy) { return false; } List<Object> result = resultsBlock.getAggregationResult(); assert result != null && result.size() == 1 && result.get(0) instanceof DistinctTable; DistinctTable distinctTable = (DistinctTable) result.get(0); return distinctTable.size() >= _queryContext.getLimit(); }
Source:
public PlanNode replaceChildren(List<PlanNode> newChildren) { return new SortNode(getId(), Iterables.getOnlyElement(newChildren), orderingScheme, false); }

Target:
public PlanNode replaceChildren(List<PlanNode> newChildren) { return new SortNode(getId(), Iterables.getOnlyElement(newChildren), orderingScheme, isPartial); }
Source:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } try { String fieldOrder = fLayout.fieldOrder(); if (fieldOrder != null) { Long value = event.getContent().getFieldValue(Long.class, fieldOrder); if (value != null) { if (value > MAX_ORDER || value < 0) { Activator.getDefault().logWarning("Order of alloc is outside of acceptable range : " + value); } inc <<= value; } } ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().toNanos(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = OTHER_TID; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError(String.valueOf(e.getMessage()), e); } }

Target:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } try { String fieldOrder = fLayout.fieldOrder(); if (fieldOrder != null) { Long value = event.getContent().getFieldValue(Long.class, fieldOrder); if (value != null) { if (value > MAX_ORDER || value < 0) { Activator.getDefault().logWarning("Order of alloc is outside of acceptable range : " + value); return; } inc <<= value; } } ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().toNanos(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = OTHER_TID; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError(String.valueOf(e.getMessage()), e); } }
Source:
private CloseableResource<BlockWorkerClient> acquireBlockWorkerClientInternal( final WorkerNetAddress workerNetAddress, final ClientContext context) throws IOException { SocketAddress address = NetworkAddressUtils .getDataPortSocketAddress(workerNetAddress, context.getClusterConf()); GrpcServerAddress serverAddress = GrpcServerAddress.create(workerNetAddress.getHost(), address); ClientPoolKey key = new ClientPoolKey(address, AuthenticationUserUtils .getImpersonationUser(context.getSubject(), context.getClusterConf())); return new CloseableResource<BlockWorkerClient>(mBlockWorkerClientPool.computeIfAbsent(key, k -> new BlockWorkerClientPool(context.getSubject(), serverAddress, context.getClusterConf().getInt(PropertyKey.USER_BLOCK_WORKER_CLIENT_POOL_SIZE), context.getClusterConf(), mWorkerGroup)) .acquire()) { ConcurrentHashMap<ClientPoolKey, BlockWorkerClientPool> mPoolMap = mBlockWorkerClientPool; @Override public void close() { releaseBlockWorkerClient(workerNetAddress, get(), context, mPoolMap); } }; }

Target:
private CloseableResource<BlockWorkerClient> acquireBlockWorkerClientInternal( final WorkerNetAddress workerNetAddress, final ClientContext context) throws IOException { SocketAddress address = NetworkAddressUtils .getDataPortSocketAddress(workerNetAddress, context.getClusterConf()); GrpcServerAddress serverAddress = GrpcServerAddress.create(workerNetAddress.getHost(), address); ClientPoolKey key = new ClientPoolKey(address, AuthenticationUserUtils .getImpersonationUser(context.getSubject(), context.getClusterConf())); final ConcurrentHashMap<ClientPoolKey, BlockWorkerClientPool> poolMap = mBlockWorkerClientPool; return new CloseableResource<BlockWorkerClient>(poolMap.computeIfAbsent(key, k -> new BlockWorkerClientPool(context.getSubject(), serverAddress, context.getClusterConf().getInt(PropertyKey.USER_BLOCK_WORKER_CLIENT_POOL_SIZE), context.getClusterConf(), mWorkerGroup)) .acquire()) { @Override public void close() { releaseBlockWorkerClient(workerNetAddress, get(), context, poolMap); } }; }
Source:
private String getTargetOptions(final String path) { if (!Strings.isNullOrEmpty(agentVolumeOptions)) { return path + CONTAINER_TARGET + ":" + agentVolumeOptions; } else { return path + CONTAINER_TARGET; } }

Target:
private String getTargetOptions(final String path) { return path + CONTAINER_TARGET + agentVolumeOptions; }