auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void createTrainingData(final int numTotalInstances) { kvMapBackingMemoryStore.clear(); final Random generator = new Random(); for (int i = 0; i < numTotalInstances; i++) { final int value = generator.nextInt(); memoryStore.put((long)i, value); } kvMapBackingMemoryStore.putAll(memoryStore.getAll()); }

Target:
private void createTrainingData(final int numTotalInstances) { final Random generator = new Random(); for (int i = 0; i < numTotalInstances; i++) { final int value = generator.nextInt(); memoryStore.put((long)i, value); } }
Source:
public void testValidUqSort(final File input, final File reference) throws IOException { final File sortOutput = File.createTempFile("Sort", ".bam"); sortOutput.deleteOnExit(); final File fixOutput = File.createTempFile("Fix", ".bam"); fixOutput.deleteOnExit(); final File validateOutput = File.createTempFile("Sort", ".validation_report"); validateOutput.deleteOnExit(); sort(input, sortOutput); setUqOnly(sortOutput, fixOutput, reference); validate(fixOutput,validateOutput, reference, true); }

Target:
public void testValidUqSort(final File input, final File reference) throws IOException { final File sortOutput = File.createTempFile("Sort", ".bam"); sortOutput.deleteOnExit(); final File fixOutput = File.createTempFile("Fix", ".bam"); fixOutput.deleteOnExit(); final File validateOutput = File.createTempFile("Sort", ".validation_report"); validateOutput.deleteOnExit(); sort(input, sortOutput); setUqOnly(sortOutput, fixOutput, reference); validateUq(fixOutput, reference); }
Source:
public void onClick(View v) { getPlaylistService().removeSong(entry); }

Target:
public void onClick(View v) { if(getPlaylistService().getCurrentSong()!= null && getPlaylistService().getCurrentSong().equals(entry)){ getPlaylistService().skip(); } getPlaylistService().removeSong(entry); }
Source:
private static void chmod(File file, int mode) throws IOException, InterruptedException { String octal = Integer.toOctalString(mode); if (Platform.getOS().equals(Platform.OS_WIN32)) { boolean ownerExecute = ((mode / (8 * 8)) & 1) == 1; boolean ownerRead = ((mode / (8 * 8)) & 4) == 4; boolean ownerWrite = ((mode / (8 * 8)) & 2) == 2; boolean everyoneExecute = ((mode / 8) & 1) == 1; boolean everyoneRead = ((mode / 8) & 4) == 4; boolean everyoneWrite = ((mode / 8) & 2) == 2; file.setWritable(true, false); file.setExecutable(ownerExecute, !everyoneExecute); file.setReadable(ownerRead, !everyoneRead); file.setWritable(ownerWrite, !everyoneWrite); } else { Process process = Runtime.getRuntime().exec(new String[] { "chmod", octal, file.getAbsolutePath() }, null, null); process.waitFor(); } }

Target:
private static void chmod(File file, int mode) throws IOException, InterruptedException { String octal = Integer.toOctalString(mode); if (Platform.getOS().equals(Platform.OS_WIN32)) { boolean ownerExecute = (((mode / (8 * 8)) & 1) == 1); boolean ownerRead = (((mode / (8 * 8)) & 4) == 4); boolean ownerWrite = (((mode / (8 * 8)) & 2) == 2); boolean everyoneExecute = (((mode / 8) & 1) == 1); boolean everyoneRead = (((mode / 8) & 4) == 4); boolean everyoneWrite = (((mode / 8) & 2) == 2); file.setWritable(true, false); file.setExecutable(ownerExecute, !everyoneExecute); file.setReadable(ownerRead, !everyoneRead); file.setWritable(ownerWrite, !everyoneWrite); } else { Process process = Runtime.getRuntime().exec(new String[] { "chmod", octal, file.getAbsolutePath() }, null, null); process.waitFor(); } }
Source:
public void testTimestampLogicalTypeWithUTCParameter() { PrimitiveType utcMillisExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS)); PrimitiveType nonUtcMillisExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.MILLIS)); PrimitiveType utcMicrosExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MICROS)); PrimitiveType nonUtcMicrosExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.MICROS)); PrimitiveType utcMillisActual = Types.required(INT64) .as(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS)).named("aTimestamp"); PrimitiveType nonUtcMillisActual = Types.required(INT64) .as(LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.MILLIS)).named("aTimestamp"); PrimitiveType utcMicrosActual = Types.required(INT64) .as(LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MICROS)).named("aTimestamp"); PrimitiveType nonUtcMicrosActual = Types.required(INT64) .as(LogicalTypeAnnotation.timestampType(false, LogicalTypeAnnotation.TimeUnit.MICROS)).named("aTimestamp"); Assert.assertEquals(utcMillisExpected, utcMillisActual); Assert.assertEquals(nonUtcMillisExpected, nonUtcMillisActual); Assert.assertEquals(utcMicrosExpected, utcMicrosActual); Assert.assertEquals(nonUtcMicrosExpected, nonUtcMicrosActual); }

Target:
public void testTimestampLogicalTypeWithUTCParameter() { PrimitiveType utcMillisExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", timestampType(true, MILLIS)); PrimitiveType nonUtcMillisExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", timestampType(false, MILLIS)); PrimitiveType utcMicrosExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", timestampType(true, MICROS)); PrimitiveType nonUtcMicrosExpected = new PrimitiveType(REQUIRED, INT64, "aTimestamp", timestampType(false, MICROS)); PrimitiveType utcMillisActual = Types.required(INT64) .as(timestampType(true, MILLIS)).named("aTimestamp"); PrimitiveType nonUtcMillisActual = Types.required(INT64) .as(timestampType(false, MILLIS)).named("aTimestamp"); PrimitiveType utcMicrosActual = Types.required(INT64) .as(timestampType(true, MICROS)).named("aTimestamp"); PrimitiveType nonUtcMicrosActual = Types.required(INT64) .as(timestampType(false, MICROS)).named("aTimestamp"); Assert.assertEquals(utcMillisExpected, utcMillisActual); Assert.assertEquals(nonUtcMillisExpected, nonUtcMillisActual); Assert.assertEquals(utcMicrosExpected, utcMicrosActual); Assert.assertEquals(nonUtcMicrosExpected, nonUtcMicrosActual); }
Source:
public static void assertDoesNotContain(final String notExpected, final Set<Issue> result, final int rowNumber) { assertFalse("Found " + notExpected, result.stream() .filter(issue -> titleEquals(issue, notExpected) && rowNumberContains(issue, new HashSet<Integer>() {{ add(rowNumber); }})) .count() > 0); }

Target:
public static void assertDoesNotContain(final String notExpected, final Set<Issue> result, final int rowNumber) { assertFalse("Found " + notExpected, result.stream() .filter(issue -> titleEquals(issue, notExpected)) .filter(issue -> rowNumberContains(issue, Arrays.asList(rowNumber))) .count() > 0); }
Source:
public void setUp() throws Exception { validate(); }

Target:
public void setUp() throws Exception { ControllerTestUtils.setupClusterAndValidate(); }
Source:
public NotifyingFuture<V> attachListener(final FutureListener<V> listener) { future.whenComplete((value, throwable) -> { if (throwable == null) { listener.futureDone(this); } else { listener.futureDone(this); } }); return this; }

Target:
public NotifyingFuture<V> attachListener(final FutureListener<V> listener) { future.whenComplete((value, throwable) -> { listener.futureDone(this); }); return this; }
Source:
public CosmosContinuablePagedFlux(Function<CosmosPagedFluxOptions, Flux<FeedResponse<T>>> optionsFluxFunction) { this.optionsFluxFunction = optionsFluxFunction; }

Target:
CosmosContinuablePagedFlux(Function<CosmosPagedFluxOptions, Flux<FeedResponse<T>>> optionsFluxFunction) { this.optionsFluxFunction = optionsFluxFunction; }
Source:
private void buttonsEnablement() { if ((fChangeInfo.getCodeReviewedTally() == 2 && fChangeInfo.getVerifiedTally() == 1)) { fSubmit.setEnabled(true); } else { fSubmit.setEnabled(false); } }

Target:
private void buttonsEnablement() { if (findMaxDefined() != findMaxPermitted()) { fSubmit.setEnabled(false); } if (fChangeInfo.getLabels().get("Verified") != null && fChangeInfo.getLabels().get("Verified").isBlocking()) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Verified") != null && fChangeInfo.getLabels().get("Verified").getValue() == null && fChangeInfo.getVerifiedTally() <= 0) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Verified") != null && fChangeInfo.getLabels().get("Verified").getValue() != null && new Integer(fChangeInfo.getLabels().get("Verified").getValue()).intValue() <= 0) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Code-Review") != null && fChangeInfo.getLabels().get("Code-Review").isBlocking()) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Code-Review") != null && fChangeInfo.getLabels().get("Code-Review").getValue() == null && fChangeInfo.getCodeReviewedTally() <= 0) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Code-Review") != null && fChangeInfo.getLabels().get("Code-Review").getValue() != null && new Integer(fChangeInfo.getLabels().get("Code-Review").getValue()).intValue() <= 0) { fSubmit.setEnabled(false); } }
Source:
public void finish(TraceContext context, long finishTimestamp) { if (noop.get()) return; MutableSpan span = spanMap.remove(context); if (span == null || noop.get()) return; synchronized (span) { span.finish(finishTimestamp); reporter.report(V2SpanConverter.toSpan(span.toSpan())); } }

Target:
public void finish(TraceContext context, long finishTimestamp) { MutableSpan span = spanMap.remove(context); if (span == null || noop.get()) return; synchronized (span) { span.finish(finishTimestamp); reporter.report(V2SpanConverter.toSpan(span.toSpan())); } }
Source:
public void testHostShouldBeFenced() { validator = setValidatorForActivation(VDSStatus.Down); assertTrue(validator.shouldVdsBeFenced()); }

Target:
public void testHostShouldBeFenced() { validator = mockHostForActivation(VDSStatus.Down); assertTrue(validator.shouldVdsBeFenced()); }
Source:
protected void loadDataCenters() { AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; if (returnValue != null) { StoragePool dataCenter = (StoragePool) returnValue; List<StoragePool> dataCenters = new ArrayList<StoragePool>(Arrays.asList(new StoragePool[] { dataCenter })); initClusters(dataCenters); } else { NewVmFromTemplateModelBehavior behavior = (NewVmFromTemplateModelBehavior) model.getBehavior(); VmTemplate currentTemplate = behavior.selectedTemplate; VDSGroup cluster = new VDSGroup(); cluster.setId(currentTemplate.getVdsGroupId()); cluster.setName(currentTemplate.getVdsGroupName()); cluster.setStoragePoolId(currentTemplate.getStoragePoolId()); DataCenterWithCluster dataCenterWithCluster = new DataCenterWithCluster(null, cluster); model.getDataCenterWithClustersList().setItems(Arrays.asList(dataCenterWithCluster)); model.getDataCenterWithClustersList().setSelectedItem(dataCenterWithCluster); } } }), selectedTemplate.getStoragePoolId()); }

Target:
protected void loadDataCenters() { AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; if (returnValue != null) { StoragePool dataCenter = (StoragePool) returnValue; List<StoragePool> dataCenters = new ArrayList<StoragePool>(Arrays.asList(new StoragePool[] { dataCenter })); initClusters(dataCenters); } else { getModel().disableEditing(ConstantsManager.getInstance().getConstants().notAvailableWithNoUpDC()); } } }), selectedTemplate.getStoragePoolId()); }
Source:
public ActionResult execute() { String instructorId = getNonNullRequestParamValue(Const.ParamsNames.INSTRUCTOR_ID); String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, instructorId); if (instructor == null) { CourseAttributes courseAttributes = logic.getCourse(courseId); if (courseAttributes == null) { return new JsonResult("No course with id: " + courseId, HttpStatus.SC_NOT_FOUND); } return new JsonResult("No instructor with id: " + instructorId, HttpStatus.SC_NOT_FOUND); } if (userInfo.isInstructor && !hasAlternativeInstructor(courseId, instructor.email)) { return new JsonResult("The instructor you are trying to delete is the last instructor in the course. " + "Deleting the last instructor from the course is not allowed.", HttpStatus.SC_BAD_REQUEST); } logic.deleteInstructor(courseId, instructor.email); return new JsonResult("OK", HttpStatus.SC_OK); }

Target:
public ActionResult execute() { String instructorId = getNonNullRequestParamValue(Const.ParamsNames.INSTRUCTOR_ID); String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, instructorId); if (instructor == null) { return new JsonResult("Instructor is successfully deleted.", HttpStatus.SC_OK); } if (userInfo.isInstructor && !hasAlternativeInstructor(courseId, instructor.email)) { return new JsonResult("The instructor you are trying to delete is the last instructor in the course. " + "Deleting the last instructor from the course is not allowed.", HttpStatus.SC_BAD_REQUEST); } logic.deleteInstructor(courseId, instructor.email); return new JsonResult("Instructor is successfully deleted.", HttpStatus.SC_OK); }
Source:
static public RelNode transform(CalcitePlannerType plannerType, PlannerPhase phase, RelNode input, RelTraitSet targetTraits) { final RelTraitSet toTraits = targetTraits.simplify(); final RelNode output; switch (plannerType) { case HEP: { final HepProgramBuilder hepProgramBuilder = new HepProgramBuilder(); hepProgramBuilder.addGroupBegin(); phase.getRules().forEach(hepProgramBuilder::addRuleInstance); hepProgramBuilder.addGroupEnd(); final HepPlanner planner = new HepPlanner(hepProgramBuilder.build()); JaninoRelMetadataProvider relMetadataProvider = JaninoRelMetadataProvider.of( VoltDBDefaultRelMetadataProvider.INSTANCE); RelMetadataQuery.THREAD_PROVIDERS.set(relMetadataProvider); input.accept(new MetaDataProviderModifier(relMetadataProvider)); planner.setRoot(input); if (!input.getTraitSet().equals(targetTraits)) { planner.changeTraits(input, toTraits); } output = planner.findBestExp(); break; } case VOLCANO: default: { output = null; break; } } return output; }

Target:
static public RelNode transform(CalcitePlannerType plannerType, PlannerPhase phase, RelNode input, RelTraitSet targetTraits) { final RelTraitSet toTraits = targetTraits.simplify(); final RelNode output; switch (plannerType) { case HEP: { final HepProgramBuilder hepProgramBuilder = new HepProgramBuilder(); hepProgramBuilder.addGroupBegin(); phase.getRules().forEach(hepProgramBuilder::addRuleInstance); hepProgramBuilder.addGroupEnd(); final HepPlanner planner = new HepPlanner(hepProgramBuilder.build()); JaninoRelMetadataProvider relMetadataProvider = JaninoRelMetadataProvider.of( VoltDBDefaultRelMetadataProvider.INSTANCE); RelMetadataQuery.THREAD_PROVIDERS.set(relMetadataProvider); input = input.accept(new MetaDataProviderModifier(relMetadataProvider)); planner.setRoot(input); if (!input.getTraitSet().equals(targetTraits)) { planner.changeTraits(input, toTraits); } output = planner.findBestExp(); break; } case VOLCANO: { output = null; break; } default: { throw new RuntimeException("Dead branch."); } } return output; }
Source:
public static PlanNode restrictOutputs(PlanNodeIdAllocator idAllocator, PlanNode node, Set<Symbol> permittedOutputs) { List<Symbol> restrictedOutputs = node.getOutputSymbols().stream() .filter(permittedOutputs::contains) .collect(toImmutableList()); if (restrictedOutputs.size() < node.getOutputSymbols().size()) { return new ProjectNode( idAllocator.getNextId(), node, Assignments.identity(restrictedOutputs) ); } return node; }

Target:
public static Optional<PlanNode> restrictOutputs(PlanNodeIdAllocator idAllocator, PlanNode node, Set<Symbol> permittedOutputs) { List<Symbol> restrictedOutputs = node.getOutputSymbols().stream() .filter(permittedOutputs::contains) .collect(toImmutableList()); if (restrictedOutputs.size() == node.getOutputSymbols().size()) { return Optional.empty(); } return Optional.of( new ProjectNode( idAllocator.getNextId(), node, Assignments.identity(restrictedOutputs))); }
Source:
protected void createTable(TableName tableName) throws IOException { try{ getAsyncAdmin().createTable(createDescriptor(tableName)).get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } }

Target:
protected void createTable(TableName tableName) throws IOException { try{ getAsyncAdmin().createTable(createDescriptor(tableName)).get(); } catch (InterruptedException | ExecutionException e) { throw new IOException("Error while creating table: "+e.getCause()); } }
Source:
public HttpResult makePostWithFile( ContentBody fileBody, URI destinationUrl, Map<String, String> headers) throws IOException { HttpPost httppost = new HttpPost(destinationUrl.toString()); addHeadersTo(httppost, headers); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); addCredentials(httppost, this.settings.getFormattedUserData()); builder = addFileToRequest(fileBody, builder); HttpEntity entity = builder.build(); httppost.setEntity(entity); return getResponseResult(httppost); }

Target:
public HttpResult makePostWithFile( ContentBody fileBody, URI destinationUrl, Map<String, String> headers) throws IOException { HttpPost httppost = new HttpPost(destinationUrl); addHeadersTo(httppost, headers); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); addCredentials(httppost, this.settings.getFormattedUserData()); builder = addFileToRequest(fileBody, builder); HttpEntity entity = builder.build(); httppost.setEntity(entity); return getResponseResult(httppost); }
Source:
public List<String> getPossibleAncestorRevisionIDs(String docId, String revId, int limit) { int generation = CouchUtils.generationFromRevId(revId); if (generation <= 1) return null; int sqlLimit = limit > 0 ? (int)limit : -1; String sql = "SELECT revid FROM revs, docs WHERE docs.docid=?"+ " and revs.deleted=0 and revs.json not null and revs.doc_id = docs.doc_id"+ " ORDER BY revs.sequence DESC"; ArrayList<String> ids = new ArrayList<String>(); try { Cursor c = this.sqlDb.rawQuery(sql, new String[]{docId}); while (c.moveToNext() && limit-- > 0) { String ancestorRevId = c.getString(0); int ancestorGeneration = CouchUtils.generationFromRevId(ancestorRevId); if (ancestorGeneration < generation) { ids.add(ancestorRevId); } } } catch(SQLException sqe) { return null; } return ids; }

Target:
public List<String> getPossibleAncestorRevisionIDs(String docId, String revId, int limit) { int generation = CouchUtils.generationFromRevId(revId); if (generation <= 1) return null; String sql = "SELECT revid FROM revs, docs WHERE docs.docid=?"+ " and revs.deleted=0 and revs.json not null and revs.doc_id = docs.doc_id"+ " ORDER BY revs.sequence DESC"; ArrayList<String> ids = new ArrayList<String>(); try { Cursor c = this.sqlDb.rawQuery(sql, new String[]{docId}); while (c.moveToNext() && limit > 0) { String ancestorRevId = c.getString(0); int ancestorGeneration = CouchUtils.generationFromRevId(ancestorRevId); if (ancestorGeneration < generation) { ids.add(ancestorRevId); limit--; } } } catch(SQLException sqe) { return null; } return ids; }
Source:
private static PointValue randomPoint( int index, int dimension ) { CoordinateReferenceSystem crs = index % 2 == 0 ? dimension == 2 ? WGS84 : WGS84_3D : dimension == 2 ? Cartesian : Cartesian_3D; return unsafePointValue( crs, random().doubles( dimension, Double.MIN_VALUE, Double.MAX_VALUE ).toArray() ); }

Target:
private static PointValue randomPoint( int index, int dimension ) { CoordinateReferenceSystem crs; if ( index % 2 == 0 ) { crs = dimension == 2 ? WGS84 : WGS84_3D; } else { crs = dimension == 2 ? Cartesian : Cartesian_3D; } return unsafePointValue( crs, random().doubles( dimension, Double.MIN_VALUE, Double.MAX_VALUE ).toArray() ); }
Source:
public TransactionEntity getChargeTransaction() { return transactions.stream().filter(byChargeTransactions()).findFirst().orElseThrow( () -> new IllegalStateException("Payment Request has been initialised without a charge transaction") ); }

Target:
public ChargeTransactionEntity getChargeTransaction() { return (ChargeTransactionEntity)transactions.stream().filter(byChargeTransactions()).findFirst().orElseThrow( () -> new IllegalStateException("Payment Request has been initialised without a charge transaction") ); }
Source:
public int getGeneration() { return _generation; }

Target:
int getGeneration() { return _generation; }
Source:
public void criteriaScheduleStrategyPlanCRUD() { Schedule schedule1 = new Schedule(); schedule1.setLabel("Task 1"); schedule1.setScheduleType(ScheduleType.ONCE); schedule1.addActivity(new Activity("Do task",null,new TaskReference("task:AAA"))); Schedule schedule2 = new Schedule(); schedule2.setLabel("Task 2"); schedule2.setScheduleType(ScheduleType.ONCE); schedule2.addActivity(new Activity("Do task",null,new TaskReference("task:BBB"))); ScheduleCriteria criteria1 = new ScheduleCriteria.Builder() .withMinAppVersion(2) .withMaxAppVersion(5) .withSchedule(schedule1).build(); ScheduleCriteria criteria2 = new ScheduleCriteria.Builder() .withMinAppVersion(6) .withMaxAppVersion(10) .withSchedule(schedule2).build(); CriteriaScheduleStrategy strategy = new CriteriaScheduleStrategy(); strategy.addCriteria(criteria1); strategy.addCriteria(criteria2); SchedulePlan plan = new SchedulePlan(); plan.setLabel("Criteria schedule plan"); plan.setStrategy(strategy); GuidVersionHolder keys = developerClient.createSchedulePlan(plan); SchedulePlan retrievedPlan = developerClient.getSchedulePlan(keys.getGuid()); assertTrue(retrievedPlan.getStrategy() instanceof CriteriaScheduleStrategy); CriteriaScheduleStrategy retrievedStrategy = (CriteriaScheduleStrategy)retrievedPlan.getStrategy(); assertEquals(2, retrievedStrategy.getScheduleCriteria().size()); assertEquals("task:AAA", getTaskIdentifier(retrievedStrategy, 0)); assertEquals("task:BBB", getTaskIdentifier(retrievedStrategy, 1)); }

Target:
public void criteriaScheduleStrategyPlanCRUD() throws Exception { Schedule schedule1 = new Schedule(); schedule1.setLabel("Task 1"); schedule1.setScheduleType(ScheduleType.ONCE); schedule1.addActivity(new Activity("Do task",null,new TaskReference("task:AAA"))); Schedule schedule2 = new Schedule(); schedule2.setLabel("Task 2"); schedule2.setScheduleType(ScheduleType.ONCE); schedule2.addActivity(new Activity("Do task",null,new TaskReference("task:BBB"))); ScheduleCriteria criteria1 = new ScheduleCriteria.Builder() .withMinAppVersion(2) .withMaxAppVersion(5) .withSchedule(schedule1).build(); ScheduleCriteria criteria2 = new ScheduleCriteria.Builder() .withMinAppVersion(6) .withMaxAppVersion(10) .withSchedule(schedule2).build(); CriteriaScheduleStrategy strategy = new CriteriaScheduleStrategy(); strategy.addCriteria(criteria1); strategy.addCriteria(criteria2); SchedulePlan plan = new SchedulePlan(); plan.setLabel("Criteria schedule plan"); plan.setStrategy(strategy); GuidVersionHolder keys = developerClient.createSchedulePlan(plan); SchedulePlan retrievedPlan = developerClient.getSchedulePlan(keys.getGuid()); assertTrue(retrievedPlan.getStrategy() instanceof CriteriaScheduleStrategy); CriteriaScheduleStrategy retrievedStrategy = (CriteriaScheduleStrategy)retrievedPlan.getStrategy(); assertEquals(2, retrievedStrategy.getScheduleCriteria().size()); criteria1 = updateGuid(criteria1, retrievedStrategy, 0); criteria2 = updateGuid(criteria2, retrievedStrategy, 1); assertEquals(criteria1, retrievedStrategy.getScheduleCriteria().get(0)); assertEquals(criteria2, retrievedStrategy.getScheduleCriteria().get(1)); }
Source:
private void validateAllowWebPayment(JsonNode payload) { String op = payload.get(FIELD_OPERATION).asText(); if (!op.equalsIgnoreCase("replace")) { throw new ValidationException(Collections.singletonList(format("Operation [%s] is not valid for path [%s]", op, FIELD_EMAIL_COLLECTION_MODE))); } JsonNode valueNode = payload.get(FIELD_VALUE); if(null == valueNode || valueNode.isNull()) { throw new ValidationException(Collections.singletonList(format("Field [%s] is required", FIELD_VALUE))); } String booleanString = valueNode.asText(); if (!booleanString.equalsIgnoreCase("false") && !booleanString.equalsIgnoreCase("true")) throw new ValidationException(Collections.singletonList(format("Value [%s] is not valid for [%s]", booleanString, FIELD_ALLOW_WEB_PAYMENTS))); }

Target:
private void validateAllowWebPayment(JsonNode payload) { throwIfInvalidFieldOperation(FIELD_ALLOW_WEB_PAYMENTS, payload, REPLACE_OP); throwIfNullFieldValue(payload.get(FIELD_VALUE)); String booleanString = payload.get(FIELD_VALUE).asText().toLowerCase(); if (!booleanString.equals("false") && !booleanString.equals("true")) throw new ValidationException(Collections.singletonList(format("Value [%s] is not valid for [%s]", booleanString, FIELD_ALLOW_WEB_PAYMENTS))); }
Source:
private void unmanage(final Location loc, ManagementTransitionMode mode, boolean hasBeenReplaced) { if (shouldSkipUnmanagement(loc)) return; if (hasBeenReplaced) { if (mode==ManagementTransitionMode.REBINDING_NO_LONGER_PRIMARY) { managementContext.getRebindManager().getChangeListener().onUnmanaged(loc); if (managementContext.gc != null) managementContext.gc.onUnmanaged(loc); } else { if (!mode.wasReadOnly()) log.warn("Should not be unmanaging "+loc+" in mode "+mode); } } else if (mode==ManagementTransitionMode.REBINDING_DESTROYED) { unmanageNonRecursive(loc); managementContext.getRebindManager().getChangeListener().onUnmanaged(loc); if (managementContext.gc != null) managementContext.gc.onUnmanaged(loc); } else if (mode==ManagementTransitionMode.DESTROYING) { recursively(loc, new Predicate<AbstractLocation>() { public boolean apply(AbstractLocation it) { if (shouldSkipUnmanagement(it)) return false; boolean result = unmanageNonRecursive(it); if (result) { ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId()); if (mode==null) { log.warn("Missing transition mode for "+it+" when unmanaging; assuming primary"); mode = ManagementTransitionMode.DESTROYING; } if (!mode.isReadOnly()) it.onManagementStopped(); managementContext.getRebindManager().getChangeListener().onUnmanaged(it); if (!mode.isReadOnly()) recordLocationEvent(it, Lifecycle.DESTROYED); if (managementContext.gc != null) managementContext.gc.onUnmanaged(it); } return result; } }); } else { log.warn("Invalid mode for unmanage: "+mode+" on "+loc+" (ignoring)"); } }

Target:
private void unmanage(final Location loc, ManagementTransitionMode mode, boolean hasBeenReplaced) { if (shouldSkipUnmanagement(loc)) return; if (hasBeenReplaced) { if (mode==ManagementTransitionMode.REBINDING_NO_LONGER_PRIMARY) { managementContext.getRebindManager().getChangeListener().onUnmanaged(loc); if (managementContext.gc != null) managementContext.gc.onUnmanaged(loc); } else { if (!mode.wasReadOnly()) log.warn("Should not be unmanaging "+loc+" in mode "+mode+"; ignoring"); } } else if (mode==ManagementTransitionMode.REBINDING_DESTROYED) { unmanageNonRecursive(loc); managementContext.getRebindManager().getChangeListener().onUnmanaged(loc); if (managementContext.gc != null) managementContext.gc.onUnmanaged(loc); } else if (mode==ManagementTransitionMode.DESTROYING) { recursively(loc, new Predicate<AbstractLocation>() { public boolean apply(AbstractLocation it) { if (shouldSkipUnmanagement(it)) return false; boolean result = unmanageNonRecursive(it); if (result) { ManagementTransitionMode mode = getLastManagementTransitionMode(it.getId()); if (mode==null) { log.warn("Missing transition mode for "+it+" when unmanaging; assuming primary"); mode = ManagementTransitionMode.DESTROYING; } if (!mode.isReadOnly()) it.onManagementStopped(); managementContext.getRebindManager().getChangeListener().onUnmanaged(it); if (!mode.isReadOnly()) recordLocationEvent(it, Lifecycle.DESTROYED); if (managementContext.gc != null) managementContext.gc.onUnmanaged(it); } return result; } }); } else { log.warn("Invalid mode for unmanage: "+mode+" on "+loc+" (ignoring)"); } }
Source:
private String getSkuTierFromSkuName(String skuName) { if (Set.of("GP_Gen5_2", "GP_Gen5_4", "GP_Gen5_8", "GP_Gen5_16", "GP_Gen5_32").contains(skuName)) { return "GeneralPurpose"; } else if (Set.of("MO_Gen5_2", "MO_Gen5_4", "MO_Gen5_8", "MO_Gen5_16", "MO_Gen5_32").contains(skuName)) { return "MemoryOptimized"; } else { return null; } }

Target:
private String getSkuTierFromSkuName(String skuName) { if (GENERAL_PURPOSE_INSTANCE_TYPES.contains(skuName)) { return GENERAL_PURPOSE; } else if (MEMORY_OPTIMIZED_INSTANCE_TYPES.contains(skuName)) { return MEMORY_OPTIMIZED; } else { return null; } }
Source:
public String storeData(String cookieData) { try { String token = generateToken(); ensureSpaceExists(); s3StorageProvider.addHiddenContent(this.hiddenSpaceName, token, "application/json", IOUtil.writeStringToStream(cookieData)); return token; } catch (Exception e) { throw new DuraCloudRuntimeException(e); } }

Target:
public String storeData(String cookieData) { try { String token = generateToken(); ensureSpaceExists(); s3StorageProvider.addHiddenContent(this.hiddenSpaceName, token, Constants.MEDIA_TYPE_APPLICATION_JSON, IOUtil.writeStringToStream(cookieData)); return token; } catch (Exception e) { throw new DuraCloudRuntimeException(e); } }
Source:
public void testUnmarshallGlobalVariables() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_GLOBALVARIABLES); assertDiagram(diagram, 1); assertEquals("Global Variables", diagram.getMetadata().getTitle()); GlobalVariables variables = null; Iterator<Element> it = nodesIterator(diagram); while (it.hasNext()) { Element element = it.next(); if (element.getContent() instanceof View) { Object oDefinition = ((View) element.getContent()).getDefinition(); if (oDefinition instanceof BPMNDiagram) { BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition; variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); break; } } } assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("__-CvwCveEemCffTTkSwXXQ"); assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram); BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition(); assertTrue(bpmnDiagram.getDiagramSet() != null); assertTrue(bpmnDiagram.getDiagramSet().getGlobalVariables() != null); variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); }

Target:
public void testUnmarshallGlobalVariables() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(BPMN_GLOBALVARIABLES); assertDiagram(diagram, 1); assertEquals("Global Variables", diagram.getMetadata().getTitle()); BPMNDiagramImpl bpmnDiagram = getBpmnDiagram(diagram); GlobalVariables variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); Node<? extends Definition, ?> diagramNode = diagram.getGraph().getNode("__-CvwCveEemCffTTkSwXXQ"); assertTrue(diagramNode.getContent().getDefinition() instanceof BPMNDiagram); bpmnDiagram = (BPMNDiagramImpl) diagramNode.getContent().getDefinition(); assertTrue(bpmnDiagram.getDiagramSet() != null); assertTrue(bpmnDiagram.getDiagramSet().getGlobalVariables() != null); variables = bpmnDiagram.getDiagramSet().getGlobalVariables(); assertEquals("GV1:Boolean,GV2:Boolean,GV3:Integer", variables.getValue()); }
Source:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: replication.scheduleUpdate(destBranch.getParentKey(), branchUpdate .getName()); hooks.doRefUpdatedHook( destBranch, branchUpdate, accountCache.get(getSubmitter(mergeTip.patchsetId).getAccountId()).getAccount()); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }

Target:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: replication.scheduleUpdate(destBranch.getParentKey(), branchUpdate .getName()); Account account = null; final PatchSetApproval submitter = getSubmitter(mergeTip.patchsetId); if (submitter != null) { account = accountCache.get(submitter.getAccountId()).getAccount(); } hooks.doRefUpdatedHook(destBranch, branchUpdate, account); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }
Source:
protected void _burySiblings(Card card) { ArrayList<Long> toBury = new ArrayList<>(); JSONObject nconf = _newConf(card); boolean buryNew = nconf.optBoolean("bury", true); JSONObject rconf = _revConf(card); boolean buryRev = rconf.optBoolean("bury", true); Cursor cur = null; try { cur = mCol.getDb().getDatabase().query( "select id, queue from cards where nid=? and id!=? "+ "and (queue=" + Consts.QUEUE_TYPE_NEW + " or (queue=" + Consts.QUEUE_TYPE_REV + " and due<=?))", new Object[] {card.getNid(), card.getId(), mToday}); while (cur.moveToNext()) { long cid = cur.getLong(0); int queue = cur.getInt(1); if (queue == Consts.QUEUE_TYPE_REV) { if (buryRev) { toBury.add(cid); } mRevQueue.remove(cid); } else { if (buryNew) { toBury.add(cid); } mNewQueue.remove(cid); } if (mNextCard != null && mNextCard.getId() == cid && ((buryRev && mNextCard.getQueue() == Consts.QUEUE_TYPE_REV)) || ((buryNew && mNextCard.getQueue() == Consts.QUEUE_TYPE_NEW))) { mNextCard = null; backgroundNextCard(); } } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } if (toBury.size() > 0) { buryCards(Utils.arrayList2array(toBury),false); } }

Target:
protected void _burySiblings(Card card) { ArrayList<Long> toBury = new ArrayList<>(); JSONObject nconf = _newConf(card); boolean buryNew = nconf.optBoolean("bury", true); JSONObject rconf = _revConf(card); boolean buryRev = rconf.optBoolean("bury", true); Cursor cur = null; try { cur = mCol.getDb().getDatabase().query( "select id, queue from cards where nid=? and id!=? "+ "and (queue=" + Consts.QUEUE_TYPE_NEW + " or (queue=" + Consts.QUEUE_TYPE_REV + " and due<=?))", new Object[] {card.getNid(), card.getId(), mToday}); while (cur.moveToNext()) { long cid = cur.getLong(0); int queue = cur.getInt(1); List<Long> queue_object; if (queue == Consts.QUEUE_TYPE_REV) { queue_object = mRevQueue; if (buryRev) { toBury.add(cid); } } else { queue_object = mNewQueue; if (buryNew) { toBury.add(cid); } } queue_object.remove(cid); if (mNextCard != null && mNextCard.getId() == cid) { mNextCard = null; } } } finally { if (cur != null && !cur.isClosed()) { cur.close(); } } if (!toBury.isEmpty()) { buryCards(Utils.arrayList2array(toBury),false); } }
Source:
public LeaderElectionMetricAggregator(MetricsManager metricsManager) { weightedGaugeP99 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeP95 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeMean = SlidingWindowWeightedMeanGauge.create(); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactMean", weightedGaugeMean); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP95", weightedGaugeP95); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP99", weightedGaugeP99); Histogram leaderElectionHistogram = metricsManager.registerOrGetHistogram( LeaderElectionMetricAggregator.class, "leaderElectionDurationEstimate", () -> new Histogram(new SlidingTimeWindowArrayReservoir(5, TimeUnit.MINUTES))); leaderElectionDurationAccumulator = new LeaderElectionDurationAccumulator(leaderElectionHistogram::update, 10); }

Target:
public LeaderElectionMetricAggregator(MetricsManager metricsManager) { weightedGaugeP99 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeP95 = SlidingWindowWeightedMeanGauge.create(); weightedGaugeMean = SlidingWindowWeightedMeanGauge.create(); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactMean", weightedGaugeMean); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP95", weightedGaugeP95); metricsManager.registerMetric( LeaderElectionMetricAggregator.class, "leaderElectionImpactP99", weightedGaugeP99); Histogram leaderElectionHistogram = metricsManager.registerOrGetHistogram( LeaderElectionMetricAggregator.class, "leaderElectionDurationEstimate", () -> new Histogram(new SlidingTimeWindowArrayReservoir(5, TimeUnit.MINUTES))); leaderElectionDurationAccumulator = new LeaderElectionDurationAccumulator(leaderElectionHistogram::update, CONFIDENCE_THRESHOLD); }
Source:
private Widget resolveDefault(Widget widget) { if (widget instanceof Default) { if (widget.getItem() != null) { Item item = itemRegistry.get(widget.getItem()); if (item != null) { Widget defaultWidget = getDefaultWidget(item.getClass(), item.getName()); if (defaultWidget != null) { defaultWidget.setItem(item.getName()); return defaultWidget; } } } } return null; }

Target:
private Widget resolveDefault(Widget widget) { if (!(widget instanceof Default)) { return widget; } else { if (widget.getItem() != null) { Item item = itemRegistry.get(widget.getItem()); if (item != null) { Widget defaultWidget = getDefaultWidget(item.getClass(), item.getName()); if (defaultWidget != null) { defaultWidget.setItem(item.getName()); return defaultWidget; } } } return null; } }
Source:
protected static TestGeneric<String>.InnerGeneric<Integer> testGenericInnerInt() { return null; }

Target:
protected static TestGeneric<Short>.InnerGeneric<Integer> testGenericInnerInt() { return null; }
Source:
public VM update(VM incoming) { validateEnums(VM.class, incoming); validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); VM vm = get(); if(!clusterId.toString().equals(vm.getCluster().getId())){ performAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(clusterId, guid)); if (incoming.getCpuProfile() != null && vm.getCpuProfile() != null && ObjectUtils.equals(incoming.getCpuProfile().getId(), vm.getCpuProfile().getId())) { incoming.getCpuProfile().setId(null); } } } if (!isFiltered()) { if (incoming.isSetPlacementPolicy() && incoming.getPlacementPolicy().isSetHost() && incoming.getPlacementPolicy().getHost().isSetName() && !incoming.getPlacementPolicy().getHost().isSetId()) { incoming.getPlacementPolicy().getHost().setId(getHostId(incoming.getPlacementPolicy().getHost().getName())); } } else { incoming.setPlacementPolicy(null); } return removeRestrictedInfo( performUpdate(incoming, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class), VdcActionType.UpdateVm, new UpdateParametersProvider())); }

Target:
public VM update(VM incoming) { validateEnums(VM.class, incoming); validateParameters(incoming); if (incoming.isSetCluster() && (incoming.getCluster().isSetId() || incoming.getCluster().isSetName())) { Guid clusterId = lookupClusterId(incoming); VM vm = get(); if(!clusterId.toString().equals(vm.getCluster().getId())){ performAction(VdcActionType.ChangeVMCluster, new ChangeVMClusterParameters(clusterId, guid)); } } if (!isFiltered()) { if (incoming.isSetPlacementPolicy() && incoming.getPlacementPolicy().isSetHost() && incoming.getPlacementPolicy().getHost().isSetName() && !incoming.getPlacementPolicy().getHost().isSetId()) { incoming.getPlacementPolicy().getHost().setId(getHostId(incoming.getPlacementPolicy().getHost().getName())); } } else { incoming.setPlacementPolicy(null); } return removeRestrictedInfo( performUpdate(incoming, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class), VdcActionType.UpdateVm, new UpdateParametersProvider())); }
Source:
public void setup(OperatorContext context) { List<FieldInfo> fieldInfos = super.getFieldInfos(); JsonNode configArray; try { ObjectMapper mapper = new ObjectMapper(); configArray = mapper.readTree(configJsonString); for (int i = 0; i < configArray.size(); i++) { JsonNode node = configArray.get(i); fieldInfos.add(new FieldInfo(node.get("dbColumnName").asText(), node.get("input").asText(), null)); } } catch (IOException e) { throw new RuntimeException("Error loading config json file."); } windowTimeSec = (context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS) * 1.0) / 1000.0; super.setup(context); }

Target:
public void setup(OperatorContext context) { List<FieldInfo> fieldInfos = super.getFieldInfos(); JsonNode configArray; try { ObjectMapper mapper = new ObjectMapper(); configArray = mapper.readTree(configJsonString); for (int i = 0; i < configArray.size(); i++) { JsonNode node = configArray.get(i); fieldInfos.add(new FieldInfo(node.get("dbColumnName").asText(), node.get("input").asText(), null)); } } catch (IOException e) { throw new RuntimeException("Error loading config json file.", e); } windowTimeSec = (context.getValue(Context.OperatorContext.APPLICATION_WINDOW_COUNT) * context.getValue(Context.DAGContext.STREAMING_WINDOW_SIZE_MILLIS) * 1.0) / 1000.0; super.setup(context); }
Source:
public MessageWriter(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry) throws Exception { mConfig = config; mOffsetTracker = offsetTracker; mFileRegistry = fileRegistry; if (mConfig.getFileExtension() != null) { mFileExtension = mConfig.getFileExtension(); } else if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) { mCodec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec()); mFileExtension = mCodec.getDefaultExtension(); } else { mFileExtension = ""; } mLocalPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); mGeneration = mConfig.getGeneration(); }

Target:
public MessageWriter(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry) throws Exception { mConfig = config; mOffsetTracker = offsetTracker; mFileRegistry = fileRegistry; if (mConfig.getFileExtension() != null && !mConfig.getFileExtension().isEmpty()) { mFileExtension = mConfig.getFileExtension(); } else if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) { mCodec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec()); mFileExtension = mCodec.getDefaultExtension(); } else { mFileExtension = ""; } mLocalPrefix = mConfig.getLocalPath() + '/' + IdUtil.getLocalMessageDir(); mGeneration = mConfig.getGeneration(); }
Source:
public TrackingToken upperBound(TrackingToken other) { Assert.isTrue(other instanceof MultiSourceTrackingToken, () -> "Incompatible token type provided."); MultiSourceTrackingToken otherMultiToken = (MultiSourceTrackingToken) other; Assert.isTrue(otherMultiToken.trackingTokens.keySet().equals(this.trackingTokens.keySet()), () -> "MultiSourceTrackingTokens contain different keys"); Map<String, TrackingToken> tokenMap = new HashMap<>(); otherMultiToken.trackingTokens.forEach((key, otherToken) -> tokenMap.put(key, trackingTokens.get(key).upperBound(otherToken)) ); return new MultiSourceTrackingToken(tokenMap); }

Target:
public TrackingToken upperBound(TrackingToken other) { Assert.isTrue(other instanceof MultiSourceTrackingToken, () -> "Incompatible token type provided."); MultiSourceTrackingToken otherMultiToken = (MultiSourceTrackingToken) other; Assert.isTrue(otherMultiToken.trackingTokens.keySet().equals(this.trackingTokens.keySet()), () -> "MultiSourceTrackingTokens contain different keys"); Map<String, TrackingToken> tokenMap = new HashMap<>(); otherMultiToken.trackingTokens.forEach((tokenSourceName, otherToken) -> tokenMap.put(tokenSourceName, trackingTokens.get(tokenSourceName).upperBound(otherToken)) ); return new MultiSourceTrackingToken(tokenMap); }
Source:
public Tag update(Tag incoming) { if (parent.isSetParentName(incoming)) { incoming.getParent().getTag().setId(parent.getParentId(incoming)); } String existingParentId = getEntity(new QueryIdResolver(VdcQueryType.GetTagByTagId, GetTagByTagIdParameters.class), true).getparent_id() .toString(); if (isSetParent(incoming) && !existingParentId.equals(incoming.getParent().getTag().getId())) { moveTag(asGuid(incoming.getParent().getTag().getId())); } return performUpdate(incoming, new QueryIdResolver(VdcQueryType.GetTagByTagId, GetTagByTagIdParameters.class), VdcActionType.UpdateTag, new UpdateParametersProvider()); }

Target:
public Tag update(Tag incoming) { if (parent.isSetParentName(incoming)) { incoming.getParent().getTag().setId(parent.getParentId(incoming)); } Tag existingTag = get(); String existingTagParentId = existingTag.isSetParent() && existingTag.getParent().isSetTag() && existingTag.getParent().getTag().isSetId() ? existingTag.getParent() .getTag() .getId() : null; if (isSetParent(incoming) && !incoming.getParent().getTag().getId().equals(existingTagParentId)) { moveTag(asGuid(incoming.getParent().getTag().getId())); } return performUpdate(incoming, new QueryIdResolver(VdcQueryType.GetTagByTagId, GetTagByTagIdParameters.class), VdcActionType.UpdateTag, new UpdateParametersProvider()); }
Source:
public List<Breakpoint> getAllBreakpoints() throws DebuggerException { List<BreakpointRequest> breakpointRequests; try { breakpointRequests = getEventManager().breakpointRequests(); } catch (DebuggerException e) { Throwable cause = e.getCause(); if (cause instanceof VMCannotBeModifiedException) { return emptyList(); } throw e; } List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size()); for (BreakpointRequest breakpointRequest : breakpointRequests) { com.sun.jdi.Location location = breakpointRequest.location(); breakPoints.add( newDto(BreakpointDto.class) .withEnabled(true) .withBreakpointConfiguration( newDto(BreakpointConfigurationDto.class) .withHitCount((Integer) breakpointRequest.getProperty("hit_count"))) .withLocation(asDto(new JdbLocation(location)))); } breakPoints.sort(BREAKPOINT_COMPARATOR); return breakPoints; }

Target:
public List<Breakpoint> getAllBreakpoints() throws DebuggerException { List<BreakpointRequest> breakpointRequests; try { breakpointRequests = getEventManager().breakpointRequests(); } catch (DebuggerException e) { Throwable cause = e.getCause(); if (cause instanceof VMCannotBeModifiedException) { return emptyList(); } throw e; } List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size()); for (BreakpointRequest breakpointRequest : breakpointRequests) { com.sun.jdi.Location location = breakpointRequest.location(); breakPoints.add( newDto(BreakpointDto.class) .withEnabled(true) .withLocation(asDto(new JdbLocation(location)))); } breakPoints.sort(BREAKPOINT_COMPARATOR); return breakPoints; }
Source:
public IntegrationMBeanExporter mbeanExporter() { IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); setupDomain(exporter); setupServer(exporter); exporter.setRegistrationPolicy(this.attributes.<RegistrationPolicy>getEnum("registration")); exporter.setComponentNamePatterns(this.attributes.getStringArray("managedComponents")); return exporter; }

Target:
public IntegrationMBeanExporter mbeanExporter() { IntegrationMBeanExporter exporter = new IntegrationMBeanExporter(); exporter.setRegistrationPolicy(this.attributes.<RegistrationPolicy>getEnum("registration")); setupDomain(exporter); setupServer(exporter); setupComponentNamePatterns(exporter); return exporter; }
Source:
public BpmnModelResource getBpmnModel(@PathVariable String id) { BpmnModel bpmnModel = repositoryService.getBpmnModel(id); return bpmnModelResourceAssembler.toResource(new MetaBpmnModel(id, bpmnModel)); }

Target:
public String getBpmnModel(@PathVariable String id) { BpmnModel bpmnModel = repositoryService.getBpmnModel(id); ObjectNode json = new BpmnJsonConverter().convertToJson(bpmnModel); return json.toString(); }