auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private <M> OperatorImpl<M, ?> createOperatorImpl(OperatorSpec operatorSpec, Config config, TaskContext context) { if (operatorSpec instanceof StreamOperatorSpec) { StreamOperatorSpec<M, ?> streamOpSpec = (StreamOperatorSpec<M, ?>) operatorSpec; return new StreamOperatorImpl<>(streamOpSpec, config, context); } else if (operatorSpec instanceof SinkOperatorSpec) { return new SinkOperatorImpl<>((SinkOperatorSpec<M>) operatorSpec, config, context); } else if (operatorSpec instanceof WindowOperatorSpec) { return new WindowOperatorImpl((WindowOperatorSpec<M, ?, ?>) operatorSpec, clock); } else if (operatorSpec instanceof PartialJoinOperatorSpec) { return new PartialJoinOperatorImpl<>((PartialJoinOperatorSpec) operatorSpec, config, context, clock); } throw new IllegalArgumentException( String.format("Unsupported OperatorSpec: %s", operatorSpec.getClass().getName())); }

Target:
private <M> OperatorImpl<M, ?> createOperatorImpl(OperatorSpec operatorSpec, Config config, TaskContext context) { if (operatorSpec instanceof StreamOperatorSpec) { return new StreamOperatorImpl<>((StreamOperatorSpec<M, ?>) operatorSpec, config, context); } else if (operatorSpec instanceof SinkOperatorSpec) { return new SinkOperatorImpl<>((SinkOperatorSpec<M>) operatorSpec, config, context); } else if (operatorSpec instanceof WindowOperatorSpec) { return new WindowOperatorImpl((WindowOperatorSpec<M, ?, ?>) operatorSpec, clock); } else if (operatorSpec instanceof PartialJoinOperatorSpec) { return new PartialJoinOperatorImpl<>((PartialJoinOperatorSpec) operatorSpec, config, context, clock); } throw new IllegalArgumentException( String.format("Unsupported OperatorSpec: %s", operatorSpec.getClass().getName())); }
Source:
public void availableExternalIdIsAssigned() { Account account = createAccount("healthCode"); ExternalIdentifier externalId = setupExternalIdentifier(account, "AAA"); dao.commitAssignExternalId(externalId); Optional<ExternalIdentifier> optionalId = dao.getExternalId(studyId, "AAA"); assertEquals("AAA", optionalId.get().getIdentifier()); assertEquals("healthCode", optionalId.get().getHealthCode()); assertEquals(studyId.getIdentifier(), optionalId.get().getStudyId()); }

Target:
public void availableExternalIdIsAssigned() { Account account = createAccount("healthCode"); ExternalIdentifier externalId = setupExternalIdentifier(account, "AAA"); dao.commitAssignExternalId(externalId); externalId = dao.getExternalId(studyId, "AAA").get(); assertEquals("AAA", externalId.getIdentifier()); assertEquals("healthCode", externalId.getHealthCode()); assertEquals(studyId.getIdentifier(), externalId.getStudyId()); }
Source:
public Transfer commitTransfer(String transactionId) throws CoinbaseException, IOException { URL commitUrl; try { commitUrl = new URL(_baseApiUrl, "transfers/" + transactionId + "/commit"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } return post(commitUrl, null, TransferResponse.class).getTransfer(); }

Target:
public Transfer commitTransfer(String transactionId) throws CoinbaseException, IOException { URL commitUrl; try { commitUrl = new URL(_baseApiUrl, "transfers/" + transactionId + "/commit"); } catch (MalformedURLException ex) { throw new CoinbaseException("Invalid transaction id"); } return post(commitUrl, null, TransferResponse.class).getTransfer(); }
Source:
public void parsesResponseMissingLength() throws IOException, InterruptedException { server.enqueue(new MockResponse().setChunkedBody("foo", 1)); TestInterface api = Feign.builder() .client(new ApacheHttpClient()) .target(TestInterface.class, "http://localhost:" + server.getPort()); Response response = api.post("testing"); try { assertThat(response.status()).isEqualTo(200); assertThat(response.reason()).isEqualTo("OK"); assertThat(response.body().length()).isNull(); assertThat(response.body().asInputStream()) .hasContentEqualTo(new ByteArrayInputStream("foo".getBytes(UTF_8))); } finally { response.close(); } }

Target:
public void parsesResponseMissingLength() throws IOException, InterruptedException { server.enqueue(new MockResponse().setChunkedBody("foo", 1)); TestInterface api = Feign.builder() .client(new ApacheHttpClient()) .target(TestInterface.class, "http://localhost:" + server.getPort()); Response response = api.post("testing"); assertThat(response.status()).isEqualTo(200); assertThat(response.reason()).isEqualTo("OK"); assertThat(response.body().length()).isNull(); assertThat(response.body().asInputStream()) .hasContentEqualTo(new ByteArrayInputStream("foo".getBytes(UTF_8))); }
Source:
public void rethrowsExceptionWithoutRetryAfterWhenLimitExceeded() { assertThatThrownBy(() -> { for (int i = 0; i < FAILOVERS; i++) { target.url(); target.continueOrPropagate(EXCEPTION_WITHOUT_RETRY_AFTER); } }).isEqualTo(EXCEPTION_WITHOUT_RETRY_AFTER); }

Target:
public void rethrowsExceptionWithoutRetryAfterWhenLimitExceeded() { assertThatThrownBy(() -> { for (int i = 0; i < FAILOVERS; i++) { simulateRequest(); target.continueOrPropagate(EXCEPTION_WITHOUT_RETRY_AFTER); } }).isEqualTo(EXCEPTION_WITHOUT_RETRY_AFTER); }
Source:
public static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) { PaperLib.getChunkAtAsync(world, x, z); return y > world.getMaxHeight() || HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType()); }

Target:
public static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) { return y > world.getMaxHeight() || HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType()); }
Source:
public RouterSecurityManager(Configuration conf) throws IOException { AuthenticationMethod authMethodConfigured = SecurityUtil.getAuthenticationMethod(conf); AuthenticationMethod authMethodToInit = AuthenticationMethod.KERBEROS; if (authMethodConfigured.equals(authMethodToInit)) { this.dtSecretManager = FederationUtil.newSecretManager(conf); if (this.dtSecretManager == null || this.dtSecretManager.isRunning() == false) { throw new IOException("Failed to create SecretManager"); } } }

Target:
public RouterSecurityManager(Configuration conf) throws IOException { AuthenticationMethod authMethodConfigured = SecurityUtil.getAuthenticationMethod(conf); AuthenticationMethod authMethodToInit = AuthenticationMethod.KERBEROS; if (authMethodConfigured.equals(authMethodToInit)) { this.dtSecretManager = FederationUtil.newSecretManager(conf); if (this.dtSecretManager == null || !this.dtSecretManager.isRunning()) { throw new IOException("Failed to create SecretManager"); } } }
Source:
private void tryFlushLogs() { if (loggingPermissionSupplier.getAsBoolean()) { Optional<ActionProfile> actionProfile = slowestOperation.getAndSet(Optional.empty()); if (actionProfile.isPresent()) { ActionProfile presentActionProfile = actionProfile.get(); logger.info("Call to TimeLockService#{} took {}. This was the slowest operation that completed" + " in the last {}. The operation completed with outcome - if it failed, the error" + " was {}. We include a stack trace of the call: {}", SafeArg.of("actionName", presentActionProfile.actionName()), SafeArg.of("duration", presentActionProfile.duration()), SafeArg.of("timeWindow", LOGGING_TIME_WINDOW), SafeArg.of("outcome", presentActionProfile.failure().isPresent() ? "fail" : "success"), UnsafeArg.of("failure", presentActionProfile.failure()), SafeArg.of("stacktrace", new RuntimeException().getStackTrace())); } } }

Target:
private void tryFlushLogs() { if (loggingPermissionSupplier.getAsBoolean()) { Optional<ActionProfile> actionProfile = slowestOperation.getAndSet(Optional.empty()); if (actionProfile.isPresent()) { ActionProfile presentActionProfile = actionProfile.get(); logger.info("Call to TimeLockService#{} took {}. This was the slowest operation that completed" + " in the last {}. The operation completed with outcome - if it failed, the error" + " was {}.", SafeArg.of("actionName", presentActionProfile.actionName()), SafeArg.of("duration", presentActionProfile.duration()), SafeArg.of("timeWindow", LOGGING_TIME_WINDOW), SafeArg.of("outcome", presentActionProfile.failure().isPresent() ? "fail" : "success"), UnsafeArg.of("failure", presentActionProfile.failure())); } } }
Source:
public Collection<ExternalVnicProfileMapping> cloneExternalVnicProfiles(Cluster cluster) { if (externalVnicProfilesPerTargetCluster.get(cluster) == null) { return new ArrayList<>(); } final Collection<ExternalVnicProfileMapping> result = new ArrayList<>(externalVnicProfilesPerTargetCluster.get(cluster).size()); externalVnicProfilesPerTargetCluster.get(cluster).stream().forEach( vnicProfileMappingEntity -> result.add(vnicProfileMappingEntity.getExternalVnicProfileMapping())); return result; }

Target:
public Collection<ExternalVnicProfileMapping> cloneExternalVnicProfiles(Cluster cluster) { if (externalVnicProfilesPerTargetCluster.get(cluster) == null) { return Collections.emptyList(); } return externalVnicProfilesPerTargetCluster.get(cluster).stream() .map(VnicProfileMappingEntity::getExternalVnicProfileMapping) .collect(Collectors.toList()); }
Source:
private IdentityCache createIdentityCache(HttpServerRequest request) { SSLSession sslSession = request.getSSLSession(); if (sslSession == null) { return null; } return new IdentityCache() { @Override public void put(SecurityIdentity identity) { sslSession.putValue(CACHED_IDENTITY_KEY, new CachedIdentity(getMechanismName(), identity)); } @Override public CachedIdentity get() { return (CachedIdentity) sslSession.getValue(CACHED_IDENTITY_KEY); } @Override public CachedIdentity remove() { CachedIdentity cachedIdentity = get(); sslSession.removeValue(CACHED_IDENTITY_KEY); return cachedIdentity; } }; }

Target:
private Function<SecurityDomain, IdentityCache> createIdentityCache(HttpServerRequest request) { SSLSession sslSession = request.getSSLSession(); if (sslSession == null) { return null; } return securityDomain -> new IdentityCache() { final Map<SecurityDomain, CachedIdentity> identities = SSLUtils.computeIfAbsent(sslSession, "org.wildfly.elytron.identity-cache", key -> new ConcurrentHashMap<>()); @Override public void put(SecurityIdentity identity) { identities.putIfAbsent(securityDomain, new CachedIdentity(getMechanismName(), identity)); } @Override public CachedIdentity get() { return identities.get(securityDomain); } @Override public CachedIdentity remove() { return identities.remove(securityDomain); } }; }
Source:
public List<Column> getColumns() { List<Column> columns = super.getColumns(); if (canInitAward() || !canViewInvoiceLink()) { LOG.debug("getColumns, remove invoices column"); for (Iterator<Column> it = columns.iterator(); it.hasNext(); ) { Column column = it.next(); if (StringUtils.equalsAnyIgnoreCase(column.getPropertyName(), INVOICE_LINK_COLUMN_NAME)) { it.remove(); } } } return columns; }

Target:
public List<Column> getColumns() { List<Column> columns = super.getColumns(); if (canInitAward() || !canViewInvoiceLink() || !getAccountsReceivableModuleBillingService().isContractsGrantsBillingEnhancementActive()) { LOG.debug("getColumns, remove invoices column"); for (Iterator<Column> it = columns.iterator(); it.hasNext(); ) { Column column = it.next(); if (StringUtils.equalsIgnoreCase(column.getPropertyName(), INVOICE_LINK_COLUMN_NAME)) { it.remove(); } } } return columns; }
Source:
public VersionNumber getMinimumJavaVersion() throws IOException { String manifestEntry = getManifestAttributes().getValue("Minimum-Java-Version"); if (StringUtils.isNotBlank(manifestEntry)) { return new VersionNumber(manifestEntry); } return JavaVersionUtil.interpolateJavaVersionByCore(new VersionNumber(getRequiredJenkinsVersion())); }

Target:
public JavaSpecificationVersion getMinimumJavaVersion() throws IOException { String manifestEntry = getManifestAttributes().getValue("Minimum-Java-Version"); if (StringUtils.isNotBlank(manifestEntry)) { return new JavaSpecificationVersion(manifestEntry); } return null; }
Source:
public DiffPreferencesInfo apply(AccountResource rsrc, Input input) throws AuthException, OrmException { if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { throw new AuthException("restricted to administrator"); } if (input == null) { input = new Input(); } AccountDiffPreference p = rsrc.getUser().getAccountDiffPreference(); p.setContext(input.context); p.setExpandAllComments(input.expandAllComments); p.setIgnoreWhitespace(Objects.firstNonNull(input.ignoreWhitespace, AccountDiffPreference.DEFAULT_IGNORE_WHITESPACE)); p.setIntralineDifference(input.intralineDifference); p.setLineLength(input.lineLength); p.setManualReview(input.manualReview); p.setRetainHeader(input.retainHeader); p.setShowLineEndings(input.showLineEndings); p.setShowTabs(input.showTabs); p.setShowWhitespaceErrors(input.showWhitespaceErrors); p.setSkipDeleted(input.skipDeleted); p.setSkipUncommented(input.skipUncommented); p.setSyntaxHighlighting(input.syntaxHighlighting); p.setTabSize(input.tabSize); db.accountDiffPreferences().upsert(Collections.singleton(p)); return DiffPreferencesInfo.parse(p); }

Target:
public DiffPreferencesInfo apply(AccountResource rsrc, Input input) throws AuthException, OrmException { if (self.get() != rsrc.getUser() && !self.get().getCapabilities().canAdministrateServer()) { throw new AuthException("restricted to administrator"); } if (input == null) { input = new Input(); } Account.Id accountId = rsrc.getUser().getAccountId(); AccountDiffPreference p; db.accounts().beginTransaction(accountId); try { p = db.accountDiffPreferences().get(accountId); if (p == null) { p = new AccountDiffPreference(accountId); } if (input.context != null) { p.setContext(input.context); } if (input.ignoreWhitespace != null) { p.setIgnoreWhitespace(input.ignoreWhitespace); } if (input.expandAllComments != null) { p.setExpandAllComments(input.expandAllComments); } if (input.intralineDifference != null) { p.setIntralineDifference(input.intralineDifference); } if (input.lineLength != null) { p.setLineLength(input.lineLength); } if (input.manualReview != null) { p.setManualReview(input.manualReview); } if (input.retainHeader != null) { p.setRetainHeader(input.retainHeader); } if (input.showLineEndings != null) { p.setShowLineEndings(input.showLineEndings); } if (input.showTabs != null) { p.setShowTabs(input.showTabs); } if (input.showWhitespaceErrors != null) { p.setShowWhitespaceErrors(input.showWhitespaceErrors); } if (input.skipDeleted != null) { p.setSkipDeleted(input.skipDeleted); } if (input.skipUncommented != null) { p.setSkipUncommented(input.skipUncommented); } if (input.syntaxHighlighting != null) { p.setSyntaxHighlighting(input.syntaxHighlighting); } if (input.tabSize != null) { p.setTabSize(input.tabSize); } db.accountDiffPreferences().upsert(Collections.singleton(p)); db.commit(); } finally { db.rollback(); } return DiffPreferencesInfo.parse(p); }
Source:
private void overwriteLibrary(final List<SAMReadGroupRecord> readGroups, final String libraryName) { for (final SAMReadGroupRecord rg : readGroups) { rg.setLibrary(libraryName); } }

Target:
private void overwriteLibrary(final List<SAMReadGroupRecord> readGroups, final String libraryName) { readGroups.forEach(rg -> rg.setLibrary(libraryName)); }
Source:
public void generateSchema(PersistenceUnitInfo info, Map map) { }

Target:
public void generateSchema(PersistenceUnitInfo info, Map map) { throw new UnsupportedOperationException("generateSchema"); }
Source:
public void onCreate() { super.onCreate(); Realm.init(this); Realm.setDefaultConfiguration(new RealmConfiguration.Builder() .deleteRealmIfMigrationNeeded() .initialData(new Realm.Transaction() { @Override public void execute(@NonNull Realm realm) { Person person = realm.createObject(Person.class); person.setName("Makoto Yamazaki"); person.setAge(29); person = realm.createObject(Person.class); person.setName("Christian Melchior"); person.setAge(32); person = realm.createObject(Person.class); person.setName("Chen Mulong"); person.setAge(26); person = realm.createObject(Person.class); person.setName("Nabil Hachicha"); person.setAge(28); } }) .build()); }

Target:
public void onCreate() { super.onCreate(); Realm.init(this); Realm.setDefaultConfiguration(new RealmConfiguration.Builder() .deleteRealmIfMigrationNeeded() .initialData(new Realm.Transaction() { @Override public void execute(@NonNull Realm realm) { Person person = realm.createObject(Person.class); person.setName("Makoto Yamazaki"); person.setAge(32); person = realm.createObject(Person.class); person.setName("Christian Melchior"); person.setAge(34); person = realm.createObject(Person.class); person.setName("Chen Mulong"); person.setAge(29); person = realm.createObject(Person.class); person.setName("Nabil Hachicha"); person.setAge(31); } }) .build()); }
Source:
private void onTagsChanged(ListChangeListener.Change<? extends T> change) { while (change.next()) { if (change.wasRemoved()) { tagList.getChildren().subList(change.getFrom(), change.getFrom() + change.getRemovedSize()).clear(); if(!allowsMultiple) { inputTextField.setDisable(false);} } else if (change.wasAdded()) { tagList.getChildren().addAll(change.getFrom(), change.getAddedSubList().stream().map(this::createTag).collect(Collectors.toList())); if(!allowsMultiple) { inputTextField.setDisable(true);} } } }

Target:
private void onTagsChanged(ListChangeListener.Change<? extends T> change) { while (change.next()) { if (change.wasRemoved()) { tagList.getChildren().subList(change.getFrom(), change.getFrom() + change.getRemovedSize()).clear(); } else if (change.wasAdded()) { tagList.getChildren().addAll(change.getFrom(), change.getAddedSubList().stream().map(this::createTag).collect(Collectors.toList())); } } if (this.properties.contains(FieldProperty.SINGLE_ENTRY_LINK)) { inputTextField.setDisable(!tags.isEmpty()); } }
Source:
public Set<Integer> clearRegionLocal(RegionEventImpl regionEvent) { Set<Integer> clearedBuckets = new HashSet<>(); setMembershipChange(false); synchronized (lockForListenerAndClientNotification) { if (partitionedRegion.getDataStore() != null) { partitionedRegion.getDataStore().lockBucketCreationForRegionClear(); try { boolean retry; do { waitForPrimary(new PartitionedRegion.RetryTimeKeeper(retryTime)); RegionEventImpl bucketRegionEvent; for (BucketRegion localPrimaryBucketRegion : partitionedRegion.getDataStore() .getAllLocalPrimaryBucketRegions()) { if (localPrimaryBucketRegion.size() > 0) { bucketRegionEvent = new RegionEventImpl(localPrimaryBucketRegion, Operation.REGION_CLEAR, null, false, partitionedRegion.getMyId(), regionEvent.getEventId()); localPrimaryBucketRegion.cmnClearRegion(bucketRegionEvent, false, true); } clearedBuckets.add(localPrimaryBucketRegion.getId()); } if (getMembershipChange()) { setMembershipChange(false); retry = true; } else { retry = false; } } while (retry); doAfterClear(regionEvent); } finally { partitionedRegion.getDataStore().unlockBucketCreationForRegionClear(); } } else { doAfterClear(regionEvent); } } incClearCount(); return clearedBuckets; }

Target:
public Set<Integer> clearRegionLocal(RegionEventImpl regionEvent) { Set<Integer> clearedBuckets = new HashSet<>(); long clearStartTime = System.nanoTime(); setMembershipChange(false); synchronized (lockForListenerAndClientNotification) { if (partitionedRegion.getDataStore() != null) { partitionedRegion.getDataStore().lockBucketCreationForRegionClear(); try { boolean retry; do { waitForPrimary(new PartitionedRegion.RetryTimeKeeper(retryTime)); RegionEventImpl bucketRegionEvent; for (BucketRegion localPrimaryBucketRegion : partitionedRegion.getDataStore() .getAllLocalPrimaryBucketRegions()) { if (localPrimaryBucketRegion.size() > 0) { bucketRegionEvent = new RegionEventImpl(localPrimaryBucketRegion, Operation.REGION_CLEAR, null, false, partitionedRegion.getMyId(), regionEvent.getEventId()); localPrimaryBucketRegion.cmnClearRegion(bucketRegionEvent, false, true); } clearedBuckets.add(localPrimaryBucketRegion.getId()); } if (getMembershipChange()) { setMembershipChange(false); retry = true; } else { retry = false; } } while (retry); doAfterClear(regionEvent); } finally { partitionedRegion.getDataStore().unlockBucketCreationForRegionClear(); if (clearedBuckets.size() != 0 && partitionedRegion.getCachePerfStats() != null) { partitionedRegion.getRegionCachePerfStats().incRegionClearCount(); partitionedRegion.getRegionCachePerfStats() .incPartitionedRegionClearLocalDuration(System.nanoTime() - clearStartTime); } } } else { doAfterClear(regionEvent); } } return clearedBuckets; }
Source:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { setSite(site); internalInit(site.getWorkbenchWindow(), site, input); fActivationListener = new ActivationListener(site.getWorkbenchWindow().getPartService()); fMacroContext = site.getService(EMacroContext.class); if (fMacroContext != null) { fMacroContext.addMacroContextListener(this); if (fMacroContext.isRecording() || fMacroContext.isPlayingBack()) { this.macroStateChanged(fMacroContext); } } }

Target:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { setSite(site); internalInit(site.getWorkbenchWindow(), site, input); fActivationListener = new ActivationListener(site.getWorkbenchWindow().getPartService()); fMacroContext = site.getService(EMacroContextService.class); if (fMacroContext != null) { fMacroContextListener = new MacroContextListener(); fMacroContext.addMacroContextListener(fMacroContextListener); if (fMacroContext.isRecording() || fMacroContext.isPlayingBack()) { this.fMacroContextListener.macroStateChanged(fMacroContext); } } }
Source:
public void testColorButtonBoolean() throws NoSuchFieldException, IllegalAccessException { selectTool(ToolType.ERASER); EraserTool eraserTool = (EraserTool) PaintroidApplication.currentTool; boolean eraserSelected = getToolMemberColorButton(eraserTool).getDrawSelectedColor(); assertEquals("Value should be false", false, eraserSelected); }

Target:
public void testColorButtonBoolean() throws NoSuchFieldException, IllegalAccessException { selectTool(ToolType.ERASER); EraserTool eraserTool = (EraserTool) PaintroidApplication.currentTool; boolean eraserSelected = getToolMemberColorButton(eraserTool).getDrawSelectedColor(); assertFalse("Value should be false", eraserSelected); }
Source:
private EmailJobErrorHandler getEmailJobErrorHandler() { for (JobErrorHandler jobErrorHandler : ServiceLoader.load(JobErrorHandler.class)) { if (null != jobErrorHandler && jobErrorHandler instanceof EmailJobErrorHandler) { return (EmailJobErrorHandler) jobErrorHandler; } } return new EmailJobErrorHandler(); }

Target:
private EmailJobErrorHandler getEmailJobErrorHandler() { for (JobErrorHandler each : ServiceLoader.load(JobErrorHandler.class)) { if (null != each && each instanceof EmailJobErrorHandler) { return (EmailJobErrorHandler) each; } } return new EmailJobErrorHandler(); }
Source:
public void deleteTimeline(final UUID id) { jdbcTemplate.update( "DELETE FROM zn_data.timeline WHERE tl_id=?", new Object[]{id}); }

Target:
public void deleteTimeline(final UUID id) { jdbcTemplate.update("DELETE FROM zn_data.timeline WHERE tl_id=?", id); }
Source:
public Response end(Action action) { return doAction(VdcActionType.EndExternalJob, new EndExternalJobParameters(guid, JobMapper.map(action.getStatus()), action.isForce()), action); }

Target:
public Response end(Action action) { validateParameters(action, "status"); return doAction(VdcActionType.EndExternalJob, new EndExternalJobParameters(guid, JobMapper.map(action.getStatus(), null), action.isSetForce() ? action.isForce() : false), action); }
Source:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); if (hasTaskHandlers()) { getCurrentTaskHandler().endSuccessfully(); getParameters().incrementExecutionIndex(); if (getExecutionIndex() < getTaskHandlers().size()) { _actionState = CommandActionState.EXECUTE; execute(); } } else { endSuccessfully(); CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); if (cmdEntity != null) { cmdEntity.setCallbackNotified(true); } } }

Target:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); if (hasTaskHandlers()) { getCurrentTaskHandler().endSuccessfully(); getParameters().incrementExecutionIndex(); if (getExecutionIndex() < getTaskHandlers().size()) { _actionState = CommandActionState.EXECUTE; execute(); } } else { endSuccessfully(); } }
Source:
public IntervalLiteral(String value, Sign sign, IntervalField startField, @Nullable IntervalField endField) { checkNotNull(value, "value is null"); checkNotNull(sign, "sign is null"); checkNotNull(startField, "startField is null"); this.value = value; this.sign = sign; this.startField = startField; this.endField = endField; }

Target:
public IntervalLiteral(String value, Sign sign, IntervalField startField, @Nullable IntervalField endField) { this.value = value; this.sign = sign; this.startField = startField; this.endField = endField; }
Source:
public Response getAllLookupsStatus( @QueryParam("detailed") boolean detailed ) { try { Map<String, Map<String, LookupExtractorFactoryMapContainer>> configuredLookups = lookupCoordinatorManager.getKnownLookups(); if (configuredLookups == null) { return Response.status(Response.Status.NOT_FOUND) .entity("No lookups found") .build(); } Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>> lookupsStateOnNodes = lookupCoordinatorManager.getLastKnownLookupsStateOnNodes(); Map<String, Map<String, LookupStatus>> result = new HashMap<>(); for (Map.Entry<String, Map<String, LookupExtractorFactoryMapContainer>> tierEntry : configuredLookups.entrySet()) { String tier = tierEntry.getKey(); Map<String, LookupStatus> lookupStatusMap = new HashMap<>(); result.put(tier, lookupStatusMap); Collection<HostAndPort> hosts = lookupCoordinatorManager.discoverNodesInTier(tier); for (Map.Entry<String, LookupExtractorFactoryMapContainer> lookupsEntry : tierEntry.getValue().entrySet()) { lookupStatusMap.put( lookupsEntry.getKey(), getLookupStatus( lookupsEntry.getKey(), lookupsEntry.getValue(), hosts, lookupsStateOnNodes, detailed ) ); } } return Response.ok(result).build(); } catch (Exception ex) { LOG.error(ex, "Error getting lookups status"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(ex)).build(); } }

Target:
public Response getAllLookupsStatus( @QueryParam("detailed") boolean detailed ) { try { Map<String, Map<String, LookupExtractorFactoryMapContainer>> configuredLookups = lookupCoordinatorManager.getKnownLookups(); if (configuredLookups == null) { return Response.status(Response.Status.NOT_FOUND) .entity(ServletResourceUtils.jsonize("No lookups found")) .build(); } Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>> lookupsStateOnNodes = lookupCoordinatorManager.getLastKnownLookupsStateOnNodes(); Map<String, Map<String, LookupStatus>> result = new HashMap<>(); for (Map.Entry<String, Map<String, LookupExtractorFactoryMapContainer>> tierEntry : configuredLookups.entrySet()) { String tier = tierEntry.getKey(); Map<String, LookupStatus> lookupStatusMap = new HashMap<>(); result.put(tier, lookupStatusMap); Collection<HostAndPort> hosts = lookupCoordinatorManager.discoverNodesInTier(tier); for (Map.Entry<String, LookupExtractorFactoryMapContainer> lookupsEntry : tierEntry.getValue().entrySet()) { lookupStatusMap.put( lookupsEntry.getKey(), getLookupStatus( lookupsEntry.getKey(), lookupsEntry.getValue(), hosts, lookupsStateOnNodes, detailed ) ); } } return Response.ok(result).build(); } catch (Exception ex) { LOG.error(ex, "Error getting lookups status"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(ex)).build(); } }
Source:
public static String reconcilePath(String originalPath ) { int len = originalPath.length(); int len1 = len - 1; int j = 0; boolean noSepBefore = true; char[] ein = new char[len]; char[] aus = new char[len + 1]; originalPath.getChars(0, len, ein, 0); char separatorChar = File.separatorChar; if (UNCPathConverter.isUNC(originalPath)) { if ((len < 2) || ((ein[0] != BSLASH) && (ein[0] != SLASH)) || ((ein[1] != BSLASH) && (ein[1] != SLASH)) || ((ein[0] != ein[1]))) { assert false : "Unknown UNC path format"; } separatorChar = ein[0]; aus[j++] = separatorChar; } for (int i= 0; i < len; i++) { char c = ein[i]; switch (c) { case QUOTE: noSepBefore = true; break; case SLASH: case BSLASH: if (noSepBefore) { noSepBefore = false; aus[j++] = separatorChar; } break; case DOT: if (noSepBefore && j > 0) { aus[j++] = c; } else { if (i < len1) { c = ein[i + 1]; if (c == SLASH || c == BSLASH) { i++; noSepBefore = false; } else { i++; noSepBefore = true; aus[j++] = DOT; aus[j++] = c; } } } break; default: noSepBefore = true; aus[j++] = c; } } return new String(aus, 0, j); }

Target:
public static String reconcilePath(String originalPath ) { int len = originalPath.length(); int len1 = len - 1; int j = 0; boolean noSepBefore = true; char[] ein = new char[len]; char[] aus = new char[len + 1]; originalPath.getChars(0, len, ein, 0); char separatorChar = File.separatorChar; if (UNCPathConverter.isUNC(originalPath)) { Assert.isTrue(len >= 2, "Unknown UNC path format"); Assert.isTrue(ein[0] == ein[1], "Unknown UNC path format"); Assert.isTrue(ein[0] == BSLASH || ein[0] == SLASH, "Unknown UNC path format"); separatorChar = ein[0]; aus[j++] = separatorChar; } for (int i= 0; i < len; i++) { char c = ein[i]; switch (c) { case QUOTE: noSepBefore = true; break; case SLASH: case BSLASH: if (noSepBefore) { noSepBefore = false; aus[j++] = separatorChar; } break; case DOT: if (noSepBefore && j > 0) { aus[j++] = c; } else { if (i < len1) { c = ein[i + 1]; if (c == SLASH || c == BSLASH) { i++; noSepBefore = false; } else { i++; noSepBefore = true; aus[j++] = DOT; aus[j++] = c; } } } break; default: noSepBefore = true; aus[j++] = c; } } return new String(aus, 0, j); }
Source:
public Int32Token sdiv(BitVector<Integer> bitVector) { if (!(bitVector.value == 0 || (value == Integer.MIN_VALUE && bitVector.value == -1))) { return Int32Token.of(value / bitVector.value); } else { return null; } }

Target:
public BuiltinList sdiv(BitVector<Integer> bitVector) { if (bitVector.value != 0) { return makeBuiltinListOfOverflowArithmeticResult(Ints.checkedDiv(value, bitVector.value)); } else { return null; } }
Source:
private String getImageOverlay(Match match) { return "full/ovr16/match_ov.png"; }

Target:
private String getImageOverlay(Match match) { return "full/ovr16/match_ov"; }
Source:
public void removesGistByName() throws Exception { final Gists gists = gists(); final Gist gist = gists.create( Collections.singletonList("fileName.txt") ); MatcherAssert.assertThat( gists.iterate(), Matchers.hasItem( gist ) ); gists.remove(GIST_NAME); MatcherAssert.assertThat( gists.iterate(), Matchers.not(Matchers.hasItem(gist)) ); }

Target:
public void removesGistByName() throws Exception { final Gists gists = gists(); final Gist gist = gists.create( Collections.singletonMap("fileName.txt", "content of test file") ); MatcherAssert.assertThat( gists.iterate(), Matchers.notNullValue() ); gists.remove(gist.json().getString("id")); MatcherAssert.assertThat( gists.iterate(), Matchers.not(Matchers.hasItem(gist)) ); }
Source:
protected VersioningOption getVersioningOption() { return options.getOrDefault(version, VersioningOption.MINOR); }

Target:
protected VersioningOption getVersioningOption() { return options.getOrDefault(version.toLowerCase(Locale.ENGLISH), VersioningOption.MINOR); }
Source:
public void setIsByReference(boolean value) { assertNotFrozen(); if (value) { fDeclarator.addPointerOperator(CPPNodeFactory.getDefault().newReferenceOperator(false)); } else if (!value && isByReference()) { ((CPPASTDeclarator) fDeclarator).removePointerOperator(fDeclarator.getPointerOperators()[0]); } }

Target:
public void setIsByReference(boolean value) { assertNotFrozen(); boolean isReferenceCapture = isByReference(); if (value && !isReferenceCapture) { fDeclarator.addPointerOperator(CPPNodeFactory.getDefault().newReferenceOperator(false)); } else if (!value && isReferenceCapture) { ((CPPASTDeclarator) fDeclarator).removePointerOperator(fDeclarator.getPointerOperators()[0]); } }
Source:
public static String processResourceName(String uri) { String processedUri = ""; String[] split = uri.replaceAll("\\{", "").replaceAll("\\}", "") .split("/"); for (String str : split) { processedUri += StringUtils.firstUpper(str); } return processedUri; }

Target:
public static String processResourceName(String uri) { StringBuilder sb = new StringBuilder(); String[] split = uri.replaceAll("\\{", "").replaceAll("\\}", "") .split("/"); for (String str : split) { sb.append(StringUtils.firstUpper(str)); } return sb.toString(); }
Source:
public void testBeta() throws Exception { for (final double a : Arrays.asList(10, 20, 30)) { for (final double b : Arrays.asList(10, 20, 30)) { final double theoreticalMean = a / (a + b); final double theoreticalVariance = a*b/((a+b)*(a+b)*(a+b+1)); final double standardDeviationOfMean = Math.sqrt(theoreticalVariance / NUM_SAMPLES); final GibbsSampler<DoubleState, EmptyData> sampler = betaGibbsSampler(a, b); sampler.runMCMC(); List<Double> samples = sampler.getSamples(DoubleState.PARAMETER_NAME, Double.class, NUM_BURN_IN_STEPS); final double sampleMean = samples.stream().mapToDouble(x -> x).average().getAsDouble(); Assert.assertEquals(sampleMean, theoreticalMean, 10*standardDeviationOfMean); } } }

Target:
public void testBeta() { for (final double a : Arrays.asList(10, 20, 30)) { for (final double b : Arrays.asList(10, 20, 30)) { final double theoreticalMean = a / (a + b); final double theoreticalVariance = a*b/((a+b)*(a+b)*(a+b+1)); final double standardDeviationOfMean = Math.sqrt(theoreticalVariance / NUM_SAMPLES); final Function<Double, Double> logPDF = x -> (a - 1) * Math.log(x) + (b - 1) * Math.log(1 - x); final AdaptiveMetropolisSampler sampler = new AdaptiveMetropolisSampler(INITIAL_BETA_GUESS, INITIAL_STEP_SIZE, 0, 1); final List<Double> samples = sampler.sample(logPDF, NUM_SAMPLES, NUM_BURN_IN_STEPS); final double sampleMean = samples.stream().mapToDouble(x -> x).average().getAsDouble(); final double sampleMeanSquare = samples.stream().mapToDouble(x -> x*x).average().getAsDouble(); final double sampleVariance = (sampleMeanSquare - sampleMean * sampleMean)*NUM_SAMPLES/(NUM_SAMPLES-1); Assert.assertEquals(sampleMean, theoreticalMean, 10 * standardDeviationOfMean); Assert.assertEquals(sampleVariance, theoreticalVariance, 10e-4); } } }
Source:
protected static JSIScenarioType getScenario(Scenario source) { JSIScenarioType toReturn = new JSIScenarioType(); JSIFactMappingValuesType factMappingValuesType = new JSIFactMappingValuesType(); toReturn.setFactMappingValues(factMappingValuesType); final List<FactMappingValue> unmodifiableFactMappingValues = source.getUnmodifiableFactMappingValues(); List<JSIFactMappingValueType> toSet = new ArrayList<>(); populateJSIFactMappingValuesType(toSet, unmodifiableFactMappingValues); factMappingValuesType.setFactMappingValue(toSet); return toReturn; }

Target:
protected static JSIScenarioType getScenario(Scenario source) { JSIScenarioType toReturn = new JSIScenarioType(); JSIFactMappingValuesType factMappingValuesType = new JSIFactMappingValuesType(); toReturn.setFactMappingValues(factMappingValuesType); final List<FactMappingValue> unmodifiableFactMappingValues = source.getUnmodifiableFactMappingValues(); List<JSIFactMappingValueType> toSet = populateJSIFactMappingValuesType(unmodifiableFactMappingValues); factMappingValuesType.setFactMappingValue(toSet); return toReturn; }
Source:
public Attribute<?> getSourceAttribute(boolean allowDeleted) throws OseeCoreException { Attribute<?> sourceAttribute = null; Collection<Attribute<?>> localAttributes; if (allowDeleted) { localAttributes = getSourceArtifact().getAttributes(true); } else { localAttributes = getSourceArtifact().getAttributes(); } for (Attribute<?> localAttribute : localAttributes) { if (localAttribute.getId() == attrId) { sourceAttribute = localAttribute; } } if (sourceAttribute == null) { if (sourceBranch != null) { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d on branch %s", attrId, getArtId(), sourceBranch.getUuid()); } else { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d", attrId, getArtId()); } } return sourceAttribute; }

Target:
public Attribute<?> getSourceAttribute(boolean allowDeleted) throws OseeCoreException { Attribute<?> sourceAttribute = getSourceArtifact().getAttributeById(attrId, allowDeleted); if (sourceAttribute == null) { if (sourceBranch != null) { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d on branch %s", attrId, getArtId(), sourceBranch.getUuid()); } else { throw new AttributeDoesNotExist("Attribute %d could not be found on artifact %d", attrId, getArtId()); } } return sourceAttribute; }
Source:
public Set<String> getFreeVariables() { return new HashSet<>(); }

Target:
public Set<String> getFreeVariables() { return objectExpr.getFreeVariables(); }
Source:
public static void validateConfig(Config config) { Validate.notEmpty(config.getName(), String.format(FIELD_CANNOT_BE_EMPTY, "Name")); Validate.notEmpty(config.getOpenMrsUrl(), String.format(FIELD_CANNOT_BE_EMPTY, "OpenMRS URL")); Validate.notEmpty(config.getUsername(), String.format(FIELD_CANNOT_BE_EMPTY, "Username")); Validate.notEmpty(config.getPassword(), String.format(FIELD_CANNOT_BE_EMPTY, "Password")); Validate.notEmpty(config.getMotechPatientIdentifierTypeName(), String.format(FIELD_CANNOT_BE_EMPTY, "Motech patient identifier type name")); Validate.notNull(config.getPatientIdentifierTypeNames(), String.format(FIELD_CANNOT_BE_EMPTY, "Patient identifier type names")); }

Target:
public static void validateConfig(Config config) { Validate.notEmpty(config.getName(), String.format(FIELD_CANNOT_BE_EMPTY, "Name")); Validate.notEmpty(config.getOpenMrsUrl(), String.format(FIELD_CANNOT_BE_EMPTY, "OpenMRS URL")); Validate.notEmpty(config.getUsername(), String.format(FIELD_CANNOT_BE_EMPTY, "Username")); Validate.notEmpty(config.getPassword(), String.format(FIELD_CANNOT_BE_EMPTY, "Password")); Validate.notEmpty(config.getMotechPatientIdentifierTypeName(), String.format(FIELD_CANNOT_BE_EMPTY, "Motech patient identifier type name")); }
Source:
protected void applyDataRowStyle(final int row) { super.applyDataRowStyle(row); final CellFormatter fmt = table.getCellFormatter(); fmt.addStyleName(row, C_STAR, S_ICON_CELL); for (int i = C_ID; i < columns; i++) { fmt.addStyleName(row, i, S_DATA_CELL); } fmt.addStyleName(row, C_ID, S_C_ID); fmt.addStyleName(row, C_SUBJECT, S_C_SUBJECT); fmt.addStyleName(row, C_PROJECT, S_C_PROJECT); fmt.addStyleName(row, C_BRANCH, S_C_PROJECT); fmt.addStyleName(row, C_LAST_UPDATE, S_C_LAST_UPDATE); for (int i = BASE_COLUMNS; i < columns; i++) { fmt.addStyleName(row, i, "approvalscore"); } }

Target:
protected void applyDataRowStyle(final int row) { super.applyDataRowStyle(row); final CellFormatter fmt = table.getCellFormatter(); fmt.addStyleName(row, C_STAR, S_ICON_CELL); for (int i = C_ID; i < columns; i++) { fmt.addStyleName(row, i, S_DATA_CELL); } fmt.addStyleName(row, C_ID, S_C_ID); fmt.addStyleName(row, C_SUBJECT, S_C_SUBJECT); fmt.addStyleName(row, C_PROJECT, S_C_PROJECT); fmt.addStyleName(row, C_BRANCH, S_C_PROJECT); fmt.addStyleName(row, C_LAST_UPDATE, S_C_LAST_UPDATE); }
Source:
public void requestRoll() { this.rollRequestCounter.incrementAndGet(); }

Target:
public void requestRoll() { this.rollRequest.set(true); }
Source:
public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(DsfPlugin.PLUGIN_ID); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); DEBUG_EXECUTOR = options.getBooleanOption(DEBUG_EXECUTOR_FLAG, false); DEBUG_EXECUTOR_NAME = options.getOption(DEBUG_EXECUTOR_NAME_FLAG, ""); DEBUG_MONITORS = options.getBooleanOption(DEBUG_MONITORS_FLAG, false); DEBUG_CACHE = options.getBooleanOption(DEBUG_CACHE_FLAG, false); DEBUG_SESSION = options.getBooleanOption(DEBUG_SESSION_FLAG, false); DEBUG_SESSION_LISTENERS = options.getBooleanOption(DEBUG_SESSION_LISTENERS_FLAG, false); DEBUG_SESSION_DISPATCHES = options.getBooleanOption(DEBUG_SESSION_DISPATCHES_FLAG, false); DEBUG_SESSION_MODEL_ADAPTERS = options.getBooleanOption(DEBUG_SESSION_MODEL_ADAPTERS_FLAG, false); }

Target:
public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(DsfPlugin.PLUGIN_ID); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); DEBUG_EXECUTOR = DEBUG && options.getBooleanOption(DEBUG_EXECUTOR_FLAG, false); DEBUG_EXECUTOR_NAME = DEBUG ? options.getOption(DEBUG_EXECUTOR_NAME_FLAG, "") : ""; DEBUG_MONITORS = DEBUG && options.getBooleanOption(DEBUG_MONITORS_FLAG, false); DEBUG_CACHE = DEBUG && options.getBooleanOption(DEBUG_CACHE_FLAG, false); DEBUG_SESSION = DEBUG && options.getBooleanOption(DEBUG_SESSION_FLAG, false); DEBUG_SESSION_LISTENERS = DEBUG_SESSION && options.getBooleanOption(DEBUG_SESSION_LISTENERS_FLAG, false); DEBUG_SESSION_DISPATCHES = DEBUG_SESSION && options.getBooleanOption(DEBUG_SESSION_DISPATCHES_FLAG, false); DEBUG_SESSION_MODEL_ADAPTERS = DEBUG_SESSION && options.getBooleanOption(DEBUG_SESSION_MODEL_ADAPTERS_FLAG, false); }
Source:
public void accept(ReadResultSet<ReliableTopicMessage> result, Throwable throwable) { if (cancelled) { return; } if (throwable == null) { for (int i = 0; i < result.size(); i++) { ReliableTopicMessage message = result.get(i); long actualSequence = result.getSequence(i); if (actualSequence != sequence) { if (handleSilentSequenceJump(actualSequence)) { sequence = actualSequence; } else { cancel(); return; } } try { listener.storeSequence(sequence); process(message); } catch (Throwable t) { if (terminate(t)) { cancel(); return; } } sequence++; } next(); } else { throwable = adjustThrowable(throwable); if (handleInternalException(throwable)) { next(); } else { cancel(); } } }

Target:
public void accept(ReadResultSet<ReliableTopicMessage> result, Throwable throwable) { if (cancelled) { return; } if (throwable == null) { long lostCount = result.getNextSequenceToReadFrom() - result.readCount() - sequence; if (lostCount != 0 && !isLossTolerable(lostCount)) { cancel(); return; } for (int i = 0; i < result.size(); i++) { ReliableTopicMessage message = result.get(i); try { listener.storeSequence(result.getSequence(i)); process(message); } catch (Throwable t) { if (terminate(t)) { cancel(); return; } } } sequence = result.getNextSequenceToReadFrom(); next(); } else { throwable = adjustThrowable(throwable); if (handleInternalException(throwable)) { next(); } else { cancel(); } } }
Source:
public static LocalCacheManager create(AlluxioConfiguration conf) throws IOException { MetaStore metaStore = MetaStore.create(); CacheEvictor evictor = CacheEvictor.create(conf); PageStoreOptions options = PageStoreOptions.create(conf); PageStore pageStore = PageStore.create(options); boolean restored = false; try { restored = pageStore.restore(pageInfo -> { if (pageInfo == null) { return false; } metaStore.addPage(pageInfo.getPageId(), pageInfo); evictor.updateOnPut(pageInfo.getPageId()); return metaStore.bytes() <= pageStore.getCacheSize(); }); } catch (Exception e) { LOG.error("Failed to restore PageStore", e); } if (!restored) { metaStore.reset(); evictor.reset(); pageStore.initialize(options); } return new LocalCacheManager(conf, metaStore, pageStore, evictor); }

Target:
public static LocalCacheManager create(AlluxioConfiguration conf) throws IOException { MetaStore metaStore = MetaStore.create(); CacheEvictor evictor = CacheEvictor.create(conf); PageStoreOptions options = PageStoreOptions.create(conf); PageStore pageStore = null; boolean restored = false; try { pageStore = PageStore.create(options, false); restored = restore(pageStore, options, metaStore, evictor); } catch (Exception e) { LOG.error("Failed to restore PageStore", e); } if (!restored) { if (pageStore != null) { try { pageStore.close(); } catch (Exception e) { LOG.error("Failed to close PageStore", e); } } metaStore.reset(); evictor.reset(); pageStore = PageStore.create(options, true); } return new LocalCacheManager(conf, metaStore, pageStore, evictor); }
Source:
public void deliver_updates() { AggregateRepository<ProjectId, Given.StandTestAggregate> repository = Given.aggregateRepo(); ProjectId entityId = ProjectId .newBuilder() .setId("PRJ-001") .build(); Given.StandTestAggregate entity = repository.create(entityId); StringValue state = entity.getState(); Version version = entity.getVersion(); Stand innerStand = Stand.newBuilder() .build(); Stand stand = spy(innerStand); stand.post(requestFactory.createCommandContext() .getActorContext() .getTenantId(), entity); ArgumentMatcher<EntityStateEnvelope<?, ?>> argumentMatcher = argument -> { boolean entityIdMatches = argument.getEntityId() .equals(entityId); boolean versionMatches = version.equals(argument.getEntityVersion() .orNull()); boolean stateMatches = argument.getMessage() .equals(state); return entityIdMatches && versionMatches && stateMatches; }; verify(stand).update(ArgumentMatchers.argThat(argumentMatcher)); }

Target:
public void deliver_updates() { AggregateRepository<ProjectId, StandTestAggregate> repository = Given.aggregateRepo(); ProjectId entityId = ProjectId .newBuilder() .setId("PRJ-001") .build(); StandTestAggregate entity = repository.create(entityId); StringValue state = entity.getState(); Version version = entity.getVersion(); Stand innerStand = Stand.newBuilder() .build(); Stand stand = spy(innerStand); stand.post(requestFactory.createCommandContext() .getActorContext() .getTenantId(), entity); ArgumentMatcher<EntityStateEnvelope<?, ?>> argumentMatcher = argument -> { boolean entityIdMatches = argument.getEntityId() .equals(entityId); boolean versionMatches = version.equals(argument.getEntityVersion() .orNull()); boolean stateMatches = argument.getMessage() .equals(state); return entityIdMatches && versionMatches && stateMatches; }; verify(stand).update(argThat(argumentMatcher)); }
Source:
CoordinationUtils createCoordinationUtils() throws Exception { ApplicationConfig appConfig = new ApplicationConfig(config); String clazz = appConfig.getCoordinationServiceFactoryClass(); if (StringUtils.isNotEmpty(clazz)) { CoordinationServiceFactory factory = ClassLoaderHelper.fromClassName(clazz); String groupId = String.format("app-%s-%s", appConfig.getAppName(), appConfig.getAppId()); return factory.getCoordinationService(groupId, uid, config); } else { return null; } }

Target:
CoordinationUtils createCoordinationUtils() { String jobCoordinatorFactoryClassName = config.get(JobCoordinatorConfig.JOB_COORDINATOR_FACTORY, ""); if (ZkJobCoordinatorFactory.class.getName().equals(jobCoordinatorFactoryClassName)) { ApplicationConfig appConfig = new ApplicationConfig(config); return new ZkCoordinationServiceFactory().getCoordinationService(appConfig.getGlobalAppId(), uid, config); } else { return null; } }
Source:
private static TraceMarker createTraceMarker(ITmfTrace trace, @Nullable String label, @Nullable String category, long startTime, long endTime, @Nullable String color) { long tStartTime = startTime; long tEndTime = endTime; String tLabel = label; String tCategory = category; String tColor = color; if (tEndTime == Long.valueOf(DEFAULT_ENDTIME)) { tEndTime = tStartTime; } if (tStartTime > tEndTime || tEndTime > trace.getEndTime().toNanos()) { throw new IllegalArgumentException(INVALID_END_TIMESTAMP); } if (tStartTime < trace.getStartTime().toNanos()) { throw new IllegalArgumentException(INVALID_START_TIMESTAMP); } if (tLabel == null) { tLabel = DEFAULT_LABEL; } if (tCategory == null) { tCategory = DEFAULT_CATEGORY; } if (tColor == null) { tColor = DEFAULT_COLOR; } return new TraceMarker(tLabel, tCategory, tStartTime, tEndTime, tColor); }

Target:
private static TraceMarker createTraceMarker(ITmfTrace trace, @Nullable String label, @Nullable String category, long startTime, long endTime, @Nullable String color) { long tStartTime = startTime; long tEndTime = endTime; String tLabel = label; String tCategory = category; String tColor = color; if (tEndTime == Long.parseLong(DEFAULT_ENDTIME)) { tEndTime = tStartTime; } if (tStartTime > tEndTime) { throw new IllegalArgumentException(String.format(INVALID_END_TIMESTAMP, tStartTime, tEndTime)); } if (tEndTime > trace.getEndTime().toNanos()) { throw new IllegalArgumentException(String.format(INVALID_END_TIMESTAMP_2, tEndTime, trace.getEndTime().toNanos())); } if (tStartTime < trace.getStartTime().toNanos()) { throw new IllegalArgumentException(String.format(INVALID_START_TIMESTAMP, tStartTime, trace.getStartTime().toNanos())); } if (tLabel == null) { tLabel = DEFAULT_LABEL; } if (tCategory == null) { tCategory = DEFAULT_CATEGORY; } if (tColor == null) { tColor = DEFAULT_COLOR; } return new TraceMarker(tLabel, tCategory, tStartTime, tEndTime, tColor); }