auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static String getStreamState(AmazonKinesisClient kinesisClient, String streamName) { DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest(); describeStreamRequest.setStreamName(streamName); try { return kinesisClient.describeStream(describeStreamRequest).getStreamDescription().getStreamStatus(); } catch (AmazonServiceException e) { LOG.debug("State of the stream could not be found", streamName); return ""; } }

Target:
private static StreamStatus getStreamState(AmazonKinesisClient kinesisClient, String streamName) { DescribeStreamRequest describeStreamRequest = new DescribeStreamRequest(); describeStreamRequest.setStreamName(streamName); String status = kinesisClient.describeStream(describeStreamRequest).getStreamDescription().getStreamStatus(); return StreamStatus.fromValue(status); }
Source:
public Runner runnerForClass(Class<?> testClass) throws Exception { for (Class<?> currentTestClass = testClass; currentTestClass != null; currentTestClass = getEnclosingClassForNonStaticMemberClass(currentTestClass)) { RunWith annotation = currentTestClass.getAnnotation(RunWith.class); if (annotation != null) { return buildRunner(annotation.value(), currentTestClass); } } return null; }

Target:
public Runner runnerForClass(Class<?> testClass) throws Exception { for (Class<?> currentTestClass = testClass; currentTestClass != null; currentTestClass = getEnclosingClassForNonStaticMemberClass(currentTestClass)) { RunWith annotation = currentTestClass.getAnnotation(RunWith.class); if (annotation != null) { return buildRunner(annotation.value(), testClass); } } return null; }
Source:
public void processEapMessage(byte[] msgBytes) { mCallbackFired = false; mProcessResponse = null; mCbHandler.postDelayed(() -> { if (!mCallbackFired) { mCallbackFired = true; mCb.onError(new TimeoutException("Timeout while processing message")); } }, this, TIMEOUT_MILLIS); mWorkerPool.execute(() -> { try { mProcessResponse = mStateMachine.process(msgBytes); } catch (Exception ex) { Log.e(TAG, "Exception thrown while processing message", ex); mProcessResponse = new EapError(ex); } mCbHandler.post(() -> { if (!mCallbackFired) { if (mProcessResponse instanceof EapResponse) { mCb.onResponse(((EapResponse) mProcessResponse).packet); } else if (mProcessResponse instanceof EapError) { mCb.onError(((EapError) mProcessResponse).cause); } else if (mProcessResponse instanceof EapSuccess) { EapSuccess eapSuccess = (EapSuccess) mProcessResponse; mCb.onSuccess(eapSuccess.msk, eapSuccess.emsk); } else { mCb.onFail(); } mCallbackFired = true; mCbHandler.removeCallbacksAndMessages(this); } }); }); }

Target:
public void processEapMessage(byte[] msgBytes) { mCallbackFired = false; mCbHandler.postDelayed(() -> { if (!mCallbackFired) { mCallbackFired = true; mCb.onError(new TimeoutException("Timeout while processing message")); } }, EapAuthenticator.this, mTimeoutMillis); mWorkerPool.execute(() -> { EapResult processResponse; try { processResponse = mStateMachine.process(msgBytes); } catch (Exception ex) { Log.e(TAG, "Exception thrown while processing message", ex); processResponse = new EapError(ex); } final EapResult finalProcessResponse = processResponse; mCbHandler.post(() -> { if (!mCallbackFired) { if (finalProcessResponse instanceof EapResponse) { mCb.onResponse(((EapResponse) finalProcessResponse).packet); } else if (finalProcessResponse instanceof EapError) { mCb.onError(((EapError) finalProcessResponse).cause); } else if (finalProcessResponse instanceof EapSuccess) { EapSuccess eapSuccess = (EapSuccess) finalProcessResponse; mCb.onSuccess(eapSuccess.msk, eapSuccess.emsk); } else { mCb.onFail(); } mCallbackFired = true; mCbHandler.removeCallbacksAndMessages(EapAuthenticator.this); } }); }); }
Source:
public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable { final Object result = super.visitPrepareCommand(ctx, command); if (!ctx.isOriginLocal()) { for (WriteCommand wc : command.getModifications()) { wc.acceptVisitor(ctx, serializationContextUpdaterVisitor); } } return result; }

Target:
public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command) throws Throwable { final Object result = invokeNextInterceptor(ctx, command); if (!ctx.isOriginLocal()) { for (WriteCommand wc : command.getModifications()) { wc.acceptVisitor(ctx, serializationContextUpdaterVisitor); } } return result; }
Source:
private SequenceSegment createSegment(final String descriptor, final String content) { if (descriptor.charAt(0) != '>') { throw new IllegalArgumentException(); } String[] desc = descriptor.split("\\|"); String[] sources = desc[SOURCES_POS].split(","); Set<Sequence> currentSequences = new HashSet<>(); for (String sequencename : sources) { sequencename = sequencename.trim(); if (!sequences.containsKey(sequencename)) { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") DefaultSequence newSequence = new DefaultSequence(sequencename); sequences.put(sequencename, newSequence); } currentSequences.add(sequences.get(sequencename)); } SequenceSegment segment = new SequenceSegment(currentSequences, Integer.parseInt(desc[START_POS].trim()), Integer.parseInt(desc[END_POS].trim()), new SegmentString( content.trim())); for (Sequence s : currentSequences) { s.appendSegment(segment); } return segment; }

Target:
private SequenceSegment createSegment(final String descriptor, final String content) { if (descriptor.charAt(0) != '>') { throw new IllegalArgumentException(); } String[] desc = descriptor.split("\\|"); String[] sources = desc[SOURCES_POS].split(","); Set<Sequence> currentSequences = new HashSet<>(); for (String sequencename : sources) { sequencename = sequencename.trim(); if (!sequences.containsKey(sequencename)) { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") Sequence newSequence = new DefaultSequence(sequencename); sequences.put(sequencename, newSequence); } currentSequences.add(sequences.get(sequencename)); } SequenceSegment segment = new SequenceSegment(currentSequences, Integer.parseInt(desc[START_POS].trim()), Integer.parseInt(desc[END_POS].trim()), new SegmentString( content.trim())); for (Sequence s : currentSequences) { s.appendSegment(segment); } return segment; }
Source:
public void enterModule(ModuleInfo moduleInfo) { this.indexer.addModuleDeclaration(moduleInfo.moduleName); if (moduleInfo.requires != null) { for (ISourceElementRequestor.RequiresInfo req : moduleInfo.requires) { if (req == null || req.moduleName == null || req.moduleName == CharOperation.NO_CHAR) { continue; } this.indexer.addModuleReference(req.moduleName); } } enterPackageVisibilityInfo(moduleInfo.exports); enterPackageVisibilityInfo(moduleInfo.opens); }

Target:
public void enterModule(ModuleInfo moduleInfo) { this.indexer.addModuleDeclaration(moduleInfo.moduleName); if (moduleInfo.requires != null) { for (ISourceElementRequestor.RequiresInfo req : moduleInfo.requires) { if (req == null || req.moduleName == null || req.moduleName == CharOperation.NO_CHAR) continue; this.indexer.addModuleReference(req.moduleName); } } enterPackageVisibilityInfo(moduleInfo.exports); enterPackageVisibilityInfo(moduleInfo.opens); }
Source:
@Override protected Properties setupProperties() { Properties properties = super.setupProperties(); properties.put(ComputeServiceProperties.POLL_INITIAL_PERIOD, 1000); properties.put(ComputeServiceProperties.POLL_MAX_PERIOD, 10000); properties.setProperty(AzureComputeProperties.OPERATION_TIMEOUT, "46000000"); properties.setProperty(AzureComputeProperties.OPERATION_POLL_INITIAL_PERIOD, "5"); properties.setProperty(AzureComputeProperties.OPERATION_POLL_MAX_PERIOD, "15"); properties.setProperty(AzureComputeProperties.TCP_RULE_FORMAT, "tcp_%s-%s"); properties.setProperty(AzureComputeProperties.TCP_RULE_REGEXP, "tcp_\\d{1,5}-\\d{1,5}"); long scriptTimeout = TimeUnit.MILLISECONDS.convert(20, TimeUnit.MINUTES); properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, scriptTimeout + ""); properties.setProperty(TIMEOUT_NODE_RUNNING, scriptTimeout + ""); AzureLiveTestUtils.defaultProperties(properties); checkNotNull(setIfTestSystemPropertyPresent(properties, "jclouds.oauth.resource"), "test.jclouds.oauth.resource"); checkNotNull(setIfTestSystemPropertyPresent(properties, "oauth.endpoint"), "test.oauth.endpoint"); return properties; }

Target:
@Override protected Properties setupProperties() { azureGroup = "jc" + RAND; Properties properties = super.setupProperties(); long scriptTimeout = TimeUnit.MILLISECONDS.convert(60, TimeUnit.MINUTES); properties.setProperty(TIMEOUT_SCRIPT_COMPLETE, scriptTimeout + ""); properties.setProperty(TIMEOUT_NODE_RUNNING, scriptTimeout + ""); AzureLiveTestUtils.defaultProperties(properties); checkNotNull(setIfTestSystemPropertyPresent(properties, "oauth.endpoint"), "test.oauth.endpoint"); properties.put(RESOURCE_GROUP_NAME, azureGroup); return properties; }
Source:
public Guid schedule(VDSGroup cluster, VM vm, List<Guid> hostBlackList, List<Guid> hostWhiteList, Guid destHostId, List<String> messages, VdsFreeMemoryChecker memoryChecker, String correlationId) { clusterLockMap.putIfAbsent(cluster.getId(), new Semaphore(1)); try { log.debug("Scheduling started"); checkAllowOverbooking(cluster); clusterLockMap.get(cluster.getId()).acquire(); List<VDS> vdsList = getVdsDAO() .getAllForVdsGroupWithStatus(cluster.getId(), VDSStatus.Up); updateInitialHostList(vdsList, hostBlackList, true); updateInitialHostList(vdsList, hostWhiteList, false); ClusterPolicy policy = policyMap.get(cluster.getClusterPolicyId()); Map<String, String> parameters = createClusterPolicyParameters(cluster); vdsList = runFilters(policy.getFilters(), vdsList, vm, parameters, policy.getFilterPositionMap(), messages, memoryChecker, true, correlationId); if (vdsList == null || vdsList.isEmpty()) { return null; } Guid bestHost = selectBestHost(cluster, vm, destHostId, vdsList, policy, parameters); getVdsDynamicDao().updatePartialVdsDynamicCalc( bestHost, 1, vm.getNumOfCpus(), vm.getMinAllocatedMem(), 0, 0); return bestHost; } catch (InterruptedException e) { log.error("interrupted", e); return null; } finally { synchronized (clusterLockMap.get(cluster.getId())) { clusterLockMap.get(cluster.getId()).drainPermits(); clusterLockMap.get(cluster.getId()).release(); } log.debug("Scheduling ended, correlation Id: {}", correlationId); } }

Target:
public Guid schedule(VDSGroup cluster, VM vm, List<Guid> hostBlackList, List<Guid> hostWhiteList, Guid destHostId, List<String> messages, VdsFreeMemoryChecker memoryChecker, String correlationId) { clusterLockMap.putIfAbsent(cluster.getId(), new Semaphore(1)); try { log.debug("Scheduling started, correlation Id: {}", correlationId); checkAllowOverbooking(cluster); clusterLockMap.get(cluster.getId()).acquire(); List<VDS> vdsList = getVdsDAO() .getAllForVdsGroupWithStatus(cluster.getId(), VDSStatus.Up); updateInitialHostList(vdsList, hostBlackList, true); updateInitialHostList(vdsList, hostWhiteList, false); ClusterPolicy policy = policyMap.get(cluster.getClusterPolicyId()); Map<String, String> parameters = createClusterPolicyParameters(cluster); vdsList = runFilters(policy.getFilters(), vdsList, vm, parameters, policy.getFilterPositionMap(), messages, memoryChecker, true, correlationId); if (vdsList == null || vdsList.isEmpty()) { return null; } Guid bestHost = selectBestHost(cluster, vm, destHostId, vdsList, policy, parameters); getVdsDynamicDao().updatePartialVdsDynamicCalc( bestHost, 1, vm.getNumOfCpus(), vm.getMinAllocatedMem(), 0, 0); return bestHost; } catch (InterruptedException e) { log.error("interrupted", e); return null; } finally { synchronized (clusterLockMap.get(cluster.getId())) { clusterLockMap.get(cluster.getId()).drainPermits(); clusterLockMap.get(cluster.getId()).release(); } log.debug("Scheduling ended, correlation Id: {}", correlationId); } }
Source:
CertificateAsyncClient(URL vaultUrl, HttpPipeline pipeline, CertificateServiceVersion version) { Objects.requireNonNull(vaultUrl, KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); this.vaultUrl = vaultUrl.toString(); this.service = RestProxy.create(CertificateService.class, pipeline); API_VERSION = version.getVersion(); }

Target:
CertificateAsyncClient(URL vaultUrl, HttpPipeline pipeline, CertificateServiceVersion version) { Objects.requireNonNull(vaultUrl, KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); this.vaultUrl = vaultUrl.toString(); this.service = RestProxy.create(CertificateService.class, pipeline); apiVersion = version.getVersion(); }
Source:
private Block getNullBlock(Type type, int positionCount) { Block nullValueBlock = type.createBlockBuilder(null, 1) .appendNull() .build(); return new RunLengthEncodedBlock(nullValueBlock, positionCount); }

Target:
private static Block getNullBlock(Type type, int positionCount) { Block nullValueBlock = type.createBlockBuilder(null, 1) .appendNull() .build(); return new RunLengthEncodedBlock(nullValueBlock, positionCount); }
Source:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(Keys.SPAWNER_REMAINING_DELAY) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_REMAINING_DELAY) .actualValue(actualValue) .build(); }

Target:
protected MutableBoundedValue<Short> constructValue(Short actualValue) { return SpongeValueFactory.boundedBuilder(this.key) .minimum((short) 0) .maximum(Short.MAX_VALUE) .defaultValue(DataConstants.DEFAULT_SPAWNER_REMAINING_DELAY) .actualValue(actualValue) .build(); }
Source:
public boolean hasNext() { if (finished) return false; if (iter != null && iter.hasNext()) { return true; } iter = getNextBatch().iterator(); if (!iter.hasNext()) { finished = true; activeIters.remove(this); return false; } return true; }

Target:
public boolean hasNext() { if (finished) return false; if (iter != null && iter.hasNext()) { return true; } iter = getNextBatch().iterator(); if (!iter.hasNext()) { finished = true; reporter.finished(this); return false; } return true; }
Source:
private static void fillInputPayload(Operation swaggerOperation, org.restlet.ext.apispark.internal.model.Operation operation, Contract contract) { BodyParameter bodyParameter = SwaggerUtils.getInputPayload(swaggerOperation); if (bodyParameter != null) { PayLoad payload = new PayLoad(); Model model = bodyParameter.getSchema(); payload.setDescription(model.getDescription()); if (model instanceof ArrayModel) { ArrayModel arrayModel = (ArrayModel) model; payload.setArray(true); payload.setType(SwaggerTypes.toDefinitionType(arrayModel.getItems())); } else if (model instanceof RefModel) { RefModel refModel = (RefModel) model; payload.setType(refModel.getSimpleRef()); } else { LOGGER.warning("Unsupported input payload type: " + model.getClass().getSimpleName()); } Representation representation = contract.getRepresentation(payload.getType()); if (representation != null) { representation.addSections(swaggerOperation.getTags()); } operation.setInputPayLoad(payload); } }

Target:
private static void fillInputPayload(Operation swaggerOperation, org.restlet.ext.apispark.internal.model.Operation operation, Contract contract) { BodyParameter bodyParameter = SwaggerUtils.getInputPayload(swaggerOperation); if (bodyParameter != null) { PayLoad payload = new PayLoad(); fillPayload(bodyParameter, payload); Representation representation = contract.getRepresentation(payload.getType()); if (representation != null) { representation.addSections(swaggerOperation.getTags()); } operation.setInputPayLoad(payload); } }
Source:
public SystemPurposeComplianceStatusDTO(SystemPurposeComplianceStatusDTO source) { this.populate(source); }

Target:
public SystemPurposeComplianceStatusDTO(SystemPurposeComplianceStatusDTO source) { super(source); }
Source:
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { byte[] array = closeClientButKeepContentStream(response); from = new String(array); validateXml(from); return doParse(new InputSource(new ByteArrayInputStream(array))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }

Target:
private T convertStreamToStringAndParse(HttpResponse response) { String from = null; try { byte[] fromBytes = closeClientButKeepContentStream(response); from = new String(fromBytes); validateXml(from); return doParse(new InputSource(new ByteArrayInputStream(fromBytes))); } catch (Exception e) { return addDetailsAndPropagate(response, e, from); } }
Source:
public IResource[] members() throws IOException { VirtualFile folder = getVirtualFile(); if (folder == null || !folder.exists()) { throw new FileNotFoundException( "Could not obtain child resources for " + this + " as it does not exist or is not valid"); } if (!folder.isDirectory()) { throw new IOException( "Could not obtain child resources for " + this + " as it is not a directory."); } List<IResource> result = new ArrayList<>(); VirtualFile[] children = folder.getChildren(); for (VirtualFile child : children) { IPath childPath = relativePath.append(IntelliJPathImpl.fromString(child.getName())); result.add( child.isDirectory() ? new IntellijFolderImplV2(referencePoint, childPath) : new IntellijFileImplV2(referencePoint, childPath)); } return result.toArray(new IResource[0]); }

Target:
public List<IResource> members() throws IOException { VirtualFile folder = getVirtualFile(); if (folder == null || !folder.exists()) { throw new FileNotFoundException( "Could not obtain child resources for " + this + " as it does not exist or is not valid"); } if (!folder.isDirectory()) { throw new IOException( "Could not obtain child resources for " + this + " as it is not a directory."); } List<IResource> result = new ArrayList<>(); VirtualFile[] children = folder.getChildren(); for (VirtualFile child : children) { IPath childPath = relativePath.append(IntelliJPathImpl.fromString(child.getName())); result.add( child.isDirectory() ? new IntellijFolderImplV2(referencePoint, childPath) : new IntellijFileImplV2(referencePoint, childPath)); } return result; }
Source:
public static JavaQualifiedName ofString(String name) { JavaQualifiedName qname = new JavaQualifiedName(); Matcher matcher = FORMAT.matcher(name); if (!matcher.matches()) { return null; } qname.packages = ".".equals(matcher.group(PACKAGES_GROUP_INDEX)) ? null : matcher.group(PACKAGES_GROUP_INDEX).split("\\."); qname.operation = matcher.group(OPERATION_GROUP_INDEX) == null ? null : matcher.group(OPERATION_GROUP_INDEX).substring(1); qname.classes = matcher.group(CLASSES_GROUP_INDEX).split("\\$"); qname.localIndices = new int[qname.classes.length]; Pattern localIndexPattern = Pattern.compile("(\\d+)(\\w+)"); for (int i = 0; i < qname.classes.length; i++) { Matcher localIndexMatcher = localIndexPattern.matcher(qname.classes[i]); if (localIndexMatcher.matches()) { qname.localIndices[i] = Integer.parseInt(localIndexMatcher.group(1)); qname.classes[i] = localIndexMatcher.group(2); } else { qname.localIndices[i] = NOTLOCAL_PLACEHOLDER; } } return qname; }

Target:
public static JavaQualifiedName ofString(String name) { JavaQualifiedName qname = new JavaQualifiedName(); Matcher matcher = FORMAT.matcher(name); if (!matcher.matches()) { return null; } qname.packages = ".".equals(matcher.group(PACKAGES_GROUP_INDEX)) ? null : matcher.group(PACKAGES_GROUP_INDEX).split("\\."); qname.operation = matcher.group(OPERATION_GROUP_INDEX) == null ? null : matcher.group(OPERATION_GROUP_INDEX).substring(1); qname.classes = matcher.group(CLASSES_GROUP_INDEX).split("\\$"); qname.localIndices = new int[qname.classes.length]; for (int i = 0; i < qname.classes.length; i++) { Matcher localIndexMatcher = LOCAL_INDEX_PATTERN.matcher(qname.classes[i]); if (localIndexMatcher.matches()) { qname.localIndices[i] = Integer.parseInt(localIndexMatcher.group(1)); qname.classes[i] = localIndexMatcher.group(2); } else { qname.localIndices[i] = NOTLOCAL_PLACEHOLDER; } } return qname; }
Source:
protected void configure() { if (repoConfig.getAllBasePaths().length == 0) { install(new LocalDiskRepositoryManager.Module()); } else { install(new ShardedLocalDiskRepositoryManager.Module()); } }

Target:
protected void configure() { if (repoConfig.getAllBasePaths().isEmpty()) { install(new LocalDiskRepositoryManager.Module()); } else { install(new MultiBaseLocalDiskRepositoryManager.Module()); } }
Source:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof GoogleComputeEngineTemplateOptions) { GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to); eTo.networks(to.getNetworks()); eTo.autoCreateKeyPair(autoCreateKeyPair()); eTo.serviceAccounts(serviceAccounts()); eTo.bootDiskType(bootDiskType()); eTo.disks(getDisks()); eTo.autoCreateDisks(getAutoCreateDisks()); eTo.canIpForward(canIpForward()); } }

Target:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof GoogleComputeEngineTemplateOptions) { GoogleComputeEngineTemplateOptions eTo = GoogleComputeEngineTemplateOptions.class.cast(to); eTo.autoCreateKeyPair(autoCreateKeyPair()); eTo.serviceAccounts(serviceAccounts()); eTo.bootDiskType(bootDiskType()); eTo.disks(getDisks()); eTo.addAutoCreateDisks(getAutoCreateDisks()); eTo.canIpForward(canIpForward()); } }
Source:
public void onKeyboardClosed() { fabSearchButton.setVisibility(View.VISIBLE); listView.clearChoices(); if(getCurrentFocus() != null) { System.out.println("Current focus: " + getCurrentFocus().toString()); } else { System.out.println("Current focus: null"); } }

Target:
public void onKeyboardClosed() { fabSearchButton.setVisibility(View.VISIBLE); listView.clearChoices(); }
Source:
public ActionResult execute() { InstructorCoursesPageData data = new InstructorCoursesPageData(account, sessionToken); List<InstructorAttributes> instructorList = logic.getInstructorsForGoogleId(data.account.googleId); for (InstructorAttributes instructor : instructorList) { List<FeedbackSessionAttributes> feedbackSessionList = logic.getRecoveryFeedbackSessionsListForInstructor(instructor); for (FeedbackSessionAttributes feedbackSession : feedbackSessionList) { gateKeeper.verifyAccessible(instructor, feedbackSession, false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); } } try { logic.restoreAllFeedbackSessionsFromRecovery(instructorList); String statusMessage = Const.StatusMessages.FEEDBACK_SESSION_ALL_RESTORED; statusToUser.add(new StatusMessage(statusMessage, StatusMessageColor.SUCCESS)); statusToAdmin = "All sessions restored"; } catch (Exception e) { setStatusForException(e); } return createRedirectResult(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE); }

Target:
public ActionResult execute() { InstructorCoursesPageData data = new InstructorCoursesPageData(account, sessionToken); List<InstructorAttributes> instructorList = logic.getInstructorsForGoogleId(data.account.googleId); for (InstructorAttributes instructor : instructorList) { List<FeedbackSessionAttributes> feedbackSessionList = logic.getRecoveryFeedbackSessionsListForInstructor(instructor); for (FeedbackSessionAttributes feedbackSession : feedbackSessionList) { gateKeeper.verifyAccessible(instructor, feedbackSession, false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); } } try { logic.restoreAllFeedbackSessionsFromRecovery(instructorList); String statusMessage = Const.StatusMessages.FEEDBACK_SESSION_ALL_RESTORED; statusToUser.add(new StatusMessage(statusMessage, StatusMessageColor.SUCCESS)); statusToAdmin = "All sessions in Recycle Bin restored"; } catch (Exception e) { setStatusForException(e); } return createRedirectResult(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE); }
Source:
public void launch(Package name) throws IOException, JadbException { InputStream s = device.executeShell("monkey", "-p", name.toString(), "-c", "android.intent.category.LAUNCHER", "1"); Stream.flushRead(s); s.close(); }

Target:
public void launch(Package name) throws IOException, JadbException { try (InputStream stream = device.executeShell("monkey", "-p", name.toString(), "-c", "android.intent.category.LAUNCHER", "1")) { Stream.flushRead(stream); } }
Source:
public Job getJob() throws Exception { if (isPartialBuild) { return configureJobForPartialBuild(); } else { long maxTimeRange = pIndexTable.getTimeStamp() + 1; if (pDataTable.isTransactional()) { configuration.set(PhoenixConfigurationUtil.TX_SCN_VALUE, Long.toString(TransactionUtil.convertToNanoseconds(maxTimeRange))); configuration.set(PhoenixConfigurationUtil.TX_PROVIDER, pDataTable.getTransactionProvider().name()); } configuration.set(PhoenixConfigurationUtil.CURRENT_SCN_VALUE, Long.toString(maxTimeRange)); if (useSnapshot || !useDirectApi || (!isLocalIndexBuild && pDataTable.isTransactional())) { return configureJobForAysncIndex(); } else { configuration.unset(PhoenixConfigurationUtil.CURRENT_SCN_VALUE); return configureJobForServerBuildIndex(); } } }

Target:
public Job getJob() throws Exception { if (isPartialBuild) { return configureJobForPartialBuild(); } else if (useSnapshot || !useDirectApi || (!isLocalIndexBuild && pDataTable.isTransactional())) { long maxTimeRange = pIndexTable.getTimeStamp() + 1; if (pDataTable.isTransactional()) { configuration.set(PhoenixConfigurationUtil.TX_SCN_VALUE, Long.toString(TransactionUtil.convertToNanoseconds(maxTimeRange))); configuration.set(PhoenixConfigurationUtil.TX_PROVIDER, pDataTable.getTransactionProvider().name()); } configuration.set(PhoenixConfigurationUtil.CURRENT_SCN_VALUE, Long.toString(maxTimeRange)); return configureJobForAysncIndex(); } else { return configureJobForServerBuildIndex(); } }
Source:
protected Number calculateVerticalStringDiff(final String templateString, final ILayerCell cell, final int toColumn) { ILayerCell[][] cells = this.clipboard.getCopiedCells(); int columnDiff = getColumnDiff(cell, toColumn); int rowArrayIndex = cell.getRowIndex() - this.clipboard.getCopiedCells()[0][0].getRowIndex(); if (cells[rowArrayIndex].length == 1) { return columnDiff; } else { Integer diff = calculateStringDiff(cells[rowArrayIndex][1], cells[rowArrayIndex][0], templateString); if (diff == null) { return null; } Integer temp = diff; for (int i = 1; i < cells.length; i++) { temp = calculateStringDiff(cells[rowArrayIndex][i], cells[rowArrayIndex][i - 1], templateString); if (temp == null || !temp.equals(diff)) { return null; } } return diff * columnDiff; } }

Target:
protected Number calculateVerticalStringDiff(final String templateString, final ILayerCell cell, final int toColumn) { final ILayerCell[][] cells = this.clipboard.getCopiedCells(); final int columnDiff = getColumnDiff(cell, toColumn); final int rowArrayIndex = cell.getRowIndex() - this.clipboard.getCopiedCells()[0][0].getRowIndex(); if (1 == cells[rowArrayIndex].length) { return columnDiff; } else { final Integer diff = calculateStringDiff(cells[rowArrayIndex][1], cells[rowArrayIndex][0], templateString); if (null == diff) { return null; } Integer temp = diff; for (int i = 1; i < cells.length; i++) { temp = calculateStringDiff(cells[rowArrayIndex][i], cells[rowArrayIndex][i - 1], templateString); if (null == temp || !temp.equals(diff)) { return null; } } return diff * columnDiff; } }
Source:
public static Mode fromString(String inStr) { if (inStr == null || inStr.isEmpty()) { throw new IllegalArgumentException("String representation of MultiAuthenticator.Mode can not be null nor empty."); } inStr = inStr.toLowerCase(); if (inStr.equals("any")){ return ANY; } if (inStr.equals("all") || inStr.equals("every")){ return ALL; } throw new IllegalArgumentException("Unknown string representation [" + inStr + "] for MultiAuthenticator.Mode"); }

Target:
public static Mode fromString(String inStr) { if (inStr == null || inStr.isEmpty()) { throw new IllegalArgumentException("String representation of MultiAuthenticator.Mode can not be null nor empty."); } if (inStr.equalsIgnoreCase("any")){ return ANY; } if (inStr.equalsIgnoreCase("all")){ return ALL; } throw new IllegalArgumentException("Unknown string representation [" + inStr + "] for MultiAuthenticator.Mode"); }
Source:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters()); Guid currentChildId = getCurrentChildId(getParameters()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Command id: '{}' is executing step: '{}'", getCommandId(), getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; } persistCommandIfNeeded(); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }

Target:
public boolean performNextOperation(int completedChildCount) { syncChildCommandList(getParameters()); Guid currentChildId = getCurrentChildId(getParameters()); if (currentChildId != null) { getParameters().setCommandStep(getParameters().getNextCommandStep()); } log.info("Command: '{}' id: '{}' executing step: '{}'", getActionType(), getCommandId(), getParameters().getCommandStep()); Pair<VdcActionType, ? extends VdcActionParametersBase> nextCommand = null; switch (getParameters().getCommandStep()) { case PREPARE_MERGE: break; case MERGE: break; case FINALIZE_MERGE: break; case DESTROY_IMAGE: break; case DESTROY_IMAGE_CHECK: break; } persistCommandIfNeeded(); if (nextCommand != null) { runInternalActionWithTasksContext(nextCommand.getFirst(), nextCommand.getSecond()); return true; } else { return false; } }
Source:
public static void run(String realfile, String host, int port, boolean debug2) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/main/test/resources/clienttest$.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public static void run(String realfile, String host, int port, boolean debug2) throws MalformedURLException, URISyntaxException { debug = debug2; String file = "reactivesocket-tck-drivers/src/main/test/resources/clienttest$.txt"; if (realfile != null) file = realfile; try { setURI(new URI("tcp://" + host + ":" + port + "/rs")); JavaClientDriver jd = new JavaClientDriver(file, JavaTCPClient::createClient); jd.runTests(); } catch (Exception e) { e.printStackTrace(); } }
Source:
private EntryLogEntry getFCForEntryInternal( long ledgerId, long entryId, long entryLogId, long pos) throws EntryLookupException, IOException { ByteBuf sizeBuff = sizeBuffer.get(); sizeBuff.clear(); pos -= 4; BufferedReadChannel fc; try { fc = getChannelForLogId(entryLogId); } catch (FileNotFoundException e) { throw new EntryLookupException.MissingLogFileException(ledgerId, entryId, entryLogId, pos); } try { if (readFromLogChannel(entryLogId, fc, sizeBuff, pos) != sizeBuff.capacity()) { throw new EntryLookupException.MissingEntryException(ledgerId, entryId, entryLogId, pos); } } catch (BufferedChannelBase.ChannelClosed | AsynchronousCloseException e) { throw new EntryLookupException.MissingLogFileException(ledgerId, entryId, entryLogId, pos); } pos += 4; int entrySize = sizeBuff.readInt(); if (entrySize > maxSaneEntrySize) { LOG.warn("Sanity check failed for entry size of " + entrySize + " at location " + pos + " in " + entryLogId); } if (entrySize < MIN_SANE_ENTRY_SIZE) { LOG.error("Read invalid entry length {}", entrySize); throw new EntryLookupException.InvalidEntryLengthException(ledgerId, entryId, entryLogId, pos); } long thisLedgerId = sizeBuff.getLong(4); long thisEntryId = sizeBuff.getLong(12); if (thisLedgerId != ledgerId || thisEntryId != entryId) { throw new EntryLookupException.WrongEntryException( thisEntryId, thisLedgerId, ledgerId, entryId, entryLogId, pos); } return new EntryLogEntry(entrySize, fc); }

Target:
private EntryLogEntry getFCForEntryInternal( long ledgerId, long entryId, long entryLogId, long pos) throws EntryLookupException, IOException { ByteBuf sizeBuff = sizeBuffer.get(); sizeBuff.clear(); pos -= 4; BufferedReadChannel fc; try { fc = getChannelForLogId(entryLogId); } catch (FileNotFoundException e) { throw new EntryLookupException.MissingLogFileException(ledgerId, entryId, entryLogId, pos); } try { if (readFromLogChannel(entryLogId, fc, sizeBuff, pos) != sizeBuff.capacity()) { throw new EntryLookupException.MissingEntryException(ledgerId, entryId, entryLogId, pos); } } catch (BufferedChannelBase.BufferedChannelClosedException | AsynchronousCloseException e) { throw new EntryLookupException.MissingLogFileException(ledgerId, entryId, entryLogId, pos); } pos += 4; int entrySize = sizeBuff.readInt(); if (entrySize > maxSaneEntrySize) { LOG.warn("Sanity check failed for entry size of " + entrySize + " at location " + pos + " in " + entryLogId); } if (entrySize < MIN_SANE_ENTRY_SIZE) { LOG.error("Read invalid entry length {}", entrySize); throw new EntryLookupException.InvalidEntryLengthException(ledgerId, entryId, entryLogId, pos); } long thisLedgerId = sizeBuff.getLong(4); long thisEntryId = sizeBuff.getLong(12); if (thisLedgerId != ledgerId || thisEntryId != entryId) { throw new EntryLookupException.WrongEntryException( thisEntryId, thisLedgerId, ledgerId, entryId, entryLogId, pos); } return new EntryLogEntry(entrySize, fc); }
Source:
protected InternalCompletableFuture<Boolean> callPutIfAbsentAsync(K key, Data keyData, V value, Data valueData, Data expiryPolicyData, boolean withCompletionEvent, BiConsumer<Boolean, Throwable> statsCallback) { InternalCompletableFuture<Boolean> future = doPutIfAbsentOnServer(keyData, valueData, expiryPolicyData, withCompletionEvent); if (statsCallback == null) { return future; } else { future.whenCompleteAsync(statsCallback); return future; } }

Target:
protected CompletableFuture<Boolean> callPutIfAbsentAsync(K key, Data keyData, V value, Data valueData, Data expiryPolicyData, boolean withCompletionEvent, BiConsumer<Boolean, Throwable> statsCallback) { InternalCompletableFuture<Boolean> future = doPutIfAbsentOnServer(keyData, valueData, expiryPolicyData, withCompletionEvent); return addCallback(future, statsCallback); }
Source:
public void assertStartsWithCount(int eventsCount, String startsWith) { List<LogEntry> logs = auditBackend.queryLogs(new AuditQueryBuilder().predicates( Predicates.eq(LOG_EVENT_ID, ID_FOR_AUDIT_STORAGE_TESTS), new Predicate(new Reference(LOG_DOC_PATH), Operator.STARTSWITH, Literals.toLiteral(startsWith)))); assertEquals(eventsCount, logs.size()); }

Target:
public void assertStartsWithCount(int eventsCount, String startsWith) { List<LogEntry> logs = auditBackend.queryLogs(new AuditQueryBuilder().predicates( Predicates.eq(LOG_EVENT_ID, ID_FOR_AUDIT_STORAGE_TESTS), Predicates.startsWith(LOG_DOC_PATH, startsWith))); assertEquals(eventsCount, logs.size()); }
Source:
private static boolean isSingleLineBlock(Details details) { final DetailAST rcurly = details.rcurly; final DetailAST lcurly = details.lcurly; final DetailAST nextToken = getNextToken(details.lcurly.getParent().getLastChild()); return rcurly.getLineNo() == lcurly.getLineNo() && (rcurly.getLineNo() != nextToken.getLineNo() || rcurly.getLineNo() != details.nextToken.getLineNo()); }

Target:
private static boolean isSingleLineBlock(Details details) { final DetailAST rcurly = details.rcurly; final DetailAST lcurly = details.lcurly; DetailAST nextToken = details.nextToken; while (nextToken.getType() == TokenTypes.LITERAL_ELSE) { nextToken = Details.getNextToken(nextToken); } if (nextToken.getType() == TokenTypes.DO_WHILE) { final DetailAST doWhileSemi = nextToken.getParent().getLastChild(); nextToken = Details.getNextToken(doWhileSemi); } return rcurly.getLineNo() == lcurly.getLineNo() && rcurly.getLineNo() != nextToken.getLineNo(); }
Source:
public static void waitForContainerWithReleaseId(final KieServicesClient client, final ReleaseId releaseId) throws Exception { waitForCondition(new WaitingCondition() { @Override public boolean conditionPassed() { ServiceResponse<KieContainerResourceList> containersList = client.listContainers(); List<KieContainerResource> containers = containersList.getResult().getContainers(); if (containers != null) { for (KieContainerResource container : containers) { if (container.getReleaseId().equals(releaseId)) { return true; } } } return false; } }); }

Target:
public static void waitForContainerWithReleaseId(final KieServicesClient client, final ReleaseId releaseId) throws Exception { waitForCondition(new WaitingCondition() { @Override public boolean conditionPassed() { ReleaseIdFilter releaseIdFilter = new ReleaseIdFilter(releaseId); KieContainerResourceFilter resourceFilter = new KieContainerResourceFilter(releaseIdFilter); ServiceResponse<KieContainerResourceList> containersList = client.listContainers(resourceFilter); List<KieContainerResource> containers = containersList.getResult().getContainers(); return containers != null && !containers.isEmpty(); } }); }
Source:
JSONObject toJSONObject() { JSONObject json = new JSONObject(); try { json.put(SESSION, session); json.put(NOTIFICATION_IDS, notificationIds); json.put(OUTCOME_ID, name); json.put(TIMESTAMP, timestamp); json.put(WEIGHT, weight); } catch (JSONException exception) { OneSignal.Log(OneSignal.LOG_LEVEL.ERROR, "Generating OutcomeEvent toJSONObject ", exception); } return json; }

Target:
public JSONObject toJSONObject() { JSONObject json = new JSONObject(); try { json.put(SESSION, session); json.put(NOTIFICATION_IDS, notificationIds); json.put(OUTCOME_ID, name); json.put(TIMESTAMP, timestamp); json.put(WEIGHT, weight); } catch (JSONException exception) { OneSignal.Log(OneSignal.LOG_LEVEL.ERROR, "Generating OutcomeEvent toJSONObject ", exception); } return json; }
Source:
private void validateMessageSize(byte[] message) { if (!dropLargeMessage && isLargeMessage(message)) { throw new SamzaException("Logged store message size " + message.length + " for store " + storeName + " was larger than the maximum allowed message size " + maxMessageSize + "."); } }

Target:
private void validateMessageSize(byte[] message) { if (!dropLargeMessages && isLargeMessage(message)) { throw new RecordTooLargeException("The message size " + message.length + " for store " + storeName + " was larger than the maximum allowed message size " + maxMessageSize + "."); } }
Source:
Slf4j(final String name) { this(name, Slf4j.DEFAULT_LEVEL); }

Target:
Slf4j(final String name) { this(name, Level.FINE); }
Source:
private JDBCFieldConverter createConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); if (root == LogicalTypeRoot.SMALLINT) { return new SmallJDBCFieldConverter(); } else { return new DefaultJDBCFieldConverter(); } }

Target:
private JDBCFieldConverter createConverter(LogicalType type) { LogicalTypeRoot root = type.getTypeRoot(); if (root == LogicalTypeRoot.SMALLINT) { return v -> ((Integer) v).shortValue(); } else { return v -> v; } }
Source:
private static void populateSubsystems(TerasologyEngineBuilder builder) { if (isHeadless) { builder.add(new HeadlessGraphics()) .add(new HeadlessTimer()) .add(new HeadlessAudio()) .add(new HeadlessInput()); } else { EngineSubsystem audio = soundEnabled ? new LwjglAudio() : new HeadlessAudio(); builder.add(audio) .add(new LwjglGraphics()) .add(new LwjglTimer()) .add(new LwjglInput()) .add(new BindsSubsystem()) .add(new OpenVRInput()); } builder.add(new HibernationSubsystem()); builder.add(new DiscordRPCSubSystem()); }

Target:
private static void populateSubsystems(TerasologyEngineBuilder builder) { if (isHeadless) { builder.add(new HeadlessGraphics()) .add(new HeadlessTimer()) .add(new HeadlessAudio()) .add(new HeadlessInput()); } else { EngineSubsystem audio = soundEnabled ? new LwjglAudio() : new HeadlessAudio(); builder.add(audio) .add(new LwjglGraphics()) .add(new LwjglTimer()) .add(new LwjglInput()) .add(new BindsSubsystem()) .add(new OpenVRInput()); builder.add(new DiscordRPCSubSystem()); } builder.add(new HibernationSubsystem()); }
Source:
protected abstract void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception; protected final void setRequiredBytes(int exact) { if (exact < 1) { throw new DecoderException( "setRequiredBytes called with invalid value " + exact + ", must be > 0"); } setRequiredBytes(exact, exact); }

Target:
protected abstract void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception; protected final void setRequiredBytes(int exact) { setRequiredBytes(exact, exact); }
Source:
public void onResponse(Map<String, Object> response) { try { final AtomicBoolean processHardwareNeededAtomic = new AtomicBoolean(); VDSReturnValue caps = (VDSReturnValue) response.get("result"); if (caps.getSucceeded()) { vdsManager.getHardwareInfo(vds); } VDSStatus refreshReturnStatus = vdsManager.continueRefreshCapabilities(processHardwareNeededAtomic, vds, oldVds, caps); continueRefreshCapabilities(refreshReturnStatus, processHardwareNeededAtomic); refreshVdsRunTimeInfo(false); } catch (Throwable t) { onFailure(t); } }

Target:
public void onResponse(Map<String, Object> response) { try { final AtomicBoolean processHardwareNeededAtomic = new AtomicBoolean(); VDSReturnValue caps = (VDSReturnValue) response.get("result"); vdsManager.invokeGetHardwareInfo(vds, caps); VDSStatus refreshReturnStatus = vdsManager.processRefreshCapabilitiesResponse(processHardwareNeededAtomic, vds, oldVds, caps); processRefreshCapabilitiesResponse(refreshReturnStatus, processHardwareNeededAtomic); refreshVdsRunTimeInfo(false); } catch (Throwable t) { onFailure(t); } }
Source:
private void setScroller(final ListView listView) { if (mScrollMode == null) { return; } switch (mScrollMode) { case SCROLL_MODE_VEHICLE: { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } else { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } } case SCROLL_MODE_STOP: { if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } else { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } } } } mAdapter.notifyDataSetChanged(); }

Target:
private void setScroller(final ListView listView) { if (mScrollMode == null) { return; } switch (mScrollMode) { case SCROLL_MODE_VEHICLE: { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } else { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } break; } case SCROLL_MODE_STOP: { if (mStopId != null) { mStopIndex = findIndexForStop(mTripInfo.getSchedule().getStopTimes(), mStopId); if (mStopIndex != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(mStopIndex); } }); } } else { final Integer nextStop = mAdapter.getNextStopIndex(); if (nextStop != null) { listView.post(new Runnable() { @Override public void run() { listView.setSelection(nextStop - 1); } }); } } break; } } mAdapter.notifyDataSetChanged(); }
Source:
public boolean accept(TabFolderPart part) { CTabFolder tabFolder = part.getTabFolder(); int itemCount = tabFolder.getItemCount(); if (itemCount > 1) { int selectionIndex = tabFolder.getSelectionIndex(); if (isPrevious) { selectionIndex--; if (selectionIndex < 0) { selectionIndex = itemCount - 1; } } else { selectionIndex++; if (selectionIndex >= itemCount) { selectionIndex = 0; } } if (expectedClass != null && expectedClass.isInstance(part.getPagePart(selectionIndex))) { nextPages.add(part.getPagePart(selectionIndex)); } else if (expectedClass == null) { nextPages.add(part.getPagePart(selectionIndex)); } } return true; }

Target:
public boolean accept(TabFolderPart part) { PagePart activePage = activePageTracker.getActiveEditor(); PagePart visiblePage = part.getVisiblePagePart(); if (activePage == visiblePage) { CTabFolder tabFolder = part.getTabFolder(); int itemCount = tabFolder.getItemCount(); if (itemCount > 1) { int selectionIndex = tabFolder.getSelectionIndex(); if (isPrevious) { selectionIndex--; if (selectionIndex < 0) { selectionIndex = itemCount - 1; } } else { selectionIndex++; if (selectionIndex >= itemCount) { selectionIndex = 0; } } IPage nextPage = part.getPagePart(selectionIndex); if (nextPage != null) { nextPages.add(nextPage); } } } return true; }
Source:
private void startRmAndCheckInitialState() throws Exception { startRmWithConfig(START_CONFIG); Assert.assertTrue("Nodes preservation should be activated on RM start for the test", PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()); assertThat(rmHelper.isRMStarted()).isTrue(); assertThat(resourceManager.getState().getAllNodes().size()).isEqualTo(0); rmHelper.createNodeSource(NODE_SOURCE_NAME, NODE_NUMBER); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState() .getNodeSource(); assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1); assertThat(nodeSourceEventPerNodeSource.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); assertThat(resourceManagerMonitor.getState().getAllNodes().size()).isEqualTo(NODE_NUMBER); }

Target:
private void startRmAndCheckInitialState() throws Exception { startRmWithConfig(START_CONFIG); assertThat(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_EXIT.getValueAsBoolean()).isTrue(); assertThat(rmHelper.isRMStarted()).isTrue(); assertThat(resourceManager.getState().getAllNodes().size()).isEqualTo(0); rmHelper.createNodeSource(NODE_SOURCE_NAME, NODE_NUMBER); RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) resourceManager; ArrayList<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState() .getNodeSource(); assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1); assertThat(nodeSourceEventPerNodeSource.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME); assertThat(resourceManagerMonitor.getState().getAllNodes().size()).isEqualTo(NODE_NUMBER); }
Source:
boolean hasUpdateIntervalElapsedForScmMaterial(Material material) { Long lastMaterialUpdateTime = materialLastUpdateTimeMap.get(material); if (lastMaterialUpdateTime != null) { boolean shouldUpdateMaterial = (DateTimeUtils.currentTimeMillis() - lastMaterialUpdateTime) >= materialUpdateInterval; if (!shouldUpdateMaterial) { LOGGER.info(format("[Material Update] Skipping update of material %s which has been last updated at %s", material, new Date(lastMaterialUpdateTime))); } return shouldUpdateMaterial; } return true; }

Target:
boolean hasUpdateIntervalElapsedForScmMaterial(Material material) { Long lastMaterialUpdateTime = materialLastUpdateTimeMap.get(material); if (lastMaterialUpdateTime != null) { boolean shouldUpdateMaterial = (DateTimeUtils.currentTimeMillis() - lastMaterialUpdateTime) >= materialUpdateInterval; if (LOGGER.isDebugEnabled() && !shouldUpdateMaterial) { LOGGER.debug(format("[Material Update] Skipping update of material %s which has been last updated at %s", material, new Date(lastMaterialUpdateTime))); } return shouldUpdateMaterial; } return true; }