auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CatalogEntitySummary getEntity(String entityId) { Maybe<VersionedName> versionedName = Osgis.parseOsgiIdentifier(entityId); String symbolicName; String version; if (versionedName.isPresent()) { symbolicName = versionedName.get().getSymbolicName(); version = (versionedName.get().getVersion() != null) ? versionedName.get().getVersion().toString() : BrooklynCatalog.DEFAULT_VERSION; } else { symbolicName = entityId; version = BrooklynCatalog.DEFAULT_VERSION; } @SuppressWarnings("unchecked") CatalogItem<? extends Entity,EntitySpec<?>> result = (CatalogItem<? extends Entity,EntitySpec<?>>) brooklyn().getCatalog().getCatalogItem(symbolicName, version); if (result==null) { throw WebResourceUtils.notFound("Entity with id '%s' not found", entityId); } return CatalogTransformer.catalogEntitySummary(brooklyn(), result); }

Target:
public CatalogEntitySummary getEntity(String entityId) { CatalogItem<? extends Entity,EntitySpec<?>> result = CatalogUtils.getCatalogItemOptionalVersion(mgmt(), Entity.class, entityId); if (result==null) { throw WebResourceUtils.notFound("Entity with id '%s' not found", entityId); } return CatalogTransformer.catalogEntitySummary(brooklyn(), result); }
Source:
public <X> ExtendedQueryResult<T> orderAsc(SingularAttribute<T, X> attribute, boolean appendEntityName) { lastPaginatedQuery = null; if (!context.getRepositoryMethod().isQuery()) { context.addCriteriaBuilderPostProcessor(new OrderByCriteriaBuilderPostProcessor(attribute, OrderDirection.ASC)); } else { context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC, appendEntityName)); } return this; }

Target:
public <X> ExtendedQueryResult<T> orderAsc(SingularAttribute<T, X> attribute, boolean appendEntityName) { lastPaginatedQuery = null; if (context.getRepositoryMethod().isQuery()) { context.addQueryStringPostProcessor(new OrderByQueryStringPostProcessor(attribute, OrderDirection.ASC, appendEntityName)); } else { context.addCriteriaBuilderPostProcessor(new OrderByCriteriaBuilderPostProcessor(attribute, OrderDirection.ASC)); } return this; }
Source:
public Map<String, IdealState> computeNewIdealStates(ResourceControllerDataProvider clusterData, Map<String, Resource> resourceMap, final CurrentStateOutput currentStateOutput) throws HelixRebalanceException { if (resourceMap.isEmpty()) { LOG.warn("There is no resource to be rebalanced by {}", this.getClass().getSimpleName()); return Collections.emptyMap(); } LOG.info("Start computing new ideal states for resources: {}", resourceMap.keySet().toString()); if (!resourceMap.entrySet().stream().allMatch(resourceEntry -> { IdealState is = clusterData.getIdealState(resourceEntry.getKey()); return is != null && is.getRebalanceMode().equals(IdealState.RebalanceMode.FULL_AUTO) && getClass().getName().equals(is.getRebalancerClassName()); })) { throw new HelixRebalanceException( "Input contains invalid resource(s) that cannot be rebalanced by the WAGED rebalancer.", HelixRebalanceException.Type.INVALID_INPUT); } Map<String, IdealState> newIdealStates = computeBestPossibleStates(clusterData, resourceMap, currentStateOutput); for (IdealState is : newIdealStates.values()) { String resourceName = is.getResourceName(); ResourceAssignment finalAssignment = _mappingCalculator.computeBestPossiblePartitionState( clusterData, is, resourceMap.get(resourceName), currentStateOutput); is.getRecord().getMapFields().clear(); for (Partition partition : finalAssignment.getMappedPartitions()) { Map<String, String> newStateMap = finalAssignment.getReplicaMap(partition); is.setInstanceStateMap(partition.getPartitionName(), newStateMap == null ? Collections.emptyMap() : newStateMap); } } LOG.info("Finish computing new ideal states for resources: {}", resourceMap.keySet().toString()); return newIdealStates; }

Target:
public Map<String, IdealState> computeNewIdealStates(ResourceControllerDataProvider clusterData, Map<String, Resource> resourceMap, final CurrentStateOutput currentStateOutput) throws HelixRebalanceException { if (resourceMap.isEmpty()) { LOG.warn("There is no resource to be rebalanced by {}", this.getClass().getSimpleName()); return Collections.emptyMap(); } LOG.info("Start computing new ideal states for resources: {}", resourceMap.keySet().toString()); validateInput(clusterData, resourceMap); Map<String, IdealState> newIdealStates = computeBestPossibleStates(clusterData, resourceMap, currentStateOutput); for (IdealState is : newIdealStates.values()) { String resourceName = is.getResourceName(); ResourceAssignment finalAssignment = _mappingCalculator.computeBestPossiblePartitionState( clusterData, is, resourceMap.get(resourceName), currentStateOutput); is.getRecord().getMapFields().clear(); for (Partition partition : finalAssignment.getMappedPartitions()) { Map<String, String> newStateMap = finalAssignment.getReplicaMap(partition); is.setInstanceStateMap(partition.getPartitionName(), newStateMap == null ? Collections.emptyMap() : newStateMap); } } LOG.info("Finish computing new ideal states for resources: {}", resourceMap.keySet().toString()); return newIdealStates; }
Source:
public MQTTDataGenerator connectToTopic(final String topic) { MQTTDataGenerator dataGenerator = dataGeneratorMap.get(topic); if (dataGenerator == null) { dataGenerator = new MQTTDataGenerator(this, topic); dataGeneratorMap.put(topic, dataGenerator); } return dataGenerator; }

Target:
public MQTTDataGenerator connectToTopic(final String topic) { MQTTDataGenerator dataGenerator = dataGeneratorMap.get(topic); if (dataGenerator == null) { dataGenerator = new MQTTDataGenerator(this, topic); dataGeneratorMap.putIfAbsent(topic, dataGenerator); dataGenerator = dataGeneratorMap.get(topic); } return dataGenerator; }
Source:
public int getActionFilters() { Integer actionFilterId; int i = 0; List<FilterSet> filterSetList = new ArrayList<>(taskContext.getTask().getTaskConfig().getFilters()); for (FilterSet filterSet : filterSetList) { actionFilterId = filterSet.getActionOrder(); if(actionFilterId != null) { return i; } i++; } return i; }

Target:
public int getActionFilters() { int firstActionFilterIndex = 0; boolean actionFilterExist = false; List<FilterSet> filterSetList = new ArrayList<>(taskContext.getTask().getTaskConfig().getFilters()); for (int i = 0; i < filterSetList.size(); i++){ if(isActionFilter(filterSetList.get(i)) && !actionFilterExist) { firstActionFilterIndex = i; actionFilterExist = true; } else if (!isActionFilter(filterSetList.get(i))) { firstActionFilterIndex = filterSetList.size(); } } return firstActionFilterIndex; }
Source:
public void onRequestTargetSet(RequestCycle cycle, Class<? extends IRequestablePage> requestTarget) { WicketCallback.super.onRequestTargetSet(cycle, requestTarget); LockType type = THREAD_LOCK.get(); Class<? extends IRequestablePage> requestedPage = THREAD_REQUESTED_PAGE.get(); if (type != null && requestedPage != null && requestedPage != requestTarget) { boolean lockTaken = locker.tryLock(type); if (!lockTaken && !GeoServerUnlockablePage.class.isAssignableFrom(requestTarget)) { cycle.setResponsePage(ServerBusyPage.class); } } }

Target:
public void onRequestTargetSet(RequestCycle cycle, Class<? extends IRequestablePage> requestTarget) { if (!GeoServerUnlockablePage.class.isAssignableFrom(requestTarget)) { LockType type = THREAD_LOCK.get(); if (type != null || requestTarget == null) { return; } if (GeoServerSecuredPage.class.isAssignableFrom(requestTarget)) { type = LockType.WRITE; } if (type == null) { type = LockType.READ; } boolean lockTaken = locker.tryLock(type); if (lockTaken) { THREAD_LOCK.set(type); } } LockType type = THREAD_LOCK.get(); if (cycle != null && type != null) { boolean lockTaken = locker.tryLock(type); if (!lockTaken && !GeoServerUnlockablePage.class.isAssignableFrom(requestTarget)) { cycle.setResponsePage(ServerBusyPage.class); } } }
Source:
private static void configureJaCoCoCoverageReport(final Test testTask, final boolean addForGroovy, Project project, final Map<String, Object> properties) { project.getTasks().withType(JacocoReport.class, jacocoReportTask -> { SingleFileReport xmlReport = jacocoReportTask.getReports().getXml(); if (xmlReport.isEnabled() && xmlReport.getDestination().exists()) { appendProp(properties, "sonar.coverage.jacoco.xmlReportPaths", xmlReport.getDestination()); } }); project.getPlugins().withType(JacocoPlugin.class, jacocoPlugin -> { JacocoTaskExtension jacocoTaskExtension = testTask.getExtensions().getByType(JacocoTaskExtension.class); File destinationFile = jacocoTaskExtension.getDestinationFile(); if (destinationFile.exists()) { properties.put("sonar.jacoco.reportPath", destinationFile); appendProp(properties, "sonar.jacoco.reportPaths", destinationFile); if (addForGroovy) { properties.put("sonar.groovy.jacoco.reportPath", destinationFile); } } }); }

Target:
private static void configureJaCoCoCoverageReport(final Test testTask, final boolean addForGroovy, Project project, final Map<String, Object> properties) { project.getTasks().withType(JacocoReport.class, jacocoReportTask -> { SingleFileReport xmlReport = jacocoReportTask.getReports().getXml(); if (xmlReport.isEnabled() && xmlReport.getDestination().exists()) { appendProp(properties, "sonar.coverage.jacoco.xmlReportPaths", xmlReport.getDestination()); } else { LOGGER.info("JaCoCo report task detected, but XML report is not enabled or it was not produced. " + "Coverage for this task will not be reported."); } }); project.getPlugins().withType(JacocoPlugin.class, jacocoPlugin -> { JacocoTaskExtension jacocoTaskExtension = testTask.getExtensions().getByType(JacocoTaskExtension.class); File destinationFile = jacocoTaskExtension.getDestinationFile(); if (destinationFile.exists()) { properties.put("sonar.jacoco.reportPath", destinationFile); appendProp(properties, "sonar.jacoco.reportPaths", destinationFile); if (addForGroovy) { properties.put("sonar.groovy.jacoco.reportPath", destinationFile); } } }); }
Source:
public boolean isTopologyStateful() { Map<String, Object> config = topologyContext.getTopologyConfig(); return String.valueOf(Config.TopologyReliabilityMode.EFFECTIVELY_ONCE).equals( config.get(Config.TOPOLOGY_RELIABILITY_MODE)); }

Target:
public boolean isTopologyStateful() { Map<String, Object> config = topologyContext.getTopologyConfig(); Config.TopologyReliabilityMode mode = Config.TopologyReliabilityMode.valueOf( String.valueOf(config.get(Config.TOPOLOGY_RELIABILITY_MODE))); return Config.TopologyReliabilityMode.EFFECTIVELY_ONCE.equals(mode); }
Source:
public void getScoreTotal() { TestdataEntity e1 = new TestdataEntity("e1"); TestdataEntity e2 = new TestdataEntity("e2"); TestdataEntity e3 = new TestdataEntity("e3"); ConstraintMatchTotal constraintMatchTotal = new ConstraintMatchTotal("package1", "constraint1", SimpleScore.ZERO); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.ZERO); ConstraintMatch match1 = constraintMatchTotal.addConstraintMatch(asList(e1, e2), SimpleScore.of(-1)); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.of(-1)); ConstraintMatch match2 = constraintMatchTotal.addConstraintMatch(asList(e1, e3), SimpleScore.of(-20)); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.of(-21)); ConstraintMatch match3 = constraintMatchTotal.addConstraintMatch(asList(e2, e1), SimpleScore.of(-300)); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.of(-321)); constraintMatchTotal.removeConstraintMatch(match2); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.of(-301)); constraintMatchTotal.removeConstraintMatch(match1); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.of(-300)); constraintMatchTotal.removeConstraintMatch(match3); assertThat(constraintMatchTotal.getScore()).isEqualTo((org.optaplanner.core.api.score.Score) SimpleScore.ZERO); }

Target:
public void getScoreTotal() { TestdataEntity e1 = new TestdataEntity("e1"); TestdataEntity e2 = new TestdataEntity("e2"); TestdataEntity e3 = new TestdataEntity("e3"); ConstraintMatchTotal constraintMatchTotal = new ConstraintMatchTotal("package1", "constraint1", SimpleScore.ZERO); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.ZERO); ConstraintMatch match1 = constraintMatchTotal.addConstraintMatch(asList(e1, e2), SimpleScore.of(-1)); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.of(-1)); ConstraintMatch match2 = constraintMatchTotal.addConstraintMatch(asList(e1, e3), SimpleScore.of(-20)); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.of(-21)); ConstraintMatch match3 = constraintMatchTotal.addConstraintMatch(asList(e2, e1), SimpleScore.of(-300)); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.of(-321)); constraintMatchTotal.removeConstraintMatch(match2); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.of(-301)); constraintMatchTotal.removeConstraintMatch(match1); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.of(-300)); constraintMatchTotal.removeConstraintMatch(match3); assertThat(constraintMatchTotal.getScore()).isEqualTo(SimpleScore.ZERO); }
Source:
public void testOpenshiftConnection(OpenShift3Connection connection) { log.info("Performing test of OS 3 connection: " + connection.getTreeItem().getText()); connection.refresh(); try { new WaitUntil(new ShellIsAvailable("Problem occurred"), TimePeriod.getCustom(30)); CDKUtils.captureScreenshot("CDKServerAdapterAbstractTest#testOpenshiftConnection"); new DefaultShell("Problem occurred").close(); fail("Problem dialog occured when refreshing OpenShift connection"); } catch (WaitTimeoutExpiredException ex) { log.info("Expected WaitTimeoutExpiredException occured"); } }

Target:
public void testOpenshiftConnection(OpenShift3Connection connection) { log.info("Performing test of OS 3 connection: " + connection.getTreeItem().getText()); connection.refresh(); try { new WaitUntil(new ShellIsAvailable(CDKLabel.Shell.PROBLEM_DIALOG), TimePeriod.getCustom(30)); CDKUtils.captureScreenshot("CDKServerAdapterAbstractTest#testOpenshiftConnection"); new DefaultShell(CDKLabel.Shell.PROBLEM_DIALOG).close(); fail("Problem dialog occured when refreshing OpenShift connection"); } catch (WaitTimeoutExpiredException ex) { log.info("Expected WaitTimeoutExpiredException occured"); } }
Source:
public void testGetAllFromDisksIncludingSnapshotsByDiskId() { List<Disk> result = dao.getAllFromDisksIncludingSnapshotsByDiskId(FixturesTool.IMAGE_GROUP_ID, null, false); List<Disk> sameImageIdDisks = result.stream().filter(disk -> disk.getId().equals(FixturesTool.IMAGE_GROUP_ID)).collect( Collectors.toList()); assertEquals("wrong number of returned disks", 4, sameImageIdDisks.size()); }

Target:
public void testGetAllFromDisksIncludingSnapshotsByDiskId() { List<Disk> result = dao.getAllFromDisksIncludingSnapshotsByDiskId(FixturesTool.IMAGE_GROUP_ID, null, false); assertEquals("wrong number of returned disks", 4, result.size()); }
Source:
public String getName() { return "Byte_array"; }

Target:
public String getName() { return "byte_array_as_string"; }
Source:
public String[] getAdapterNames() { if (element.isValid()) { String[] adapters = Arrays.stream(element.getChildren()) .filter(child -> "adapter".equals(child.getName())) .map(child -> child.getAttribute("type")) .filter(Objects::nonNull).toArray(String[]::new); if (adapters.length == 0) { logError(); } return adapters; } String msg = NLS.bind(RegistryMessages.adapters_cantInstansiate, "<unknown>", "<unknown>"); RuntimeLog.log(new Status(IStatus.ERROR, RegistryMessages.OWNER_NAME, 0, msg, null)); return new String[0]; }

Target:
public String[] getAdapterNames() { return adapterNames; }
Source:
public static void showPushNotification(Context context, Intent messageIntent) { final MPConfig config = MPConfig.getInstance(context); String resourcePackage = config.getResourcePackageName(); if (null == resourcePackage) { resourcePackage = context.getPackageName(); } final ResourceIds drawableIds = new ResourceReader.Drawables(resourcePackage, context); final Context applicationContext = context.getApplicationContext(); MixpanelPushNotification mixpanelPushNotification = new MixpanelPushNotification(applicationContext, drawableIds); Notification notification = mixpanelPushNotification.createNotification(messageIntent); if (null != notification) { final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0, notification); } }

Target:
public static void showPushNotification(Context context, Intent messageIntent) { MixpanelPushNotification mixpanelPushNotification = new MixpanelPushNotification(context.getApplicationContext()); showPushNotification(context, messageIntent, mixpanelPushNotification); }
Source:
public void setUp() throws IOException { bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); JobSearchCreateTenant.createTenant(PROJECT_ID, TENANT_EXT_ID); String got = bout.toString(); assertThat(got).contains("Created Tenant"); tenantId = JobSearchListGetCompanyTest.extractLastId(got.split("\n")[1]); bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); JobSearchCreateCompany.createCompany( PROJECT_ID, tenantId, COMPANY_DISPLAY_NAME, COMPANY_EXT_ID); got = bout.toString(); assertThat(got).contains("Created Company"); companyId = JobSearchListGetCompanyTest.extractLastId(got.split("\n")[1]); bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); JobSearchCreateJob.createJob( PROJECT_ID, tenantId, companyId, POST_UNIQUE_ID, "Developer Programs Engineer", "Developer Programs Engineers are the Engineering wing of Developer Relations.", "<LINK_0>", "Moantain View, CA", "94035", "en-US"); got = bout.toString(); assertThat(got).contains("Created job:"); jobId = JobSearchListGetCompanyTest.extractLastId(got.split("\n")[0].trim()); bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); }

Target:
public void setUp() throws IOException { bout = new ByteArrayOutputStream(); out = new PrintStream(bout); System.setOut(out); }
Source:
public Iterable<String> getAllContainerNames() { ArrayList<String> containers = new ArrayList<String>(containerToBlobs.keySet()); Collections.sort(containers); return containers; }

Target:
public Collection<String> getAllContainerNames() { return containerToBlobs.keySet(); }
Source:
public JobStatus waitForCompletion(final String jobId, final long blockTimeout, final long pollTime) throws GenieClientException, InterruptedException, IOException { if (StringUtils.isEmpty(jobId)) { throw new IllegalArgumentException("Missing required parameter: jobId."); } final long startTime = System.currentTimeMillis(); while (true) { final JobStatus status = this.getJobStatus(jobId); if (status == JobStatus.FAILED || status == JobStatus.KILLED || status == JobStatus.SUCCEEDED) { return status; } if (System.currentTimeMillis() - startTime < blockTimeout) { Thread.sleep(pollTime); } else { throw new GenieClientException("Timed out waiting for job to finish"); } } }

Target:
public JobStatus waitForCompletion(final String jobId, final long blockTimeout, final long pollTime) throws GenieClientException, InterruptedException, IOException, GenieTimeoutException { if (StringUtils.isEmpty(jobId)) { throw new IllegalArgumentException("Missing required parameter: jobId."); } final long startTime = System.currentTimeMillis(); while (true) { final JobStatus status = this.getJobStatus(jobId); if (status == JobStatus.FAILED || status == JobStatus.KILLED || status == JobStatus.SUCCEEDED) { return status; } if (System.currentTimeMillis() - startTime < blockTimeout) { Thread.sleep(pollTime); } else { throw new GenieTimeoutException("Timed out waiting for job to finish"); } } }
Source:
public VoltTable[] run( String targetStream, int pkey ) { if (targetStream.equals("S_ALLOW_NULLS_REPL")) { } else if (targetStream.equals("S_ALLOW_NULLS")) { voltQueueSQL(i_insert_select_part); } else { assert(false); throw new RuntimeException("Don't call this."); } return voltExecuteSQL(); }

Target:
public VoltTable[] run( String targetStream, int pkey ) { if (targetStream.equals("S_ALLOW_NULLS_REPL")) { } else if (targetStream.equals("S_ALLOW_NULLS")) { voltQueueSQL(i_insert_select_part); } else { throw new RuntimeException("Don't call this."); } return voltExecuteSQL(); }
Source:
public AnnotationBasedTestInjectorManager(Class<?> classUnderTest) { getModulesForTestClass(classUnderTest); getMocksForTestClass(classUnderTest); getSpiesForTargetKeys(Elements.getElements(modulesForTestClass)); testCompositeConfig = new TestCompositeConfig(classLevelOverrides, methodLevelOverrides); overrideModules.add(new ArchaiusTestConfigOverrideModule(testCompositeConfig)); injector = createInjector(modulesForTestClass, overrideModules); }

Target:
public AnnotationBasedTestInjectorManager(Class<?> classUnderTest) { inspectModulesForTestClass(classUnderTest); inspectMocksForTestClass(classUnderTest); inspectSpiesForTargetKeys(Elements.getElements(modulesForTestClass)); testCompositeConfig = new TestCompositeConfig(classLevelOverrides, methodLevelOverrides); overrideModules.add(new ArchaiusTestConfigOverrideModule(testCompositeConfig)); injector = createInjector(modulesForTestClass, overrideModules); }
Source:
public void tearDown() throws Exception { if (workspaceServiceClient.exists(WORKSPACE_NAME, adminTestUser.getName())) { workspaceServiceClient.stop(WORKSPACE_NAME, adminTestUser.getName()); workspaceServiceClient.delete(WORKSPACE_NAME, adminTestUser.getName()); } org.delete(); }

Target:
public void tearDown() throws Exception { workspaceServiceClient.delete(WORKSPACE_NAME, adminTestUser.getName()); org.delete(); }
Source:
public ArrayList<String> loadVarScope() { File file = new File(scopefile); Scanner input = null; try { input = new Scanner(file); } catch (FileNotFoundException e) { e.printStackTrace(); } if (input != null) { while (input.hasNext()) { String nextLine = input.nextLine(); if (null == nextLine) break; if (!nextLine.equals("")) scope.add(nextLine); } input.close(); } return getScope(); }

Target:
public ArrayList<String> loadVarScope() { File file = new File(scopefile); Scanner input = null; try { input = new Scanner(file); } catch (FileNotFoundException e) { e.printStackTrace(); } while (input.hasNext()) { String nextLine = input.nextLine(); if (null == nextLine) break; if (!nextLine.equals("")) scope.add(nextLine); } input.close(); return getScope(); }
Source:
IkeDeletePayload(boolean critical, byte[] payloadBody) throws IkeException { super(PAYLOAD_TYPE_DELETE, critical); ByteBuffer inputBuffer = ByteBuffer.wrap(payloadBody); protocolId = Byte.toUnsignedInt(inputBuffer.get()); spiSize = inputBuffer.get(); numSpi = Short.toUnsignedInt(inputBuffer.getShort()); spisToDelete = new int[numSpi]; switch (protocolId) { case PROTOCOL_ID_IKE: if (spiSize != SPI_LEN_NOT_INCLUDED || numSpi != 0 || inputBuffer.remaining() != 0) { throw new InvalidSyntaxException("Invalid Delete IKE Payload."); } break; case PROTOCOL_ID_ESP: if (spiSize == SPI_LEN_NOT_INCLUDED || numSpi == 0 || inputBuffer.remaining() != SPI_LEN_IPSEC * numSpi) { throw new InvalidSyntaxException("Invalid Delete Child Payload."); } for (int i = 0; i < numSpi; i++) { spisToDelete[i] = inputBuffer.getInt(); } break; default: throw new InvalidSyntaxException("Unrecognized protocol in Delete Payload."); } }

Target:
IkeDeletePayload(boolean critical, byte[] payloadBody) throws IkeException { super(PAYLOAD_TYPE_DELETE, critical); ByteBuffer inputBuffer = ByteBuffer.wrap(payloadBody); protocolId = Byte.toUnsignedInt(inputBuffer.get()); spiSize = inputBuffer.get(); numSpi = Short.toUnsignedInt(inputBuffer.getShort()); spisToDelete = new int[numSpi]; switch (protocolId) { case PROTOCOL_ID_IKE: if (spiSize != SPI_LEN_NOT_INCLUDED || numSpi != 0 || inputBuffer.remaining() != 0) { throw new InvalidSyntaxException("Invalid Delete IKE Payload."); } break; case PROTOCOL_ID_ESP: if (spiSize != SPI_LEN_IPSEC || numSpi == 0 || inputBuffer.remaining() != SPI_LEN_IPSEC * numSpi) { throw new InvalidSyntaxException("Invalid Delete Child Payload."); } for (int i = 0; i < numSpi; i++) { spisToDelete[i] = inputBuffer.getInt(); } break; default: throw new InvalidSyntaxException("Unrecognized protocol in Delete Payload."); } }
Source:
public T store(T o) throws RiakException { final Mutation<T> mutation = mutationProducer.produce(o); final StoreObject<T> so = bucket.store(o) .withConverter(converter) .withMutator(mutation) .withResolver(resolver) .withRetrier(retrier); if (fetchMeta.getR() != null) { so.r(fetchMeta.getR()); } if (storeMeta.hasW()) { so.w(storeMeta.getW()); } if (storeMeta.hasDw()) { so.dw(storeMeta.getDw()); } if (fetchMeta.hasPr()) { so.pr(fetchMeta.getPr()); } if (storeMeta.hasPw()) { so.pw(storeMeta.getPw()); } if (fetchMeta.hasBasicQuorum()) { so.basicQuorum(fetchMeta.getBasicQuorum()); } if (fetchMeta.hasNotFoundOk()) { so.notFoundOK(fetchMeta.getNotFoundOK()); } if (storeMeta.hasIfNotModified()) { so.ifNotModified(storeMeta.isIfNotModified()); } if (storeMeta.hasIfNonMatch()) { so.ifNonMatch(storeMeta.isIfNonMatch()); } if (fetchMeta.hasReturnDeletedVClock()) { so.returnDeletedVClock(fetchMeta.getReturnDeletedVClock()); } if (storeMeta.hasReturnBody()) { so.returnBody(storeMeta.getReturnBody()); } return so.execute(); }

Target:
public T store(T o) throws RiakException { final Mutation<T> mutation = mutationProducer.produce(o); final StoreObject<T> so = bucket.store(o) .withConverter(converter) .withMutator(mutation) .withResolver(resolver) .withRetrier(retrier); if (fetchMeta.getR() != null) { so.r(fetchMeta.getR()); } if (storeMeta.hasW()) { so.w(storeMeta.getW()); } if (storeMeta.hasDw()) { so.dw(storeMeta.getDw()); } if (fetchMeta.hasPr()) { so.pr(fetchMeta.getPr()); } if (storeMeta.hasPw()) { so.pw(storeMeta.getPw()); } if (fetchMeta.hasBasicQuorum()) { so.basicQuorum(fetchMeta.getBasicQuorum()); } if (fetchMeta.hasNotFoundOk()) { so.notFoundOK(fetchMeta.getNotFoundOK()); } if (storeMeta.hasIfNotModified()) { so.ifNotModified(storeMeta.isIfNotModified()); } if (storeMeta.hasIfNoneMatch()) { so.ifNoneMatch(storeMeta.isIfNoneMatch()); } if (fetchMeta.hasReturnDeletedVClock()) { so.returnDeletedVClock(fetchMeta.getReturnDeletedVClock()); } if (storeMeta.hasReturnBody()) { so.returnBody(storeMeta.getReturnBody()); } return so.execute(); }
Source:
public void initialize(TransformContext context) throws Exception { super.initialize(context); init(null, context.getFailureCollector()); }

Target:
public void initialize(TransformContext context) throws Exception { super.initialize(context); FailureCollector collector = context.getFailureCollector(); init(null, collector); collector.getOrThrowException(); }
Source:
public String toString(Schema schema) { Iterable<String> strings = Iterables.transform(set, new ToString<T>(schema)); return Joiner.on(',').join(Sets.newTreeSet(strings)); }

Target:
public String toString(Schema schema) { return Joiner.on(',').join( Iterables.transform(set, new ToString<T>(schema))); }
Source:
@Override public void onPositiveClicked(@NonNull String instanceTag) { switch (instanceTag) { case TAG_ADD_SITE_ICON_DIALOG: ActivityLauncher.showPhotoPickerForResult(getActivity(), MediaBrowserType.SITE_ICON_PICKER, getSelectedSite()); break; case TAG_CHANGE_SITE_ICON_DIALOG: ActivityLauncher.showPhotoPickerForResult(getActivity(), MediaBrowserType.SITE_ICON_PICKER, getSelectedSite()); break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }

Target:
public void onPositiveClicked(@NonNull String instanceTag) { switch (instanceTag) { case TAG_ADD_SITE_ICON_DIALOG: case TAG_CHANGE_SITE_ICON_DIALOG: ActivityLauncher.showPhotoPickerForResult(getActivity(), MediaBrowserType.SITE_ICON_PICKER, getSelectedSite()); break; case TAG_EDIT_SITE_ICON_PERMISSIONS_DIALOG: break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }
Source:
public final void setAdapterFactory(AdapterFactory adapterFactory) { this.adapterFactory = adapterFactory; clearCache(); setEnabled(editingDomain != null && updateSelection(getStructuredSelection())); }

Target:
public final void setAdapterFactory(AdapterFactory adapterFactory) { this.adapterFactory = adapterFactory; if (adapterFactory != null) { contextualizeTooltip(); } }
Source:
private ConjureGetFreshTimestampsResponse makeTimestampsRequest() { return conjureTimelockService.getFreshTimestamps( AuthHeader.valueOf("Bearer unused"), CLIENT, ConjureGetFreshTimestampsRequest.of(10)); }

Target:
private ConjureGetFreshTimestampsResponse makeTimestampsRequest() { return conjureTimelockService.getFreshTimestamps( AuthHeader.valueOf("Bearer unused"), CLIENT, ConjureGetFreshTimestampsRequest.of(96)); }
Source:
protected void executeCommand() { boolean succeeded = false; try { Guid vmId = getParameters().getVmId(); List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); if (vmNumaNodes != null && vmNumaNodes.size() > 0) { Guid vdsId = getVm().getDedicatedVmForVds(); List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (vdsId != null) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); } List<VdsNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { int index = pair.getSecond().getSecond(); for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); pair.getSecond().setFirst(true); break; } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massSaveNumaNode(nodes, null, vmId); setActionReturnValue(nodes.get(0).getId()); } succeeded = true; } finally { setSucceeded(succeeded); } }

Target:
protected void executeCommand() { Guid vmId = getParameters().getVmId(); List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); Guid vdsId = getVm().getDedicatedVmForVds(); List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (vdsId != null) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); } List<VdsNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { int index = pair.getSecond().getSecond(); for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); pair.getSecond().setFirst(true); break; } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massSaveNumaNode(nodes, null, vmId); setActionReturnValue(nodes.get(0).getId()); setSucceeded(true); }
Source:
int getAddIndex(final WiresShape wiresShape, final WiresContainer container) { Node parent = WiresUtils.getNode(getCanvasHandler(), container); if (parent.getInEdges().size() == 0) { final double shapeX = wiresShape.getComputedLocation().getX(); final List<WiresShape> children = container.getChildShapes().toList().stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) wiresShape).getUUID())) .collect(Collectors.toList()); int targetIndex = children.size(); for (int idx = 0; idx < children.size(); idx++) { final WiresShape child = children.get(idx); if (shapeX < child.getComputedLocation().getX()) { targetIndex = idx; break; } } return targetIndex; } if (state.getOriginalParent().isPresent()) { if (state.getOriginalParent().get().equals(container)) { return parent.getOutEdges().size() - 1; } } return parent.getOutEdges().size(); }

Target:
int getAddIndex(final WiresShape wiresShape, final WiresContainer container) { Node parent = WiresUtils.getNode(getCanvasHandler(), container); if (parent.getInEdges().size() == 0) { final double shapeX = wiresShape.getComputedLocation().getX(); final List<WiresShape> children = container.getChildShapes().toList().stream() .filter(s -> !((WiresShapeView) s).getUUID().equals(((WiresShapeView) wiresShape).getUUID())) .collect(Collectors.toList()); int targetIndex = children.size(); for (int idx = 0; idx < children.size(); idx++) { final WiresShape child = children.get(idx); if (shapeX < child.getComputedLocation().getX()) { targetIndex = idx; break; } } return targetIndex; } return state.getOriginalParent() .filter(container::equals) .map(p -> parent.getOutEdges().size() -1) .orElse(parent.getOutEdges().size()); }
Source:
public static Object sleepFor(Object payload, long millis) { try { Thread.sleep(millis); } catch (InterruptedException e) { currentThread().interrupt(); return payload; } return payload; }

Target:
public static Object sleepFor(Object payload, long millis) { try { sleep(millis); } catch (InterruptedException e) { currentThread().interrupt(); } return payload; }
Source:
public static String[][] to2DStringArray(Collection coll) { String[][] arr2D = new String[coll.size()][]; Iterator it = coll.iterator(); int i = 0; for (;it.hasNext();i++) { arr2D[i] = new String[]{ (String) it.next()}; } return arr2D; }

Target:
public static String[][] to2DStringArray(Collection coll) { return (String[][]) coll.toArray( new String[coll.size()][] ); }
Source:
private CacheKey fillKey(CacheKey key, Event event) { key.setTenantId(event.getTenantId()); key.setDataId(event.getId()); return key; }

Target:
private CacheKey fillKey(CacheKey key, Event event) { key.setTenantId(event.getTenantId()); key.setDataId(event.getDataId()); return key; }
Source:
public Scope enter() { GroovyInterceptor sandbox = new SandboxInterceptor(whitelist()); ApprovalContext _context = context != null ? context : ApprovalContext.create(); sandbox.register(); ScriptApproval.pushRegistrationCallback(x -> { if (ExtensionList.lookup(RootAction.class).get(ScriptApproval.class) == null) { return; } String signature = x.getSignature(); if (signature != null && !StaticWhitelist.isPermanentlyBlacklisted(signature)) { ScriptApproval.get().accessRejected(x, _context); } if (listener != null) { ScriptApprovalNote.print(listener, x); } }); return () -> { sandbox.unregister(); ScriptApproval.popRegistrationCallback(); }; }

Target:
public Scope enter() { GroovyInterceptor sandbox = new SandboxInterceptor(whitelist()); ApprovalContext _context = context != null ? context : ApprovalContext.create(); sandbox.register(); ScriptApproval.pushRegistrationCallback(x -> { if (ExtensionList.lookup(RootAction.class).get(ScriptApproval.class) == null) { return; } String signature = x.getSignature(); if (!StaticWhitelist.isPermanentlyBlacklisted(signature)) { ScriptApproval.get().accessRejected(x, _context); } if (listener != null) { ScriptApprovalNote.print(listener, x); } }); return () -> { sandbox.unregister(); ScriptApproval.popRegistrationCallback(); }; }
Source:
public void process(org.atlasapi.remotesite.pa.profiles.bindings.Person paPerson) { Optional<Person> optionalPerson = ingestPerson(paPerson); Person person; if (!optionalPerson.isPresent()) { return; } else { person = optionalPerson.get(); } Optional<Person> existing = personResolver.person(person.getCanonicalUri()); if (!existing.isPresent()) { personWriter.createOrUpdatePerson(person); } else { merge(existing.get(), person); personWriter.createOrUpdatePerson(existing.get()); } }

Target:
public void process(org.atlasapi.remotesite.pa.profiles.bindings.Person paPerson) { Optional<Person> optionalPerson = ingestPerson(paPerson); Person person; if (!optionalPerson.isPresent()) { return; } person = optionalPerson.get(); Optional<Person> existing = personResolver.person(person.getCanonicalUri()); if (!existing.isPresent()) { personWriter.createOrUpdatePerson(person); } else { merge(existing.get(), person); personWriter.createOrUpdatePerson(existing.get()); } }
Source:
public void activate(boolean redo) { if (SageConstants.ENFORCE_EMBEDDED_RESTRICTIONS && Sage.EMBEDDED && (!System.getProperty("java.version").startsWith("phoneme_advanced") || System.getProperty("os.name").indexOf("Linux") == -1 || System.getProperty("os.version").indexOf("sigma") == -1) && Math.random() < 0.05) System.exit(0); active = true; if (!comp.hasFreshlyLoadedContext() && !redo) comp.reloadAttributeContext(); Catbert.processUISpecificHook("BeforeMenuLoad", new Object[]{Boolean.valueOf(redo)}, uiMgr, false); if (!active) { comp.unfreshAttributeContext(); return; } comp.setMenuLoadedState(true); comp.evaluateTree(true, false); comp.evaluateTree(false, true); comp.recalculateDynamicFonts(); comp.invalidateAll(); if (comp.getWidth() > 0 && comp.getHeight() > 0) comp.doLayout(); if ((comp.hasFocusableChildren() || uiMgr.allowHiddenFocus()) && (!redo || !comp.doesHierarchyHaveFocus())) { Catbert.processUISpecificHook("MenuNeedsDefaultFocus", new Object[]{Boolean.valueOf(redo)}, uiMgr, false); if (!comp.doesHierarchyHaveFocus()) { if (!comp.checkForcedFocus()) comp.setDefaultFocus(); } } multipleTextInputs = comp.getNumTextInputs(0) > 1; uiMgr.getRootPanel().getRenderEngine().setMenuHint(widg.getName(), null, comp.getNumTextInputs(0)>0); }

Target:
public void activate(boolean redo) { if (SageConstants.ENFORCE_EMBEDDED_RESTRICTIONS && Sage.EMBEDDED && (!System.getProperty("java.version").startsWith("phoneme_advanced") || System.getProperty("os.name").indexOf("Linux") == -1 || System.getProperty("os.version").indexOf("sigma") == -1) && Math.random() < 0.05) System.exit(0); active = true; if (!comp.hasFreshlyLoadedContext() && !redo) comp.reloadAttributeContext(); Catbert.processUISpecificHook("BeforeMenuLoad", new Object[]{Boolean.valueOf(redo)}, uiMgr, false); if (!active) { comp.unfreshAttributeContext(); return; } comp.setMenuLoadedState(true); comp.evaluateTree(true, false); comp.evaluateTree(false, true); comp.recalculateDynamicFonts(); comp.invalidateAll(); if (comp.getWidth() > 0 && comp.getHeight() > 0) comp.doLayout(); if ((comp.hasFocusableChildren() || uiMgr.allowHiddenFocus()) && (!redo || !comp.doesHierarchyHaveFocus())) { Catbert.processUISpecificHook("MenuNeedsDefaultFocus", new Object[]{Boolean.valueOf(redo)}, uiMgr, false); if (!comp.doesHierarchyHaveFocus()) { if (!comp.checkForcedFocus()) comp.setDefaultFocus(); } } int numTextInputs=comp.getNumTextInputs(0); multipleTextInputs = numTextInputs > 1; uiMgr.getRootPanel().getRenderEngine().setMenuHint(widg.getName(), null, numTextInputs>0); }
Source:
public TemplateStore getCodeTemplateStore() { if (fCodeTemplateStore == null) { Promise<TemplateStore> p= getTemplateStoreInitializer().getTemplateStore(); try { fCodeTemplateStore= p.getValue(); } catch (InvocationTargetException | InterruptedException e) { fCodeTemplateStore= getTemplateStoreInitializer().loadTemplateStore(); log(e); } } return fCodeTemplateStore; }

Target:
public TemplateStore getCodeTemplateStore() { if (fCodeTemplateStore == null) { TemplateStoreInitializer initializer= getTemplateStoreInitializer(); Promise<TemplateStore> p= initializer.getTemplateStore(); try { fCodeTemplateStore= p.getValue(); } catch (InvocationTargetException e) { fCodeTemplateStore= initializer.loadTemplateStore(); log(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); fCodeTemplateStore= initializer.loadTemplateStore(); log(e); } } return fCodeTemplateStore; }
Source:
public RegisteredService findServiceByName(final String name) { if (StringUtils.isBlank(name)) { return null; } var service = services.asMap().values().stream() .filter(r -> r.getName().equals(name)) .findFirst() .orElse(null); if (service == null) { LOGGER.trace("The service with name is not found in the cache, try to find it from [{}]", name, serviceRegistry.getName()); service = serviceRegistry.findServiceByExactServiceName(name); if (service != null) { services.put(service.getId(), service); LOGGER.trace("The service is found in and populated to the cache ", serviceRegistry.getName(), service); } } if (service != null) { service.initialize(); } return validateRegisteredService(service); }

Target:
public RegisteredService findServiceByName(final String name) { if (StringUtils.isBlank(name)) { return null; } var service = getService(name, 0); if (service == null) { LOGGER.trace("The service with name is not found in the cache; trying to find it from [{}]", name, serviceRegistry.getName()); service = serviceRegistry.findServiceByExactServiceName(name); if (service != null) { services.put(service.getId(), service); LOGGER.trace("The service is found in and populated to the cache ", serviceRegistry.getName(), service); } } if (service != null) { service.initialize(); } return validateRegisteredService(service); }
Source:
public DBObject getFieldsObject() { BasicDBObject projection = (BasicDBObject) getOptions().getProjection(); if (projection == null || projection.size() == 0) { return null; } final MappedClass mc = ds.getMapper().getMappedClass(clazz); Entity entityAnnotation = mc.getEntityAnnotation(); final BasicDBObject fieldsFilter = copy(projection); if (includeFields && entityAnnotation != null && !entityAnnotation.noClassnameStored()) { fieldsFilter.put(Mapper.CLASS_NAME_FIELDNAME, 1); } return fieldsFilter; }

Target:
public DBObject getFieldsObject() { DBObject projection = getOptions().getProjection(); if (projection == null || projection.keySet().size() == 0) { return null; } final MappedClass mc = ds.getMapper().getMappedClass(clazz); Entity entityAnnotation = mc.getEntityAnnotation(); final BasicDBObject fieldsFilter = copy(projection); if (includeFields && entityAnnotation != null && !entityAnnotation.noClassnameStored()) { fieldsFilter.put(Mapper.CLASS_NAME_FIELDNAME, 1); } return fieldsFilter; }
Source:
public void testSegmentMetadataUnionQuery() { System.out.println(); SegmentAnalysis expected = new SegmentAnalysis( QueryRunnerTestHelper.segmentId, Lists.newArrayList(new Interval("2011-01-12T00:00:00.000Z/2011-04-15T00:00:00.001Z")), ImmutableMap.of( "placement", new ColumnAnalysis( ValueType.STRING.toString(), false, mmap ? 43524 : 43056, 1, "preferred", "preferred", null ) ), mmap ? 287928 : 291020, 4836, null, null ); SegmentMetadataQuery query = new Druids.SegmentMetadataQueryBuilder() .dataSource(QueryRunnerTestHelper.unionDataSource) .intervals(QueryRunnerTestHelper.fullOnInterval) .toInclude(new ListColumnIncluderator(Lists.newArrayList("placement"))) .build(); List result = Sequences.toList(runner.run(query, Maps.newHashMap()), Lists.<SegmentAnalysis>newArrayList()); System.out.println(result); TestHelper.assertExpectedObjects(ImmutableList.of(expected), result, "failed SegmentMetadata union query"); }

Target:
public void testSegmentMetadataUnionQuery() { SegmentAnalysis expected = new SegmentAnalysis( QueryRunnerTestHelper.segmentId, Lists.newArrayList(new Interval("2011-01-12T00:00:00.000Z/2011-04-15T00:00:00.001Z")), ImmutableMap.of( "placement", new ColumnAnalysis( ValueType.STRING.toString(), false, mmap ? 43524 : 43056, 1, "preferred", "preferred", null ) ), mmap ? 287928 : 291020, 4836, null, null ); SegmentMetadataQuery query = new Druids.SegmentMetadataQueryBuilder() .dataSource(QueryRunnerTestHelper.unionDataSource) .intervals(QueryRunnerTestHelper.fullOnInterval) .toInclude(new ListColumnIncluderator(Lists.newArrayList("placement"))) .build(); List result = Sequences.toList(runner.run(query, Maps.newHashMap()), Lists.<SegmentAnalysis>newArrayList()); TestHelper.assertExpectedObjects(ImmutableList.of(expected), result, "failed SegmentMetadata union query"); }
Source:
protected void writeProperties(ElasticsearchPersistentEntity<?> entity, PersistentPropertyAccessor<?> accessor, Map<String, Object> sink) { for (ElasticsearchPersistentProperty property : entity) { if (!property.isWritable()) { continue; } Object value = accessor.getProperty(property); if (value == null) { continue; } if (!conversions.isSimpleType(value.getClass())) { writeProperty(property, value, sink); } else { sink.put(property.getFieldName(), getWriteSimpleValue(value)); } } }

Target:
protected void writeProperties(ElasticsearchPersistentEntity<?> entity, PersistentPropertyAccessor<?> accessor, Map<String, Object> sink) { for (ElasticsearchPersistentProperty property : entity) { if (!property.isWritable()) { continue; } Object value = accessor.getProperty(property); if (value == null) { continue; } if (!isSimpleType(value)) { writeProperty(property, value, sink); } else { sink.put(property.getFieldName(), getWriteSimpleValue(value)); } } }
Source:
Allele toSymbolicAltAllele() { if (this.equals(StructuralVariantType.BND)) throw new UnsupportedOperationException("BND type does not have angle bracketed alt allele"); return Allele.create("<" + name() + ">", false); }

Target:
Allele toSymbolicAltAllele() { if (this.equals(StructuralVariantType.BND)) { throw new UnsupportedOperationException("BND type does not have angle bracketed alt allele"); } return Allele.create("<" + name() + ">", false); }
Source:
public void slicesOfLongSeries() { Series series = new Series("918493904243"); List<List<Integer>> expected = Arrays.asList(Arrays.asList(9, 1, 8, 4, 9), Arrays.asList(1, 8, 4, 9, 3), Arrays.asList(8, 4, 9, 3, 9), Arrays.asList(4, 9, 3, 9, 0), Arrays.asList(9, 3, 9, 0, 4), Arrays.asList(3, 9, 0, 4, 2), Arrays.asList(9, 0, 4, 2, 4), Arrays.asList(0, 4, 2, 4, 3)); List<List<Integer>> actual = series.slices(5); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }

Target:
public void slicesOfLongSeries() { Series series = new Series("918493904243"); List<List<String>> expected = Arrays.asList( Arrays.asList("9", "1", "8", "4", "9"), Arrays.asList("1", "8", "4", "9", "3"), Arrays.asList("8", "4", "9", "3", "9"), Arrays.asList("4", "9", "3", "9", "0"), Arrays.asList("9", "3", "9", "0", "4"), Arrays.asList("3", "9", "0", "4", "2"), Arrays.asList("9", "0", "4", "2", "4"), Arrays.asList("0", "4", "2", "4", "3") ); List<List<String>> actual = series.slices(5); assertEquals(expected, actual); }
Source:
public void requestsAreIdempotentDuringAcquisitionPhase() { LockToken currentHolder = lockSynchronously(REQUEST_1, LOCK_A); AsyncResult<LeasableLockToken> tokenResult = lock(REQUEST_2, LOCK_A); AsyncResult<LeasableLockToken> duplicateResult = lock(REQUEST_2, LOCK_A); service.unlock(currentHolder); assertThat(tokenResult.isCompletedSuccessfully()).isTrue(); assertThat(duplicateResult.isCompletedSuccessfully()).isTrue(); assertThat(tokenResult.get()).isEqualTo(duplicateResult.get()); }

Target:
public void requestsAreIdempotentDuringAcquisitionPhase() { LockToken currentHolder = lockSynchronously(REQUEST_1, LOCK_A); AsyncResult<Leased<LockToken>> tokenResult = lock(REQUEST_2, LOCK_A); AsyncResult<Leased<LockToken>> duplicateResult = lock(REQUEST_2, LOCK_A); service.unlock(currentHolder); assertThat(tokenResult.isCompletedSuccessfully()).isTrue(); assertThat(duplicateResult.isCompletedSuccessfully()).isTrue(); assertThat(tokenResult.get().value()).isEqualTo(duplicateResult.get().value()); }