auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Config loadConfig( String cluster, String role, String environ, String topologyBinaryFile, String topologyDefnFile, Boolean verbose, TopologyAPI.Topology topology) { return Config.toRemoteMode( Config.newBuilder() .putAll(ClusterConfig.loadSandboxConfig()) .putAll(commandLineConfigs(cluster, role, environ, verbose)) .putAll(topologyConfigs(topologyBinaryFile, topologyDefnFile, topology)) .build()); }

Target:
public static Config loadConfig( String cluster, String role, String environ, String topologyBinaryFile, String topologyDefnFile, Boolean verbose, TopologyAPI.Topology topology) { return Config.toClusterMode( Config.newBuilder() .putAll(ConfigLoader.loadClusterConfig()) .putAll(commandLineConfigs(cluster, role, environ, verbose)) .putAll(topologyConfigs(topologyBinaryFile, topologyDefnFile, topology)) .build()); }
Source:
public boolean test( Object value ) { assert false : "StringRangePredicate.test() has not been tested yet... Add tests and remove assert"; if ( value == null ) { return false; } if ( !(value instanceof String) ) { return false; } String str = (String) value; if ( from != null ) { int compare = PropertyValueComparison.COMPARE_STRINGS.compare( str, from ); if ( compare < 0 || !fromInclusive && compare == 0 ) { return false; } } if ( to != null ) { int compare = PropertyValueComparison.COMPARE_STRINGS.compare( str, to ); if ( compare > 0 || !toInclusive && compare == 0 ) { return false; } } return true; }

Target:
public boolean test( Object value ) { if ( value == null ) { return false; } if ( !(value instanceof String) ) { return false; } String str = (String) value; if ( from != null ) { int compare = PropertyValueComparison.COMPARE_STRINGS.compare( str, from ); if ( compare < 0 || !fromInclusive && compare == 0 ) { return false; } } if ( to != null ) { int compare = PropertyValueComparison.COMPARE_STRINGS.compare( str, to ); if ( compare > 0 || !toInclusive && compare == 0 ) { return false; } } return true; }
Source:
private static boolean argsMatch(AbstractExpression e1, AbstractExpression e2) { final List<AbstractExpression> args1 = e1.getArgs(), args2 = e2.getArgs(); return args1 == null || args2 == null ? args1 == args2 : args1.size() == args2.size() && IntStream.range(0, args1.size()) .mapToObj(index -> (new FilterMatcher(args1.get(index), args2.get(index))).match()) .reduce(Boolean::logicalAnd).get(); }

Target:
private static boolean argsMatch(AbstractExpression e1, AbstractExpression e2) { final List<AbstractExpression> args1 = e1.getArgs(), args2 = e2.getArgs(); if (args1 == null || args2 == null) { return args1 == args2; } else { return args1.size() == args2.size() && IntStream.range(0, args1.size()) .mapToObj(index -> (new FilterMatcher(args1.get(index), args2.get(index))).match()) .reduce(Boolean::logicalAnd).get(); } }
Source:
public List<ChangeItem> call() throws Exception { List<ChangeItem> changeData = new LinkedList<>(); Conditions.checkExpressionFailOnTrue(!txDelta.areOnTheSameBranch(), "Unable to compute deltas between transactions on different branches [%s]", txDelta); TransactionJoinQuery txJoin = joinFactory.createTransactionJoinQuery(); boolean isArchived = false; JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(1, SELECT_IS_BRANCH_ARCHIVED, getBranchId()); while (chStmt.next()) { checkForCancelled(); if (chStmt.getInt("archived") == 1) { isArchived = true; } } } finally { chStmt.close(); } loadChangesAtEndTx(txJoin, isArchived); int txJoinId = txJoin.getQueryId(); try { loadByItemId(changeData, txJoinId, changeItemLoader.createArtifactChangeItemFactory(), isArchived); loadByItemId(changeData, txJoinId, changeItemLoader.createAttributeChangeItemFactory(), isArchived); loadByItemId(changeData, txJoinId, changeItemLoader.createRelationChangeItemFactory(), isArchived); } finally { try { txJoin.delete(); } finally { changeByGammaId.clear(); } } return changeData; }

Target:
public List<ChangeItem> call() throws Exception { List<ChangeItem> changeData = new LinkedList<>(); Conditions.checkExpressionFailOnTrue(!txDelta.areOnTheSameBranch(), "Unable to compute deltas between transactions on different branches [%s]", txDelta); TransactionJoinQuery txJoin = joinFactory.createTransactionJoinQuery(); boolean isArchived = false; JdbcStatement chStmt = getJdbcClient().getStatement(); try { chStmt.runPreparedQuery(1, SELECT_IS_BRANCH_ARCHIVED, getBranchId()); while (chStmt.next()) { checkForCancelled(); if (chStmt.getInt("archived") == BranchArchivedState.ARCHIVED.getValue()) { isArchived = true; } } } finally { chStmt.close(); } loadChangesAtEndTx(txJoin, isArchived); int txJoinId = txJoin.getQueryId(); try { loadByItemId(changeData, txJoinId, changeItemLoader.createArtifactChangeItemFactory(), isArchived); loadByItemId(changeData, txJoinId, changeItemLoader.createAttributeChangeItemFactory(), isArchived); loadByItemId(changeData, txJoinId, changeItemLoader.createRelationChangeItemFactory(), isArchived); } finally { try { txJoin.delete(); } finally { changeByGammaId.clear(); } } return changeData; }
Source:
public void traceClosed(@Nullable TmfTraceClosedSignal signal) { if (signal == null || signal.getTrace() != fTrace) { return; } fTrace = null; Runnable r = this::reset; if (Display.getCurrent() == null) { Display d = Display.getDefault(); if (!d.isDisposed()) { d.asyncExec(r); } } else { r.run(); } }

Target:
public void traceClosed(@Nullable TmfTraceClosedSignal signal) { if (signal == null || signal.getTrace() != fTrace) { return; } fTrace = null; reset(); }
Source:
public void setup() throws Exception { trustStoreFile = File.createTempFile("truststore", ".jks"); SSLConfig sslConfig = TestSSLUtils.createSSLConfig("DC1,DC2,DC3", SSLFactory.Mode.SERVER, trustStoreFile, "server"); SSLConfig clientSSLConfig = TestSSLUtils.createSSLConfig("DC1,DC2,DC3", SSLFactory.Mode.CLIENT, trustStoreFile, "client"); SSLFactory serverSSLFactory = new SSLFactory(sslConfig); SSLFactory clientSSLFactory = new SSLFactory(clientSSLConfig); this.server = new EchoServer(serverSSLFactory, 18383); this.server.start(); this.selector = new Selector(new NetworkMetrics(new MetricRegistry()), SystemTime.getInstance(), clientSSLFactory); }

Target:
public void setup() throws Exception { trustStoreFile = File.createTempFile("truststore", ".jks"); SSLConfig sslConfig = TestSSLUtils.createSSLConfig("DC1,DC2,DC3", SSLFactory.Mode.SERVER, trustStoreFile, "server"); SSLConfig clientSSLConfig = TestSSLUtils.createSSLConfig("DC1,DC2,DC3", SSLFactory.Mode.CLIENT, trustStoreFile, "client"); SSLFactory serverSSLFactory = new SSLFactory(sslConfig); SSLFactory clientSSLFactory = new SSLFactory(clientSSLConfig); server = new EchoServer(serverSSLFactory, 18383); server.start(); selector = new Selector(new NetworkMetrics(new MetricRegistry()), SystemTime.getInstance(), clientSSLFactory); }
Source:
public DefaultTraversalMetrics(final long totalStepDurationNs, final List<MutableMetrics> orderedMetrics) { totalStepDuration = totalStepDurationNs; for (int ix = 0; ix < orderedMetrics.size(); ix++) { stepIndexedMetrics.put(orderedMetrics.get(ix).getId(), orderedMetrics.get(ix).getImmutableClone()); positionIndexedMetrics.put(ix, orderedMetrics.get(ix).getImmutableClone()); } }

Target:
public DefaultTraversalMetrics(final long totalStepDurationNs, final List<MutableMetrics> orderedMetrics) { totalStepDuration = totalStepDurationNs; int ix = 0; for (final MutableMetrics metric : orderedMetrics) { stepIndexedMetrics.put(metric.getId(), metric.getImmutableClone()); positionIndexedMetrics.put(ix++, metric.getImmutableClone()); } }
Source:
int modelToView(int childIndex) { if (filteredIndexes == null) { return childIndex; } int offset = 0; for (int filteredIndexe : filteredIndexes) { if (childIndex == filteredIndexe ) { return -1; } else if (childIndex > filteredIndexe) { offset++; } else { break; } } return childIndex - offset; }

Target:
int modelToView(int childIndex) { if (filteredIndexes == null) { return childIndex; } int offset = 0; for (int filteredIndex : filteredIndexes) { if (childIndex == filteredIndex ) { return -1; } else if (childIndex > filteredIndex) { offset++; } else { break; } } return childIndex - offset; }
Source:
public void parcelableTest() { TimeRange range = new TimeRange(new Date(1), new Date(100)); Integer value = 25; AirConditionerState air1 = new AirConditionerState(); air1.currentTemperature = 25; air1.power = false; HistoryState<AirConditionerState> airHS = new HistoryState<>(air1, new Date()); List<HistoryState<AirConditionerState>> list = new ArrayList<>(); list.add(airHS); AggregatedResult<Integer, AirConditionerState> src = new AggregatedResult<>(range, value, list); Assert.assertNotNull(src); Assert.assertEquals(range, src.getTimeRange()); Assert.assertEquals(value, src.getValue()); Assert.assertTrue(Arrays.equals(list.toArray(), src.getAggregatedObjects().toArray())); Parcel parcel = Parcel.obtain(); src.writeToParcel(parcel, 0); parcel.setDataPosition(0); AggregatedResult<Integer, AirConditionerState> dest = AggregatedResult.CREATOR.createFromParcel(parcel); Assert.assertNotNull(dest); Assert.assertEquals(range, dest.getTimeRange()); Assert.assertEquals(value, dest.getValue()); Assert.assertTrue(Arrays.equals(list.toArray(), dest.getAggregatedObjects().toArray())); }

Target:
public void parcelableTest() { TimeRange range = new TimeRange(new Date(1), new Date(100)); Integer value = 25; AirConditionerState air1 = new AirConditionerState(); air1.currentTemperature = 25; air1.power = false; HistoryState<AirConditionerState> airHS = new HistoryState<>(air1, new Date()); List<HistoryState<AirConditionerState>> list = new ArrayList<>(); list.add(airHS); AggregatedResult<Integer, AirConditionerState> src = new AggregatedResult<>(range, value, list); Assert.assertNotNull(src); Assert.assertEquals(range, src.getTimeRange()); Assert.assertEquals(value, src.getValue()); Assert.assertNotNull(src.getAggregatedObjects()); Assert.assertTrue(Arrays.equals(list.toArray(), src.getAggregatedObjects().toArray())); Parcel parcel = Parcel.obtain(); src.writeToParcel(parcel, 0); parcel.setDataPosition(0); AggregatedResult<Integer, AirConditionerState> dest = AggregatedResult.CREATOR.createFromParcel(parcel); Assert.assertNotNull(dest); Assert.assertEquals(range, dest.getTimeRange()); Assert.assertEquals(value, dest.getValue()); Assert.assertNotNull(dest.getAggregatedObjects()); Assert.assertTrue(Arrays.equals(list.toArray(), dest.getAggregatedObjects().toArray())); }
Source:
public Planet(String id, boolean hasRings, int radius, Moon[] moons) { this.id = id; this.hasRings = hasRings; this.radious = radius; this.moons = moons; }

Target:
public Planet(String id, boolean hasRings, int radius, Moon[] moons) { this.id = id; this.hasRings = hasRings; this.radius = radius; this.moons = moons; }
Source:
public Suspension getSuspension(final long activityId) { return idToSuspension.get(activityId); }

Target:
Suspension getSuspension(final long activityId) { return idToSuspension.get(activityId); }
Source:
public void generateDummyImagesButtonClick() { List<MediaUnit> mediaUnits = dataEditor.getWorkpiece().getMediaUnits(); int order = mediaUnits.isEmpty() ? 1 : mediaUnits.get(mediaUnits.size() - 1).getOrder() + 1; boolean withAutomaticPagination = ConfigCore.getBooleanParameter(ParameterCore.WITH_AUTOMATIC_PAGINATION); Paginator orderlabel = new Paginator(metsEditorDefaultPagination(order)); for (int i = 1; i <= newPagesCountValue; i++) { MediaUnit mediaUnit = new MediaUnit(); mediaUnit.setOrder(order++); if (withAutomaticPagination) { mediaUnit.setOrderlabel(orderlabel.next()); } mediaUnits.add(mediaUnit); } }

Target:
public void generateDummyImagesButtonClick() { List<MediaUnit> mediaUnits = dataEditor.getWorkpiece().getMediaUnit().getChildren(); int order = mediaUnits.isEmpty() ? 1 : mediaUnits.get(mediaUnits.size() - 1).getOrder() + 1; boolean withAutomaticPagination = ConfigCore.getBooleanParameter(ParameterCore.WITH_AUTOMATIC_PAGINATION); Paginator orderlabel = new Paginator(metsEditorDefaultPagination(order)); for (int i = 1; i <= newPagesCountValue; i++) { MediaUnit mediaUnit = new MediaUnit(); mediaUnit.setOrder(order++); if (withAutomaticPagination) { mediaUnit.setOrderlabel(orderlabel.next()); } mediaUnits.add(mediaUnit); } }
Source:
public AdHocGroupTester(IPersonAttributesGroupTestDefinition definition) { Validate.notNull(definition.getIncludes()); Validate.notNull(definition.getExcludes()); collectGroups(definition.getIncludes(), this.includes, true); collectGroups(definition.getExcludes(), this.excludes, false); hashcode = calcHashcode(); }

Target:
public AdHocGroupTester(IPersonAttributesGroupTestDefinition definition) { assert(definition.getAttributeName().equals(MEMBER_OF) || definition.getAttributeName().equals(NOT_MEMBER_OF)); this.isNotTest = definition.getAttributeName().equals(NOT_MEMBER_OF); this.groupName = definition.getTestValue(); this.groupHash = calcGroupHash(groupName, isNotTest); ApplicationContext context = ApplicationContextLocator.getApplicationContext(); CacheManager cacheManager = context.getBean("cacheManager", CacheManager.class); this.currentTests = cacheManager.getCache("org.jasig.portal.groups.pags.testers.AdHocGroupTester"); }
Source:
private void processValueEvent(List<PilightBindingConfig> configs, Status status) { for (PilightBindingConfig config : configs) { String property = config.getProperty(); if (status.getValues().containsKey(property)) { String value = status.getValues().get(property); State state = getState(value, config); if (state != null) eventPublisher.postUpdate(config.getItemName(), state); } } }

Target:
private void processValueEvent(List<PilightBindingConfig> configs, Status status) { for (PilightBindingConfig config : configs) { String property = config.getProperty(); if (status.getValues().containsKey(property)) { String value = status.getValues().get(property); State state = getState(value, config); if (state != null) { eventPublisher.postUpdate(config.getItemName(), state); } } } }
Source:
private void addChildrenProducerBatch(final ProducerBatch batch) { if (childrenProducerBatch == null) { childrenProducerBatch = new ArrayList<>(); } childrenProducerBatch.add(batch); }

Target:
private synchronized void addChildrenProducerBatch(final ProducerBatch batch) { if (childrenProducerBatch == null) { childrenProducerBatch = new ArrayList<>(); } childrenProducerBatch.add(batch); }
Source:
public void joinBuilder(StreamEvent stream1,StreamEvent stream2){ StateEvent returnEvent = stateEventPool.borrowEvent(); returnEvent.setEvent(0, stream1); returnEvent.setEvent(1, stream2); if (preJoinProcessor) { returnEvent.setType(ComplexEvent.Type.CURRENT); } else { returnEvent.setType(ComplexEvent.Type.EXPIRED); } if (!leftJoinProcessor) { returnEvent.setTimestamp(stream2.getTimestamp()); }else{ returnEvent.setTimestamp(stream1.getTimestamp()); } returnEventChunk.add(returnEvent); }

Target:
public StateEvent joinBuilder(StreamEvent stream1,StreamEvent stream2){ StateEvent returnEvent = stateEventPool.borrowEvent(); returnEvent.setEvent(0, stream1); returnEvent.setEvent(1, stream2); if (preJoinProcessor) { returnEvent.setType(ComplexEvent.Type.CURRENT); } else { returnEvent.setType(ComplexEvent.Type.EXPIRED); } if (!leftJoinProcessor) { returnEvent.setTimestamp(stream2.getTimestamp()); }else{ returnEvent.setTimestamp(stream1.getTimestamp()); } return returnEvent; }
Source:
public Map<ServerInstance, DataTable> queryPinotServerForDataTable(String pql, String serverHost, String segment) { long requestId = requestIdGenerator.incrementAndGet(); BrokerRequest brokerRequest; try { brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(pql); } catch (Exception e) { throw new PrestoException( PINOT_FAILURE_QUERYING_DATA, String.format("Parsing error on requestId %d, PQL = %s", requestId, pql), e); } Map<String, List<String>> routingTable = new HashMap<>(); List<String> segmentList = new ArrayList<>(); segmentList.add(segment); routingTable.put(serverHost, segmentList); ScatterGatherRequestImpl scatterRequest = new ScatterGatherRequestImpl(brokerRequest, routingTable, 0, connectionTimeout.toMillis(), prestoHostId); ScatterGatherStats scatterGatherStats = new ScatterGatherStats(); CompositeFuture<byte[]> compositeFuture = routeScatterGather(scatterRequest, scatterGatherStats); if (compositeFuture == null) { return null; } Map<ServerInstance, DataTable> dataTableMap = new HashMap<>(); List<ProcessingException> processingExceptions = new ArrayList<>(); Map<ServerInstance, byte[]> serverResponseMap = null; serverResponseMap = gatherServerResponses(compositeFuture, scatterGatherStats, true, brokerRequest.getQuerySource().getTableName(), processingExceptions); deserializeServerResponses(serverResponseMap, true, dataTableMap, brokerRequest.getQuerySource().getTableName(), processingExceptions); return dataTableMap; }

Target:
public Map<ServerInstance, DataTable> queryPinotServerForDataTable(String pql, String serverHost, String segment) { long requestId = requestIdGenerator.incrementAndGet(); BrokerRequest brokerRequest; try { brokerRequest = REQUEST_COMPILER.compileToBrokerRequest(pql); } catch (Exception e) { throw new PrestoException( PINOT_FAILURE_QUERYING_DATA, String.format("Parsing error on requestId %d, PQL = %s", requestId, pql), e); } ImmutableMap.Builder<String, List<String>> routingTableBuilder = ImmutableMap.builder(); List<String> segmentList = Arrays.asList(segment); routingTableBuilder.put(serverHost, segmentList); ScatterGatherRequest scatterRequest = new SimpleScatterGatherRequest(brokerRequest, routingTableBuilder.build(), 0, connectionTimeout.toMillis(), prestoHostId); ScatterGatherStats scatterGatherStats = new ScatterGatherStats(); CompositeFuture<byte[]> compositeFuture = routeScatterGather(scatterRequest, scatterGatherStats); if (compositeFuture == null) { throw new PrestoException( PINOT_FAILURE_QUERYING_DATA, String.format("Failed to get data from table. PQL = %s.", pql)); } ImmutableMap.Builder<ServerInstance, DataTable> dataTableMapBuilder = ImmutableMap.builder(); ImmutableList.Builder<ProcessingException> processingExceptionsBuilder = ImmutableList.builder(); Map<ServerInstance, byte[]> serverResponseMap = gatherServerResponses(compositeFuture, scatterGatherStats, true, brokerRequest.getQuerySource().getTableName(), processingExceptionsBuilder); deserializeServerResponses(serverResponseMap, dataTableMapBuilder, brokerRequest.getQuerySource().getTableName(), processingExceptionsBuilder); return dataTableMapBuilder.build(); }
Source:
public void clear() { for (Bridge bridge : bridges.values()) { try { bridge.stop(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToStopBridge(e); } } bridges.clear(); for (ClusterConnection clusterConnection : clusterConnections.values()) { try { clusterConnection.stop(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToStopClusterConnection(e); } } clearClusterConnections(); }

Target:
public void clear() { for (Bridge bridge : bridges.values()) { try { bridge.stop(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e); } } bridges.clear(); for (ClusterConnection clusterConnection : clusterConnections.values()) { try { clusterConnection.stop(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.failedToStopClusterConnection(e); } } clearClusterConnections(); }
Source:
public String uploadRepository(@PathVariable("tenant") final String tenant, @RequestParam("file") final MultipartFile file) throws IOException { final TenantContext context = _tenantContextFactory.getContext(tenant); final RepositoryFolder rootFolder = context.getTenantRootFolder(); if (file.getSize() == 0){ return "Failure. The file is empty"; } final String contentType = file.getContentType().trim(); if ((!contentType.equals("application/zip")) && (!contentType.equals("application/octet-stream"))) { return "Failure. The file isn't a .zip archive"; } final File oldRepositoryZipFile = createZipfolder(rootFolder); logger.info("Uploading ZIP file for tenant repository: {}", tenant); try (final InputStream inputStream = file.getInputStream()) { ZipInputStream zipInputStream = new ZipInputStream(inputStream); if (isValidRepository(zipInputStream)) { decompress(zipInputStream, rootFolder); return "Success.\nNew repository path: " + rootFolder.getQualifiedPath() + ".\nOld repository backed up to: " + oldRepositoryZipFile.toString(); } else { oldRepositoryZipFile.delete(); return "Failure. The repository does not contain a conf.xml file"; } } }

Target:
public String uploadRepository(@PathVariable("tenant") final String tenant, @RequestParam("file") final MultipartFile file) throws IOException { final TenantContext context = _tenantContextFactory.getContext(tenant); final RepositoryFolder rootFolder = context.getTenantRootFolder(); if (file.getSize() == 0){ return "Failure. The file is empty"; } final String contentType = file.getContentType().trim(); if ((!contentType.equals("application/zip")) && (!contentType.equals("application/octet-stream"))) { return "Failure. The file isn't a .zip archive"; } logger.info("Uploading ZIP file for tenant repository: {}", tenant); try (final InputStream inputStream = file.getInputStream()) { final ZipInputStream zipInputStream = new ZipInputStream(inputStream); if (isValidRepository(zipInputStream)) { final File oldRepositoryZipFile = createZipfolder(rootFolder); decompress(zipInputStream, rootFolder); return "Success.\nNew repository path: " + rootFolder.getQualifiedPath() + ".\nOld repository backed up to: " + oldRepositoryZipFile.toString(); } else { return "Failure. The repository does not contain a conf.xml file"; } } }
Source:
public void setConnection(String id, String name) throws CoreException { IRemoteConnectionType connectionType = fRemoteServicesManager.getConnectionType(id); if (connectionType != null) { IRemoteConnection connection = connectionType.getConnection(name); if (connection != null) { setConnection(connection); } } }

Target:
public void setConnection(String id, String name) { IRemoteConnectionType connectionType = fRemoteServicesManager.getConnectionType(id); if (connectionType != null) { IRemoteConnection connection = connectionType.getConnection(name); if (connection != null) { setConnection(connection); } } }
Source:
public boolean cleanUp() { if (Build.VERSION.SDK_INT >= WorkManagerImpl.MIN_JOB_SCHEDULER_API_LEVEL) { SystemJobScheduler.cancelInvalidJobs(mContext); } WorkDatabase workDatabase = mWorkManager.getWorkDatabase(); WorkSpecDao workSpecDao = workDatabase.workSpecDao(); WorkProgressDao workProgressDao = workDatabase.workProgressDao(); workDatabase.beginTransaction(); boolean needsScheduling; try { List<WorkSpec> workSpecs = workSpecDao.getRunningWork(); needsScheduling = workSpecs != null && !workSpecs.isEmpty(); if (needsScheduling) { for (WorkSpec workSpec : workSpecs) { workSpecDao.setState(ENQUEUED, workSpec.id); workSpecDao.markWorkSpecScheduled(workSpec.id, SCHEDULE_NOT_REQUESTED_YET); workProgressDao.delete(workSpec.id); } } workDatabase.setTransactionSuccessful(); } finally { workDatabase.endTransaction(); } return needsScheduling; }

Target:
public boolean cleanUp() { if (Build.VERSION.SDK_INT >= WorkManagerImpl.MIN_JOB_SCHEDULER_API_LEVEL) { SystemJobScheduler.cancelInvalidJobs(mContext); } WorkDatabase workDatabase = mWorkManager.getWorkDatabase(); WorkSpecDao workSpecDao = workDatabase.workSpecDao(); WorkProgressDao workProgressDao = workDatabase.workProgressDao(); workDatabase.beginTransaction(); boolean needsScheduling; try { List<WorkSpec> workSpecs = workSpecDao.getRunningWork(); needsScheduling = workSpecs != null && !workSpecs.isEmpty(); if (needsScheduling) { for (WorkSpec workSpec : workSpecs) { workSpecDao.setState(ENQUEUED, workSpec.id); workSpecDao.markWorkSpecScheduled(workSpec.id, SCHEDULE_NOT_REQUESTED_YET); } } workProgressDao.deleteAll(); workDatabase.setTransactionSuccessful(); } finally { workDatabase.endTransaction(); } return needsScheduling; }
Source:
public Set<Pair<WorkerInfo, SerializableVoid>> selectExecutors(NoopPlanConfig config, List<WorkerInfo> jobWorkerInfoList, SelectExecutorsContext selectExecutorsContext) throws Exception { return new HashSet<>(); }

Target:
public Set<Pair<WorkerInfo, SerializableVoid>> selectExecutors(NoopPlanConfig config, List<WorkerInfo> jobWorkerInfoList, SelectExecutorsContext selectExecutorsContext) throws Exception { return Collections.emptySet(); }
Source:
public void testMakeDecisionRule() { final DecisionRule rule = DecisionRuleFactory.makeDecisionRule(dtable); final List<UnaryTests> inputEntries = rule.getInputEntry(); assertThat(inputEntries.size()).isEqualTo(2); assertUnaryTestsText(inputEntries.get(0), DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); assertUnaryTestsText(inputEntries.get(1), DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT); assertThat(inputEntries.get(0).getParent()).isEqualTo(rule); assertThat(inputEntries.get(1).getParent()).isEqualTo(rule); final List<LiteralExpression> outputEntries = rule.getOutputEntry(); assertThat(outputEntries.size()).isEqualTo(2); assertLiteralExpressionText(outputEntries.get(0), DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); assertLiteralExpressionText(outputEntries.get(1), DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT); assertThat(outputEntries.get(0).getParent()).isEqualTo(rule); assertThat(outputEntries.get(1).getParent()).isEqualTo(rule); assertThat(rule.getDescription().getValue()).isEqualTo(DecisionTableDefaultValueUtilities.RULE_DESCRIPTION); assertThat(rule.getParent()).isEqualTo(dtable); }

Target:
public void testMakeDecisionRule() { final DecisionRule rule = DecisionRuleFactory.makeDecisionRule(dtable); final List<UnaryTests> inputEntries = rule.getInputEntry(); assertThat(inputEntries.size()).isEqualTo(2); assertThat(inputEntries) .allSatisfy(unaryTests -> assertUnaryTestsText(unaryTests, DecisionTableDefaultValueUtilities.INPUT_CLAUSE_UNARY_TEST_TEXT)) .allSatisfy(unaryTests -> assertThat(unaryTests.getConstraintType()).isNull()) .allSatisfy(unaryTests -> assertThat(unaryTests.getParent()).isEqualTo(rule)); final List<LiteralExpression> outputEntries = rule.getOutputEntry(); assertThat(outputEntries.size()).isEqualTo(2); assertThat(outputEntries) .allSatisfy(literalExpression -> assertLiteralExpressionText(literalExpression, DecisionTableDefaultValueUtilities.OUTPUT_CLAUSE_EXPRESSION_TEXT)) .allSatisfy(literalExpression -> assertThat(literalExpression.getParent()).isEqualTo(rule)); assertThat(rule.getDescription().getValue()).isEqualTo(DecisionTableDefaultValueUtilities.RULE_DESCRIPTION); assertThat(rule.getParent()).isEqualTo(dtable); }
Source:
private void setSymbolicValueOnFields(MethodInvocationTree tree) { boolean threadSleepMatch = THREAD_SLEEP_MATCHER.matches(tree); if (isLocalMethodInvocation(tree) || isProvidingThisAsArgument(tree) || threadSleepMatch) { resetFieldValues(tree.symbol().isStatic() && !threadSleepMatch); } }

Target:
private void setSymbolicValueOnFields(MethodInvocationTree tree) { boolean threadSleepMatch = THREAD_SLEEP_MATCHER.matches(tree); boolean providingThisAsArgument = isProvidingThisAsArgument(tree); if (isLocalMethodInvocation(tree) || providingThisAsArgument || threadSleepMatch) { boolean resetOnlyStaticFields = tree.symbol().isStatic() && !threadSleepMatch && !providingThisAsArgument; resetFieldValues(resetOnlyStaticFields); } }
Source:
public void visitName(Name name) { Optional.ofNullable(name.symbol()).ifPresent(symbol -> symbol.usages().stream() .filter(usage -> usage.tree() == name) .findFirst() .ifPresent(usage -> addToSymbolToUsageMap(usage, symbol)) ); super.visitName(name); }

Target:
public void visitName(Name name) { Optional.ofNullable(name.usage()).ifPresent(usage -> addToSymbolToUsageMap(usage, name.symbol())); super.visitName(name); }
Source:
private String getFileChecksum(String filePath) { String checksum = null; try { checksum = DigestUtils.sha1Hex(new FileInputStream(filePath)); } catch (FileNotFoundException e) { log.error("Unable to compute checksum for {}", filePath); } catch (IOException e) { log.error("Unable to compute checksum for {}", filePath); } return checksum; }

Target:
private String getFileChecksum(String filePath) { String checksum = null; try { checksum = DigestUtils.sha1Hex(new FileInputStream(filePath)); } catch (IOException e) { throw new ReplicationException(String.format("Unable to compute checksum for %s", filePath), e); } return checksum; }
Source:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatchingPolicy == ValueMatchingPolicy.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e == null || e.isNull() || e.isRemoved()) { nonExistent = true; log.trace("Nothing to remove since the entry doesn't exist in the context or it is null"); if (valueMatchingPolicy.matches(e, value, null, valueEquivalence)) { if (e != null) { e.setChanged(true); e.setRemoved(true); } return null; } else { successful = false; return false; } } if (!valueMatchingPolicy.matches(e, value, null, valueEquivalence)) { successful = false; return false; } if (this instanceof EvictCommand) { e.setEvicted(true); } return performRemove(e, ctx); }

Target:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e == null || e.isNull() || e.isRemoved()) { nonExistent = true; if (valueMatcher.matches(e, value, null, valueEquivalence)) { if (e != null) { e.setChanged(true); e.setRemoved(true); } return isConditional() ? true : null; } else { log.trace("Nothing to remove since the entry doesn't exist in the context or it is null"); successful = false; return false; } } if (!valueMatcher.matches(e, value, null, valueEquivalence)) { successful = false; return false; } if (this instanceof EvictCommand) { e.setEvicted(true); } return performRemove(e, ctx); }
Source:
public static boolean nodeHasSchemaProperties( PrimitiveIntObjectMap<PropertyBlock> nodePropertyMap, int[] indexPropertyIds ) { for ( int indexPropertyId : indexPropertyIds ) { if ( !nodePropertyMap.containsKey( indexPropertyId ) ) { return false; } } return true; }

Target:
private static boolean nodeHasSchemaProperties( PrimitiveIntObjectMap<PropertyBlock> nodePropertyMap, int[] indexPropertyIds ) { for ( int indexPropertyId : indexPropertyIds ) { if ( !nodePropertyMap.containsKey( indexPropertyId ) ) { return false; } } return true; }
Source:
private void updateImageToDestinationDomainMap() { if (disks == null) { return; } for (DiskModel diskModel : disks) { StorageDomain storageDomain = diskModel.getStorageDomain().getSelectedItem(); DiskImage diskImage = (DiskImage) diskModel.getDisk(); diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storageDomain.getId()))); diskImage.setDiskAlias(diskModel.getAlias().getEntity()); DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem(); diskImage.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null); if (diskModel.getQuota().getSelectedItem() != null) { diskImage.setQuotaId(diskModel.getQuota().getSelectedItem().getId()); } if (diskModel.getVolumeFormat().getIsAvailable()) { VolumeFormat volumeFormat = diskModel.getVolumeFormat().getSelectedItem(); diskImage.setVolumeFormat(volumeFormat); diskImage.setVolumeType(AsyncDataProvider.getInstance() .getVolumeType(volumeFormat, storageDomain.getStorageType(), diskImage.getImage()) ); } else if (diskModel.getVolumeType().getIsAvailable()) { VolumeType volumeType = diskModel.getVolumeType().getSelectedItem(); diskImage.setVolumeType(volumeType); diskImage.setVolumeFormat(AsyncDataProvider.getInstance().getDiskVolumeFormat( volumeType, storageDomain.getStorageType())); } imageToDestinationDomainMap.put(diskImage.getId(), diskImage); } }

Target:
private void updateImageToDestinationDomainMap() { if (disks == null) { return; } for (DiskModel diskModel : disks) { StorageDomain storageDomain = diskModel.getStorageDomain().getSelectedItem(); DiskImage diskImage = (DiskImage) diskModel.getDisk(); diskImage.setStorageIds(new ArrayList<>(Collections.singletonList(storageDomain.getId()))); diskImage.setDiskAlias(diskModel.getAlias().getEntity()); DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem(); diskImage.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null); if (diskModel.getQuota().getSelectedItem() != null) { diskImage.setQuotaId(diskModel.getQuota().getSelectedItem().getId()); } if (diskModel.getVolumeFormat().getIsAvailable()) { VolumeFormat volumeFormat = diskModel.getVolumeFormat().getSelectedItem(); diskImage.setVolumeFormat(volumeFormat); diskImage.setVolumeType(AsyncDataProvider.getInstance() .getVolumeType(volumeFormat, storageDomain.getStorageType(), diskModel.getVm(), diskImage.getImage()) ); } else if (diskModel.getVolumeType().getIsAvailable()) { VolumeType volumeType = diskModel.getVolumeType().getSelectedItem(); diskImage.setVolumeType(volumeType); diskImage.setVolumeFormat(AsyncDataProvider.getInstance().getDiskVolumeFormat( volumeType, storageDomain.getStorageType())); } imageToDestinationDomainMap.put(diskImage.getId(), diskImage); } }
Source:
public void testRemoveKeyWordsFollowedByTabChar() { String selectWithSpace = "SELECT\tid, 'yes', false"; String fromWithSpace = "FROM\ttest.verification_table"; String whereWithSpace = "WHERE\tTRUE"; pagingQueryProvider.setSelectClause( selectWithSpace ); pagingQueryProvider.setFromClause( fromWithSpace ); pagingQueryProvider.setWhereClause( whereWithSpace ); assertEquals("id, 'yes', false", pagingQueryProvider.getSelectClause()); assertEquals("test.verification_table", pagingQueryProvider.getFromClause()); assertEquals("TRUE", pagingQueryProvider.getWhereClause()); }

Target:
public void testRemoveKeyWordsFollowedByTabChar() { String selectClause = "SELECT\tid, 'yes', false"; String fromClause = "FROM\ttest.verification_table"; String whereClause = "WHERE\tTRUE"; pagingQueryProvider.setSelectClause( selectClause ); pagingQueryProvider.setFromClause( fromClause ); pagingQueryProvider.setWhereClause( whereClause ); assertEquals("id, 'yes', false", pagingQueryProvider.getSelectClause()); assertEquals("test.verification_table", pagingQueryProvider.getFromClause()); assertEquals("TRUE", pagingQueryProvider.getWhereClause()); }
Source:
private void send(OutputStream outputStream) { String mime = mimeType; SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US); gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT")); try { if (status == null) { throw new Error("sendResponse(): Status can't be null."); } PrintWriter pw = new PrintWriter(outputStream); pw.print("HTTP/1.1 " + status.getDescription() + " \r\n"); if (mime != null) { pw.print("Content-Type: " + mime + "\r\n"); } if (header == null || header.get("Date") == null) { pw.print("Date: " + gmtFrmt.format(new Date()) + "\r\n"); } if (header != null) { for (String key : header.keySet()) { String value = header.get(key); pw.print(key + ": " + value + "\r\n"); } } pw.print("Connection: keep-alive\r\n"); if (requestMethod != Method.HEAD && data instanceof PipedInputStream) { sendAsChunked(outputStream, pw); } else { sendAsFixedLength(outputStream, pw); } outputStream.flush(); safeClose(data); } catch (IOException ioe) { } }

Target:
private void send(OutputStream outputStream) { String mime = mimeType; SimpleDateFormat gmtFrmt = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US); gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT")); try { if (status == null) { throw new Error("sendResponse(): Status can't be null."); } PrintWriter pw = new PrintWriter(outputStream); pw.print("HTTP/1.1 " + status.getDescription() + " \r\n"); if (mime != null) { pw.print("Content-Type: " + mime + "\r\n"); } if (header == null || header.get("Date") == null) { pw.print("Date: " + gmtFrmt.format(new Date()) + "\r\n"); } if (header != null) { for (String key : header.keySet()) { String value = header.get(key); pw.print(key + ": " + value + "\r\n"); } } pw.print("Connection: keep-alive\r\n"); if (requestMethod != Method.HEAD && chunkedTransfer) { sendAsChunked(outputStream, pw); } else { sendAsFixedLength(outputStream, pw); } outputStream.flush(); safeClose(data); } catch (IOException ioe) { } }
Source:
private void queueWork(int maximumMessageCount, Duration maxWaitTime, FluxSink<ServiceBusReceivedMessage> emitter) { final long id = idGenerator.getAndIncrement(); int prefetch = asyncClient.getReceiverOptions().getPrefetchCount(); int toRequest = prefetch != 0 ? Math.min(maximumMessageCount, prefetch) : maximumMessageCount; final SynchronousReceiveWork work = new SynchronousReceiveWork(id, toRequest, maxWaitTime, emitter); SynchronousMessageSubscriber messageSubscriber = synchronousMessageSubscriber.get(); if (messageSubscriber == null) { SynchronousMessageSubscriber newSubscriber = new SynchronousMessageSubscriber(toRequest, work); if (!synchronousMessageSubscriber.compareAndSet(null, newSubscriber)) { newSubscriber.dispose(); SynchronousMessageSubscriber existing = synchronousMessageSubscriber.get(); existing.queueWork(work); } else { asyncClient.receiveMessages().subscribeWith(newSubscriber); } } else { messageSubscriber.queueWork(work); } logger.verbose("[{}] Receive request queued up.", work.getId()); }

Target:
private void queueWork(int maximumMessageCount, Duration maxWaitTime, FluxSink<ServiceBusReceivedMessage> emitter) { final long id = idGenerator.getAndIncrement(); final int prefetch = asyncClient.getReceiverOptions().getPrefetchCount(); final int toRequest = prefetch != 0 ? Math.min(maximumMessageCount, prefetch) : maximumMessageCount; final SynchronousReceiveWork work = new SynchronousReceiveWork(id, toRequest, maxWaitTime, emitter); SynchronousMessageSubscriber messageSubscriber = synchronousMessageSubscriber.get(); if (messageSubscriber == null) { SynchronousMessageSubscriber newSubscriber = new SynchronousMessageSubscriber(toRequest, work); if (!synchronousMessageSubscriber.compareAndSet(null, newSubscriber)) { newSubscriber.dispose(); SynchronousMessageSubscriber existing = synchronousMessageSubscriber.get(); existing.queueWork(work); } else { asyncClient.receiveMessagesNoBackPressure().subscribeWith(newSubscriber); } } else { messageSubscriber.queueWork(work); } logger.verbose("[{}] Receive request queued up.", work.getId()); }
Source:
public OMElement serializeSpecificMediator(Mediator mediator) { if (!(mediator instanceof PropertyGroupMediator)) { handleException("Unsupported mediator passed in for serialization : " + mediator.getType()); } PropertyGroupMediator propertyGroupMediator = (PropertyGroupMediator) mediator; PropertyMediatorSerializer propertyMediatorSerializer = new PropertyMediatorSerializer(); OMElement propertyGroup = fac.createOMElement("propertyGroup", synNS); saveTracingState(propertyGroup, propertyGroupMediator); List<PropertyMediator> propertyGroupList = propertyGroupMediator.getPropGroupList(); for (PropertyMediator propertyMediator : propertyGroupList) { OMElement property = propertyMediatorSerializer.serializeSpecificMediator(propertyMediator); propertyGroup.addChild(property); } return propertyGroup; }

Target:
public OMElement serializeSpecificMediator(Mediator mediator) { if (!(mediator instanceof PropertyGroupMediator)) { handleException("Unsupported mediator passed in for serialization : " + mediator.getType()); } PropertyGroupMediator propertyGroupMediator = (PropertyGroupMediator) mediator; PropertyMediatorSerializer propertyMediatorSerializer = new PropertyMediatorSerializer(); OMElement propertyGroup = fac.createOMElement(PropertyGroupMediatorFactory.PROPERTY_GROUP_Q); saveTracingState(propertyGroup, propertyGroupMediator); List<PropertyMediator> propertyGroupList = propertyGroupMediator.getPropGroupList(); for (PropertyMediator propertyMediator : propertyGroupList) { OMElement property = propertyMediatorSerializer.serializeSpecificMediator(propertyMediator); propertyGroup.addChild(property); } return propertyGroup; }
Source:
private Pair<ContainerPlacementMessage.StatusCode, String> validatePlacementAction(ContainerPlacementRequestMessage requestMessage) { String errorMessagePrefix = ContainerPlacementMessage.StatusCode.BAD_REQUEST + " reason: %s"; Boolean invalidAction = false; String errorMessage = null; if (!samzaApplicationState.runningProcessors.containsKey(requestMessage.getProcessorId()) && !samzaApplicationState.pendingProcessors.containsKey(requestMessage.getProcessorId()) && !samzaApplicationState.failedProcessors.containsKey(requestMessage.getProcessorId()) ) { errorMessage = String.format(errorMessagePrefix, "invalid processor id neither in running or pending processors"); invalidAction = true; } else if (placementRequestsCache.containsKey(requestMessage.getUuid())) { errorMessage = String.format(errorMessagePrefix, "duplicate UUID of the request, please retry"); invalidAction = true; } else if (standbyContainerManager.isPresent() && !standbyContainerManager.get() .checkStandbyConstraints(requestMessage.getProcessorId(), requestMessage.getDestinationHost())) { errorMessage = String.format(errorMessagePrefix, "destination host does not meet standby constraints"); invalidAction = true; } if (invalidAction) { return new ImmutablePair<>(ContainerPlacementMessage.StatusCode.BAD_REQUEST, errorMessage); } return new ImmutablePair<>(ContainerPlacementMessage.StatusCode.ACCEPTED, "Request is accepted"); }

Target:
private Pair<ContainerPlacementMessage.StatusCode, String> validatePlacementAction(ContainerPlacementRequestMessage requestMessage) { String errorMessagePrefix = ContainerPlacementMessage.StatusCode.BAD_REQUEST + " reason: %s"; Boolean invalidAction = false; String errorMessage = null; boolean isRunning = samzaApplicationState.runningProcessors.containsKey(requestMessage.getProcessorId()); boolean isPending = samzaApplicationState.pendingProcessors.containsKey(requestMessage.getProcessorId()); boolean isFailed = samzaApplicationState.failedProcessors.containsKey(requestMessage.getProcessorId()); if (!isRunning && !isPending && !isFailed) { errorMessage = String.format(errorMessagePrefix, "invalid processor id neither in running, pending or failed processors"); invalidAction = true; } else if (placementRequestsCache.containsKey(requestMessage.getUuid())) { errorMessage = String.format(errorMessagePrefix, "duplicate UUID of the request, please retry"); invalidAction = true; } else if (standbyContainerManager.isPresent() && !standbyContainerManager.get() .checkStandbyConstraints(requestMessage.getProcessorId(), requestMessage.getDestinationHost())) { errorMessage = String.format(errorMessagePrefix, "destination host does not meet standby constraints"); invalidAction = true; } if (invalidAction) { return new ImmutablePair<>(ContainerPlacementMessage.StatusCode.BAD_REQUEST, errorMessage); } return new ImmutablePair<>(ContainerPlacementMessage.StatusCode.ACCEPTED, "Request is accepted"); }
Source:
public static int incrementAndGetInt(long ptr) { while (true) { int old = getInt(ptr); int updated = old + 1; if (compareAndSwapInt(null, ptr, old, updated)) return updated; } }

Target:
public static int incrementAndGetInt(long ptr) { return UNSAFE.getAndAddInt(null, ptr, 1) + 1; }
Source:
public void addRelation(Model nifModel, Resource documentAsResource, String documentURI, Relation relation, int markingId) { StringBuilder uriBuilder = new StringBuilder(); uriBuilder.append(documentURI); uriBuilder.append("#relation"); uriBuilder.append(markingId); Resource relationAsResource = nifModel.createResource(uriBuilder.toString()); nifModel.add(relationAsResource, RDF.type, RDF.Statement); nifModel.add(relationAsResource, RDF.subject, ResourceFactory.createResource(relation.getSubject().getUris().iterator().next())); nifModel.add(relationAsResource, RDF.predicate, ResourceFactory.createResource(relation.getPredicate().getUris().iterator().next())); nifModel.add(relationAsResource, RDF.object, ResourceFactory.createResource(relation.getObject().getUris().iterator().next())); nifModel.add(relationAsResource, OA.hasTarget, OA.SpecificResource); nifModel.add(relationAsResource, OA.hasSource, ""); nifModel.add(relationAsResource, NIF.referenceContext, documentAsResource); if (relation instanceof ScoredMarking) { nifModel.add(relationAsResource, ITSRDF.taConfidence, nifModel.createTypedLiteral(((ScoredMarking) relation).getConfidence(), XSDDatatype.XSDdouble)); } addProvenanceInfoLink(relation, relationAsResource, nifModel, documentURI); }

Target:
public void addRelation(Model nifModel, Resource documentAsResource, String documentURI, Relation relation, int markingId) { StringBuilder uriBuilder = new StringBuilder(); uriBuilder.append(documentURI); uriBuilder.append("#relation"); uriBuilder.append(markingId); Resource relationAsResource = nifModel.createResource(uriBuilder.toString()); nifModel.add(relationAsResource, RDF.type, RDF.Statement); nifModel.add(relationAsResource, RDF.type, OA.Annotation); nifModel.add(relationAsResource, RDF.subject, ResourceFactory.createResource(relation.getSubject().getUris().iterator().next())); nifModel.add(relationAsResource, RDF.predicate, ResourceFactory.createResource(relation.getPredicate().getUris().iterator().next())); nifModel.add(relationAsResource, RDF.object, ResourceFactory.createResource(relation.getObject().getUris().iterator().next())); Resource relationAsResource2 = nifModel.createResource(); nifModel.add(relationAsResource, OA.hasTarget, relationAsResource2); nifModel.add(relationAsResource2, RDF.type, OA.SpecificResource); nifModel.add(relationAsResource2, OA.hasSource, documentAsResource); if (relation instanceof ScoredMarking) { nifModel.add(relationAsResource, ITSRDF.taConfidence, nifModel.createTypedLiteral(((ScoredMarking) relation).getConfidence(), XSDDatatype.XSDdouble)); } addProvenanceInfoLink(relation, relationAsResource, nifModel, documentURI); }
Source:
public PayloadSlice nextSlice() { checkNotNull(this.payload, "payload"); long sliceLength = getRemaining() < (partSizeInMB << 20) ? getRemaining() : partSizeInMB << 20; Payload slicedPayload = slicer.slice(payload, copied, sliceLength); ContentRange range = ContentRange.build(copied, copied + sliceLength - 1); copied += sliceLength; part++; return new PayloadSlice(slicedPayload, range, part); }

Target:
public PayloadSlice nextSlice() { checkNotNull(this.payload, "payload"); long sliceLength = Math.min(getRemaining(), partSizeInMB << 20); Payload slicedPayload = slicer.slice(payload, copied, sliceLength); ContentRange range = ContentRange.build(copied, copied + sliceLength - 1); copied += sliceLength; part++; return new PayloadSlice(slicedPayload, range, part); }
Source:
void twoTestClassesCanShareStateViaEngineExtensionContext() { Parent.counter.set(0); executeTests(request().selectors(selectClass(A.class), selectClass(B.class)).build()); assertThat(Parent.counter).hasValue(1); }

Target:
void twoTestClassesCanShareStateViaEngineExtensionContext() { Parent.counter.set(0); ExecutionEventRecorder eventRecorder = executeTests( request().selectors(selectClass(A.class), selectClass(B.class)).build()); assertThat(eventRecorder.getTestFinishedCount()).isEqualTo(2); assertThat(Parent.counter).hasValue(1); }
Source:
private void setConfirmResultConverter() { setResultConverter((dialogButton) -> { List<PickerAssignee> finalList = state.getCurrentAssigneesList(); if (hasSelectedAssignee(finalList)) { return new AssigneePickerDialogResponse(dialogButton, Optional.of(getSelectedAssignee(finalList).get().getLoginName())); } return new AssigneePickerDialogResponse(dialogButton, Optional.empty()); }); }

Target:
private void setConfirmResultConverter() { setResultConverter((dialogButton) -> { List<PickerAssignee> finalUsers = state.getCurrentUsersList(); Optional<PickerAssignee> selectedAssignee = PickerAssignee.getSelectedAssignee(finalUsers); return new AssigneePickerDialogResponse(dialogButton, selectedAssignee.map(PickerAssignee::getLoginName)); }); }