auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BoundedContext build() { if (this.name == null) { this.name = DEFAULT_NAME; } checkNotNull(storageFactory, "storageFactory must be set"); checkNotNull(commandBus, "commandDispatcher must be set"); checkNotNull(eventBus, "eventBus must be set"); commandBus.setIsMultitenant(this.multitenant); final BoundedContext result = new BoundedContext(this); log().info(result.nameForLogging() + " created."); return result; }

Target:
public BoundedContext build() { if (this.name == null) { this.name = DEFAULT_NAME; } checkNotNull(storageFactory, "storageFactory must be set"); checkNotNull(commandBus, "commandDispatcher must be set"); checkNotNull(eventBus, "eventBus must be set"); commandBus.setMultitenant(this.multitenant); final BoundedContext result = new BoundedContext(this); log().info(result.nameForLogging() + " created."); return result; }
Source:
public final boolean has(Class<?> componentType, Direction direction) { return getComponents(direction).has(componentType) | this.has(componentType); }

Target:
public final boolean has(Class<?> componentType, Direction direction) { return getComponents(direction).has(componentType) || this.has(componentType); }
Source:
private PartitionStatistics createPartitionStatistics( ConnectorSession session, Map<String, Type> columnTypes, ComputedStatistics computedStatistics) { Map<ColumnStatisticMetadata, Block> computedColumnStatistics = computedStatistics.getColumnStatistics(); Block rowCountBlock = Optional.ofNullable(computedStatistics.getTableStatistics().get(ROW_COUNT)) .orElseThrow(() -> new IllegalArgumentException("rowCount not present")); verify(!rowCountBlock.isNull(0), "rowCount must never be null"); long rowCount = BIGINT.getLong(rowCountBlock, 0); Map<String, HiveColumnStatistics> columnStatistics = fromComputedStatistics( session, timeZone, computedColumnStatistics, columnTypes, rowCount); HiveBasicStatistics rowCountOnlyBasicStatistics = new HiveBasicStatistics(OptionalLong.empty(), OptionalLong.of(rowCount), OptionalLong.empty(), OptionalLong.empty()); return new PartitionStatistics(rowCountOnlyBasicStatistics, columnStatistics); }

Target:
private PartitionStatistics createPartitionStatistics( ConnectorSession session, Map<String, Type> columnTypes, ComputedStatistics computedStatistics) { Map<ColumnStatisticMetadata, Block> computedColumnStatistics = computedStatistics.getColumnStatistics(); Block rowCountBlock = Optional.ofNullable(computedStatistics.getTableStatistics().get(ROW_COUNT)) .orElseThrow(() -> new VerifyException("rowCount not present")); verify(!rowCountBlock.isNull(0), "rowCount must never be null"); long rowCount = BIGINT.getLong(rowCountBlock, 0); HiveBasicStatistics rowCountOnlyBasicStatistics = new HiveBasicStatistics(OptionalLong.empty(), OptionalLong.of(rowCount), OptionalLong.empty(), OptionalLong.empty()); return createPartitionStatistics(session, rowCountOnlyBasicStatistics, columnTypes, computedColumnStatistics); }
Source:
private MongoDbOutboundGatewaySpec queryOutboundGateway(String query, boolean expectSingleResult) { return MongoDb.outboundGateway(mongoDbFactory()) .query(query) .collectionNameExpression(new LiteralExpression(TEST_COLLECTION)) .expectSingleResult(expectSingleResult) .entityClass(PersonDomain.class); }

Target:
private MongoDbOutboundGatewaySpec queryOutboundGateway(String query, boolean expectSingleResult) { return MongoDb.outboundGateway(mongoDbFactory(), mongoConverter()) .query(query) .collectionNameExpression("headers.collection") .expectSingleResult(expectSingleResult) .entityClass(Person.class); }
Source:
public void afterCompletion(int status) { if (trace) { log.tracef("AfterCompletion(xid=%s, status=%s, remote-caches=%s)", xid, transactionStatusToString(status), preparedCaches); } if (status == Status.STATUS_COMMITTED) { preparedCaches.forEach(this::commitContext); } else { preparedCaches.forEach(this::rollbackContext); } cleanupTask.accept(transaction); }

Target:
public void afterCompletion(int status) { if (trace) { log.tracef("AfterCompletion(xid=%s, status=%s, remote-caches=%s)", xid, transactionStatusToString(status), preparedCaches); } try { if (status == Status.STATUS_COMMITTED) { for (TransactionContext<?,?> ctx : preparedCaches) { commitContext(ctx); } } else { for (TransactionContext<?,?> ctx : preparedCaches) { rollbackContext(ctx); } } } finally { cleanupTask.accept(transaction); } }
Source:
public T cloneData(int sourceIndex, int targetIndex) { if (sourceIndex < 0 || sourceIndex >= scesimData.size()) { throw new IllegalArgumentException(new StringBuilder().append("SourceIndex out of range ").append(sourceIndex).toString()); } if (targetIndex < 0 || targetIndex > scesimData.size()) { throw new IllegalArgumentException(new StringBuilder().append("TargetIndex out of range ").append(targetIndex).toString()); } T scesimDataByIndex = getDataByIndex(sourceIndex); T clonedScesimData = (T) scesimDataByIndex.cloneInstance(); scesimData.add(targetIndex, clonedScesimData); return clonedScesimData; }

Target:
public T cloneData(int sourceIndex, int targetIndex) { if (sourceIndex < 0 || sourceIndex >= scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("SourceIndex out of range ").append(sourceIndex).toString()); } if (targetIndex < 0 || targetIndex > scesimData.size()) { throw new IndexOutOfBoundsException(new StringBuilder().append("TargetIndex out of range ").append(targetIndex).toString()); } T scesimDataByIndex = getDataByIndex(sourceIndex); T clonedScesimData = (T) scesimDataByIndex.cloneInstance(); scesimData.add(targetIndex, clonedScesimData); return clonedScesimData; }
Source:
public String getFileName(String principalName, Object parsedFileContents, String userIdentifier) { String fileName = "cr_stale_" + principalName; if (StringUtils.isNotBlank(userIdentifier)) { fileName += "_" + userIdentifier; } fileName = StringUtils.remove(fileName, " "); return fileName; }

Target:
public String getFileName(String principalName, Object parsedFileContents, String userIdentifier) { String fileName = "cr_stale_" + principalName; if (StringUtils.isNotBlank(userIdentifier)) { fileName += "_" + userIdentifier; } fileName = StringUtils.remove(fileName, KFSConstants.BLANK_SPACE); return fileName; }
Source:
public String getMessageTextPreview() throws MessagingException { if (CryptoHelper.isPgpInlineEncrypted(message) || CryptoHelper.isPgpMimeEncrypted(message) || CryptoHelper.isSMimeEncrypted(message)) { return "*Encrypted*"; } getViewablesIfNecessary(); return MessagePreviewExtractor.extractPreview(context, viewables); }

Target:
public String getMessageTextPreview() throws MessagingException { if (CryptoHelper.isPgpInlineEncrypted(message) || CryptoHelper.isPgpMimeEncrypted(message) || CryptoHelper.isSMimeEncrypted(message)) { return context.getString(R.string.openpgp_message_preview); } getViewablesIfNecessary(); return MessagePreviewExtractor.extractPreview(context, viewables); }
Source:
public void run() { connectionTimeout = config.getConnectionTimeout(); poolElf.setValidationTimeout(config.getValidationTimeout()); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } else { previous = now; } logPoolState("Before cleanup "); final int minIdle = config.getMinimumIdle(); final List<PoolBagEntry> bag = connectionBag.values(STATE_NOT_IN_USE); int totIdle = bag.size(); for (PoolBagEntry bagEntry : bag) { if (connectionBag.reserve(bagEntry)) { if (bagEntry.evicted) { closeConnection(bagEntry, "(connection evicted)"); totIdle --; } else if (totIdle > minIdle && idleTimeout > 0L && clockSource.elapsedMillis(bagEntry.lastAccess, now) > idleTimeout) { closeConnection(bagEntry, "(connection passed idleTimeout)"); totIdle --; } else { connectionBag.unreserve(bagEntry); } } } logPoolState("After cleanup "); fillPool(); }

Target:
public void run() { connectionTimeout = config.getConnectionTimeout(); poolElf.setValidationTimeout(config.getValidationTimeout()); leakTask.updateLeakDetectionThreshold(config.getLeakDetectionThreshold()); final long now = clockSource.currentTime(); final long idleTimeout = config.getIdleTimeout(); if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); previous = now; softEvictConnections(); fillPool(); return; } else { previous = now; } logPoolState("Before cleanup "); final List<PoolBagEntry> bag = connectionBag.values(STATE_NOT_IN_USE); int removable = bag.size() - config.getMinimumIdle(); for (PoolBagEntry bagEntry : bag) { if (connectionBag.reserve(bagEntry)) { if (removable > 0 && idleTimeout > 0L && clockSource.elapsedMillis(bagEntry.lastAccess, now) > idleTimeout) { closeConnection(bagEntry, "(connection passed idleTimeout)"); removable--; } else { connectionBag.unreserve(bagEntry); } } } logPoolState("After cleanup "); fillPool(); }
Source:
private void enterMultiSelect() { FragmentActivity activity = requireActivity(); ((AppCompatActivity) activity).startSupportActionMode(actionModeCallback); ((MediaOverviewActivity) activity).onEnterMultiSelect(); }

Target:
private void enterMultiSelect() { MediaOverviewActivity activity = (MediaOverviewActivity) requireActivity(); activity.startSupportActionMode(actionModeCallback); activity.onEnterMultiSelect(); }
Source:
public void prepareRun(BatchSinkContext context) throws Exception { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); Job job = JobUtils.createInstance(); Thread.currentThread().setContextClassLoader(oldClassLoader); Configuration conf = job.getConfiguration(); HBaseConfiguration.addHbaseResources(conf); context.addOutput(Output.of(config.referenceName, new HBaseOutputFormatProvider(config, conf)) .alias(config.columnFamily)); }

Target:
public void prepareRun(BatchSinkContext context) throws Exception { Job job; ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { job = JobUtils.createInstance(); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); } Configuration conf = job.getConfiguration(); HBaseConfiguration.addHbaseResources(conf); context.addOutput(Output.of(config.referenceName, new HBaseOutputFormatProvider(config, conf)) .alias(config.columnFamily)); }
Source:
public int write(Iterable<StructuredRecord> structuredRecords, DataWriter dataWriter) throws Exception { int numRecordsWritten = 0; String solrFieldName; List<SolrInputDocument> documentList = new ArrayList<SolrInputDocument>(); SolrInputDocument document; config.verifySolrConfiguration(); for (StructuredRecord structuredRecord : structuredRecords) { config.validateKeyField(structuredRecord.getSchema()); config.validateInputFieldsDataType(structuredRecord.getSchema()); if (structuredRecord.get(uniqueKey) == null) { continue; } document = new SolrInputDocument(); for (Schema.Field field : structuredRecord.getSchema().getFields()) { solrFieldName = field.getName(); if (outputFieldMap.containsKey(solrFieldName)) { document.addField(outputFieldMap.get(solrFieldName), structuredRecord.get(solrFieldName)); } else { document.addField(solrFieldName, structuredRecord.get(solrFieldName)); } } documentList.add(document); numRecordsWritten++; } solrClient.add(documentList); solrClient.commit(); return numRecordsWritten; }

Target:
public int write(Iterable<StructuredRecord> structuredRecords, DataWriter dataWriter) throws Exception { int numRecordsWritten = 0; String solrFieldName; List<SolrInputDocument> documentList = new ArrayList<SolrInputDocument>(); SolrInputDocument document; for (StructuredRecord structuredRecord : structuredRecords) { config.validateKeyField(structuredRecord.getSchema()); config.validateInputFieldsDataType(structuredRecord.getSchema()); if (structuredRecord.get(uniqueKey) == null) { continue; } document = new SolrInputDocument(); for (Schema.Field field : structuredRecord.getSchema().getFields()) { solrFieldName = field.getName(); if (outputFieldMap.containsKey(solrFieldName)) { document.addField(outputFieldMap.get(solrFieldName), structuredRecord.get(solrFieldName)); } else { document.addField(solrFieldName, structuredRecord.get(solrFieldName)); } } documentList.add(document); numRecordsWritten++; } solrClient.add(documentList); solrClient.commit(); return numRecordsWritten; }
Source:
protected void executeCommand() { DiskImage diskImage = getImage(); getParameters().setStoragePoolId(diskImage.getStoragePoolId().getValue()); getParameters().setStorageDomainId(diskImage.getStorageIds().get(0)); getParameters().setImageGroupID(diskImage.getId()); lockImage(); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ExtendImageSize, createExtendImageSizeVDSCommandParameters(diskImage)); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(vdsReturnValue.getCreationInfo(), VdcActionType.ExtendImageSize); getReturnValue().getTaskIdList().add(taskId); setSucceeded(true); } }

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.ExtendImageSize, createExtendImageSizeVDSCommandParameters((DiskImage) getImage())); if (vdsReturnValue.getSucceeded()) { VdcActionType actionType = (getParameters().getParentCommand() != null) ? getParameters().getParentCommand() : VdcActionType.ExtendImageSize; getReturnValue().getInternalTaskIdList().add(createTask(vdsReturnValue.getCreationInfo(), actionType)); setSucceeded(true); } else { setSucceeded(false); } }
Source:
private void displayNonLeadSection(int index, boolean savedPage) { activity.updateProgressBar(true, false, PageActivity.PROGRESS_BAR_MAX_VALUE / model.getPage() .getSections().size() * index); if (index >= model.getPage().getSections().size()) { return; } try { final Page page = model.getPage(); JSONObject wrapper = new JSONObject(); wrapper.put("sequence", sequenceNumber.get()); wrapper.put(BRIDGE_PAYLOAD_SAVED_PAGE, savedPage); boolean lastSection = index == page.getSections().size(); if (!lastSection) { JSONObject section = page.getSections().get(index).toJSON(); wrapper.put("section", section); wrapper.put("index", index); if (sectionTargetFromIntent > 0 && sectionTargetFromIntent < page.getSections().size()) { wrapper.put("fragment", page.getSections().get(sectionTargetFromIntent).getAnchor()); } else if (sectionTargetFromTitle != null) { wrapper.put("fragment", sectionTargetFromTitle); } else if (!TextUtils.isEmpty(model.getTitle().getFragment())) { wrapper.put("fragment", model.getTitle().getFragment()); } } else { wrapper.put("noMore", true); } wrapper.put("scrollY", (int) (stagedScrollY / activity.getResources().getDisplayMetrics().density)); bridge.sendMessage("displaySection", wrapper); if (savedPage && lastSection) { fragment.readUrlMappings(); } } catch (JSONException e) { L.logRemoteErrorIfProd(e); } }

Target:
private void displayNonLeadSection(int index, boolean savedPage) { activity.updateProgressBar(true, false, PageActivity.PROGRESS_BAR_MAX_VALUE / model.getPage() .getSections().size() * index); if (index >= model.getPage().getSections().size()) { String errorText = "Section index mismatch!"; errorText += " modelTitle=" + model.getTitleOriginal().getPrefixedText(); errorText += ", pageTitle=" + model.getPage().getTitle().getPrefixedText(); errorText += ", source=" + model.getCurEntry().getSource(); L.logRemoteErrorIfProd(new RuntimeException(errorText)); return; } try { final Page page = model.getPage(); JSONObject wrapper = new JSONObject(); wrapper.put("sequence", sequenceNumber.get()); wrapper.put(BRIDGE_PAYLOAD_SAVED_PAGE, savedPage); boolean lastSection = index == page.getSections().size(); if (!lastSection) { JSONObject section = page.getSections().get(index).toJSON(); wrapper.put("section", section); wrapper.put("index", index); if (sectionTargetFromIntent > 0 && sectionTargetFromIntent < page.getSections().size()) { wrapper.put("fragment", page.getSections().get(sectionTargetFromIntent).getAnchor()); } else if (sectionTargetFromTitle != null) { wrapper.put("fragment", sectionTargetFromTitle); } else if (!TextUtils.isEmpty(model.getTitle().getFragment())) { wrapper.put("fragment", model.getTitle().getFragment()); } } else { wrapper.put("noMore", true); } wrapper.put("scrollY", (int) (stagedScrollY / activity.getResources().getDisplayMetrics().density)); bridge.sendMessage("displaySection", wrapper); if (savedPage && lastSection) { fragment.readUrlMappings(); } } catch (JSONException e) { L.logRemoteErrorIfProd(e); } }
Source:
public void noVariantsNothingShouldBeWritten() throws UnknownHostException { String dbName = "VariantMongoWriterNoVariant"; objectMap.put("db.name", dbName); MongoOperations mongoOperations = MongoDBHelper.getMongoOperationsFromPipelineOptions(objectMap); DBCollection dbCollection = mongoOperations.getCollection(collectionName); variantMongoWriter = new VariantMongoWriter(collectionName, mongoOperations, variantToMongoDbObjectConverter); variantMongoWriter.doWrite(Collections.EMPTY_LIST); assertEquals(0, dbCollection.count()); }

Target:
public void noVariantsNothingShouldBeWritten() throws UnknownHostException { String dbName = "VariantMongoWriterNoVariant"; objectMap.put(JobParametersNames.DB_NAME, dbName); MongoOperations mongoOperations = MongoDBHelper.getMongoOperationsFromPipelineOptions(objectMap); DBCollection dbCollection = mongoOperations.getCollection(collectionName); variantMongoWriter = new VariantMongoWriter(collectionName, mongoOperations, variantToMongoDbObjectConverter); variantMongoWriter.doWrite(Collections.EMPTY_LIST); assertEquals(0, dbCollection.count()); }
Source:
public ArrayInterface setDictionary(int index, Dictionary value) { return setObject(index, value); }

Target:
public Array setDictionary(int index, Dictionary value) { return setObject(index, value); }
Source:
protected void readValue(BlockBuilder blockBuilder, Type type) { if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) { type.writeBoolean(blockBuilder, valuesReader.readBoolean()); } else if (isNullValue()) { blockBuilder.appendNull(); } }

Target:
protected void readValue(BlockBuilder blockBuilder, Type type) { if (definitionLevel == columnDescriptor.getMaxDefinitionLevel()) { type.writeBoolean(blockBuilder, valuesReader.readBoolean()); } else if (isValueNull()) { blockBuilder.appendNull(); } }
Source:
protected void prepareToDeletePreviewBranch() { removedSnapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.PREVIEW); Guid previewedSnapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.REGULAR, SnapshotStatus.IN_PREVIEW); getSnapshotDao().updateStatus(previewedSnapshotId, SnapshotStatus.OK); snapshotsToRemove.add(removedSnapshotId); List<DiskImage> images = getDiskImageDao().getAllSnapshotsForVmSnapshot(removedSnapshotId); for (DiskImage image : images) { if (image.getDiskStorageType() != DiskStorageType.CINDER) { DiskImage parentImage = getDiskImageDao().getSnapshotById(image.getParentId()); Guid snapshotToRemove = (parentImage == null) ? null : parentImage.getVmSnapshotId(); while (parentImage != null && snapshotToRemove != null && !snapshotToRemove.equals(previewedSnapshotId)) { snapshotsToRemove.add(snapshotToRemove); parentImage = getDiskImageDao().getSnapshotById(parentImage.getParentId()); snapshotToRemove = (parentImage == null) ? null : parentImage.getVmSnapshotId(); } } else { snapshotsToRemove.remove(removedSnapshotId); } } List<DiskImage> cinderImagesForPreviewedSnapshot = getDiskImageDao().getAllSnapshotsForVmSnapshot(previewedSnapshotId); for (DiskImage image : cinderImagesForPreviewedSnapshot) { if (image.getDiskStorageType() == DiskStorageType.CINDER) { List<CinderDisk> cinderDisks = CINDERStorageHelper.getRedundantVolumeToDeleteAfterCommitSnapshot(image.getImageId(), image.getId()); for (CinderDisk cinderDisk : cinderDisks) { snapshotsToRemove.add(cinderDisk.getVmSnapshotId()); } } } }

Target:
protected void prepareToDeletePreviewBranch() { removedSnapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.PREVIEW); Guid previewedSnapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.REGULAR, SnapshotStatus.IN_PREVIEW); getSnapshotDao().updateStatus(previewedSnapshotId, SnapshotStatus.OK); snapshotsToRemove.add(removedSnapshotId); List<DiskImage> images = getDiskImageDao().getAllSnapshotsForVmSnapshot(removedSnapshotId); for (DiskImage image : images) { if (image.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage parentImage = getDiskImageDao().getSnapshotById(image.getParentId()); Guid snapshotToRemove = (parentImage == null) ? null : parentImage.getVmSnapshotId(); while (parentImage != null && snapshotToRemove != null && !snapshotToRemove.equals(previewedSnapshotId)) { snapshotsToRemove.add(snapshotToRemove); parentImage = getDiskImageDao().getSnapshotById(parentImage.getParentId()); snapshotToRemove = (parentImage == null) ? null : parentImage.getVmSnapshotId(); } } else if (image.getDiskStorageType() == DiskStorageType.CINDER){ snapshotsToRemove.remove(removedSnapshotId); } } addRedundantCinderSnapshots(previewedSnapshotId); }
Source:
public void getPermissions_returnLoadedResults() { PermissionManager pm = user.getPermissionManager(); looperThread.closeAfterTest(pm); pm.getPermissions(new PermissionManager.Callback<RealmResults<Permission>>() { @Override public void onSuccess(RealmResults<Permission> permissions) { assertTrue(permissions.isLoaded()); if (permissions.size() > 1) { RealmLog.error("Unexpected number of permissions (%s):" + permissions.size()); for (Permission permission : permissions) { RealmLog.error(permission.toString()); } } assertEquals(1, permissions.size()); looperThread.testComplete(); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }

Target:
public void getPermissions_returnLoadedResults() { PermissionManager pm = user.getPermissionManager(); looperThread.closeAfterTest(pm); pm.getPermissions(new PermissionManager.Callback<RealmResults<Permission>>() { @Override public void onSuccess(RealmResults<Permission> permissions) { assertTrue(permissions.isLoaded()); assertInitialPermissions(permissions); looperThread.testComplete(); } @Override public void onError(ObjectServerError error) { fail(error.toString()); } }); }
Source:
@Override protected RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) { Assert.notNull(repoItf, "Repository interface must be set."); Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface."); RepositoryConfig annotation = repoItf.getAnnotation(RepositoryConfig.class); Assert.notNull(annotation, "Set a name of an Apache Ignite cache using @RepositoryConfig annotation to map " + "this repository to the underlying cache."); Assert.hasText(annotation.cacheName(), "Set a name of an Apache Ignite cache using @RepositoryConfig " + "annotation to map this repository to the underlying cache."); String cacheName = null; if (!looksLikeExpression(annotation.cacheName())) { cacheName = annotation.cacheName(); } else { SpelExpressionParser parser = new SpelExpressionParser(); Expression expression = parser.parseExpression(annotation.cacheName()); StandardEvaluationContext ec = new StandardEvaluationContext(); ec.setBeanResolver(new BeanFactoryResolver(ctx.getAutowireCapableBeanFactory())); cacheName = (String)expression.getValue(ec); } repoToCache.put(repoItf, cacheName); repoToCache.put(repoItf, annotation.cacheName()); return super.getRepositoryMetadata(repoItf); }

Target:
@Override protected RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) { Assert.notNull(repoItf, "Repository interface must be set."); Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface."); RepositoryConfig annotation = repoItf.getAnnotation(RepositoryConfig.class); Assert.notNull(annotation, "Set a name of an Apache Ignite cache using @RepositoryConfig annotation to map " + "this repository to the underlying cache."); Assert.hasText(annotation.cacheName(), "Set a name of an Apache Ignite cache using @RepositoryConfig " + "annotation to map this repository to the underlying cache."); String cacheName = evaluateExpression(annotation.cacheName()); repoToCache.put(repoItf, cacheName); return super.getRepositoryMetadata(repoItf); }
Source:
public void addSegments(Iterable<DataSegment> segments) { try { for (DataSegment segment : segments) { log.info("Loading segment %s", segment.getIdentifier()); try { serverManager.loadSegment(segment); } catch (Exception e) { removeSegment(segment); throw new SegmentLoadingException(e, "Exception loading segment[%s]", segment.getIdentifier()); } File segmentInfoCacheFile = new File(config.getSegmentInfoCacheDirectory(), segment.getIdentifier()); if (!segmentInfoCacheFile.exists()) { try { jsonMapper.writeValue(segmentInfoCacheFile, segment); } catch (IOException e) { removeSegment(segment); throw new SegmentLoadingException( e, "Failed to write to disk segment info cache file[%s]", segmentInfoCacheFile ); } } } try { announcer.announceSegments(segments); } catch (IOException e) { removeSegments(segments); throw new SegmentLoadingException(e, "Failed to announce segments[%s]", segments); } } catch (SegmentLoadingException e) { log.makeAlert(e, "Failed to load segments for dataSource") .addData("segments", segments) .emit(); } }

Target:
public void addSegments(Iterable<DataSegment> segments) { try { final List<String> segmentFailures = Lists.newArrayList(); final List<DataSegment> validSegments = Lists.newArrayList(); for (DataSegment segment : segments) { log.info("Loading segment %s", segment.getIdentifier()); try { serverManager.loadSegment(segment); } catch (Exception e) { log.error(e, "Exception loading segment[%s]", segment.getIdentifier()); removeSegment(segment); segmentFailures.add(segment.getIdentifier()); continue; } File segmentInfoCacheFile = new File(config.getSegmentInfoCacheDirectory(), segment.getIdentifier()); if (!segmentInfoCacheFile.exists()) { try { jsonMapper.writeValue(segmentInfoCacheFile, segment); } catch (IOException e) { log.error(e, "Failed to write to disk segment info cache file[%s]", segmentInfoCacheFile); removeSegment(segment); segmentFailures.add(segment.getIdentifier()); continue; } } validSegments.add(segment); } try { announcer.announceSegments(validSegments); } catch (IOException e) { throw new SegmentLoadingException(e, "Failed to announce segments[%s]", segments); } if (!segmentFailures.isEmpty()) { for (String segmentFailure : segmentFailures) { log.error("%s failed to load", segmentFailure); } throw new SegmentLoadingException("%,d errors seen while loading segments", segmentFailures.size()); } } catch (SegmentLoadingException e) { log.makeAlert(e, "Failed to load segments for dataSource") .addData("segments", segments) .emit(); } }
Source:
public BinList getBinsOverlapping(int referenceIndex, int startPos, int endPos) { long refOffset = recordRangleInfo.getReferenceOffsets().get(referenceIndex); long refLength = recordRangleInfo.getReferenceLengths().get(referenceIndex); long refStartPos = startPos - 1; long refEndPos = endPos; if (refEndPos >= refLength) { throw new RuntimeException("refEndPos is larger than reference length"); } int firstBinNumber = (int)refStartPos / SRA_BIN_SIZE; int lastBinNumber = (int)refEndPos / SRA_BIN_SIZE; int numberOfBins = ((int)refLength / SRA_BIN_SIZE) + 1; BitSet binBitSet = new BitSet(); binBitSet.set(0, SRA_BIN_INDEX_OFFSET, false); if (firstBinNumber > 0) { binBitSet.set(SRA_BIN_INDEX_OFFSET, SRA_BIN_INDEX_OFFSET + firstBinNumber, false); } binBitSet.set(SRA_BIN_INDEX_OFFSET + firstBinNumber, SRA_BIN_INDEX_OFFSET + lastBinNumber + 1, true); if (lastBinNumber + 1 < numberOfBins) { binBitSet.set(SRA_BIN_INDEX_OFFSET + lastBinNumber + 1, SRA_BIN_INDEX_OFFSET + numberOfBins, false); } return new BinList(referenceIndex, binBitSet); }

Target:
public BinList getBinsOverlapping(int referenceIndex, int startPos, int endPos) { long refLength = recordRangeInfo.getReferenceLengthsAligned().get(referenceIndex); long refStartPos = startPos - 1; long refEndPos = endPos; if (refEndPos >= refLength) { throw new RuntimeException("refEndPos is larger than reference length"); } int firstBinNumber = (int)refStartPos / SRA_BIN_SIZE; int lastBinNumber = (int)(refEndPos - 1) / SRA_BIN_SIZE; int numberOfBins = ((int)refLength / SRA_BIN_SIZE) + 1; BitSet binBitSet = new BitSet(); binBitSet.set(0, SRA_BIN_INDEX_OFFSET, false); if (firstBinNumber > 0) { binBitSet.set(SRA_BIN_INDEX_OFFSET, SRA_BIN_INDEX_OFFSET + firstBinNumber, false); } binBitSet.set(SRA_BIN_INDEX_OFFSET + firstBinNumber, SRA_BIN_INDEX_OFFSET + lastBinNumber + 1, true); if (lastBinNumber + 1 < numberOfBins) { binBitSet.set(SRA_BIN_INDEX_OFFSET + lastBinNumber + 1, SRA_BIN_INDEX_OFFSET + numberOfBins, false); } return new BinList(referenceIndex, binBitSet); }
Source:
public Map<String, Long> getEventTypesInRange(ITmfTimestamp start, ITmfTimestamp end) { Map<String, Long> map = new HashMap<String, Long>(); long startTimestamp = checkStartTime(start.getValue()); long endTimestamp = checkEndTime(end.getValue()); try { int quark = stats.getQuarkAbsolute(Attributes.EVENT_TYPES); List<Integer> quarks = stats.getSubAttributes(quark, false); List<ITmfStateInterval> startState = stats.queryFullState(startTimestamp); List<ITmfStateInterval> endState = stats.queryFullState(endTimestamp); String curEventName; long countAtStart, countAtEnd, eventCount; for (int typeQuark : quarks) { curEventName = stats.getAttributeName(typeQuark); countAtStart = startState.get(typeQuark).getStateValue().unboxInt(); countAtEnd = endState.get(typeQuark).getStateValue().unboxInt(); if (startTimestamp == stats.getStartTime() || countAtStart == -1) { countAtStart = 0; } if (countAtEnd < 0) { ITmfStateInterval realInterval = stats.querySingleState(endTimestamp - 1, typeQuark); countAtEnd = realInterval.getStateValue().unboxInt() + 1; } if (countAtEnd < 0) { countAtEnd = 0; } eventCount = countAtEnd - countAtStart; map.put(curEventName, eventCount); } } catch (TimeRangeException e) { } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } return map; }

Target:
public Map<String, Long> getEventTypesInRange(ITmfTimestamp start, ITmfTimestamp end) { Map<String, Long> map = new HashMap<String, Long>(); long startTime = checkStartTime(start); long endTime = checkEndTime(end); try { int quark = stats.getQuarkAbsolute(Attributes.EVENT_TYPES); List<Integer> quarks = stats.getSubAttributes(quark, false); List<ITmfStateInterval> startState = stats.queryFullState(startTime); List<ITmfStateInterval> endState = stats.queryFullState(endTime); String curEventName; long countAtStart, countAtEnd, eventCount; for (int typeQuark : quarks) { curEventName = stats.getAttributeName(typeQuark); countAtStart = startState.get(typeQuark).getStateValue().unboxInt(); countAtEnd = endState.get(typeQuark).getStateValue().unboxInt(); if (startTime == stats.getStartTime() || countAtStart == -1) { countAtStart = 0; } if (countAtEnd < 0) { ITmfStateInterval realInterval = stats.querySingleState(endTime - 1, typeQuark); countAtEnd = realInterval.getStateValue().unboxInt() + 1; } if (countAtEnd < 0) { countAtEnd = 0; } eventCount = countAtEnd - countAtStart; map.put(curEventName, eventCount); } } catch (TimeRangeException e) { } catch (AttributeNotFoundException e) { e.printStackTrace(); } catch (StateValueTypeException e) { e.printStackTrace(); } return map; }
Source:
public void addStoredKnowledge(String testID) { logger.info("addStoredKnowledge with testID: " + testID); AddStoredKnowledgeTask task = new AddStoredKnowledgeTask(testID); Future<?> future = taskExecutorService.submit(task); testTasks.put(testID, future); try { future.get(); if (testTaskScheduler.isTerminated(testID)) { return; } boolean hasRegressionModel = explorationModelDAO.hasRegressionModel(testID); TestRunningState nextState = hasRegressionModel ? DETERMINE_EXECUTE_VALIDATION_SET : DETERMINE_EXECUTE_EXPERIMENTS; testModelDAO.setTestRunningState(testID, nextState); testTaskScheduler.handleTestState(testID); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } catch (BenchFlowTestIDDoesNotExistException e) { logger.error("test ID does not exist - should not happen"); } }

Target:
public void addStoredKnowledge(String testID) { logger.info("addStoredKnowledge with testID: " + testID); AddStoredKnowledgeTask task = new AddStoredKnowledgeTask(testID); AbortableFutureTask<?> future = (AbortableFutureTask) taskExecutorService.submit(task); testTasks.put(testID, future); try { if (testTaskScheduler.getAbortableFutureTask(future).isAborted()) { logger.info("Task has been aborted for test: " + testID); return; } boolean hasRegressionModel = explorationModelDAO.hasRegressionModel(testID); TestRunningState nextState = hasRegressionModel ? DETERMINE_EXECUTE_VALIDATION_SET : DETERMINE_EXECUTE_EXPERIMENTS; testModelDAO.setTestRunningState(testID, nextState); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } catch (BenchFlowTestIDDoesNotExistException e) { logger.error("test ID does not exist - should not happen"); } }
Source:
public SourceAppCommand getSourceCommand(AppCommand command, SourceColumn column) { for (SourceAppCommand cmd : sourceAppCommands_) { if (cmd.getCommand() == command && cmd.getColumn() == column.getName()) return cmd; } SourceAppCommand sourceCommand = new SourceAppCommand(command, column.getName(), this); sourceAppCommands_.add(sourceCommand); return sourceCommand; }

Target:
public SourceAppCommand getSourceCommand(AppCommand command, SourceColumn column) { String key = command.getId() + column.getName(); if (sourceAppCommands_.get(key) != null) return sourceAppCommands_.get(key); SourceAppCommand sourceCommand = new SourceAppCommand(command, column.getName(), this); sourceAppCommands_.put(key, sourceCommand); return sourceCommand; }
Source:
protected final void addActiveMemberOfClause(BranchContext context, ExpressionBuilder queryBuilder) { addEclFilter(context, queryBuilder, SnomedComponentSearchRequest.OptionKey.ACTIVE_MEMBER_OF, SnomedComponentDocument.Expressions::referringRefSets); addEclFilter(context, queryBuilder, SnomedComponentSearchRequest.OptionKey.ACTIVE_MEMBER_OF, SnomedComponentDocument.Expressions::referringMappingRefSets); }

Target:
protected final void addActiveMemberOfClause(BranchContext context, ExpressionBuilder queryBuilder) { if (containsKey(OptionKey.ACTIVE_MEMBER_OF)) { final Collection<String> refSetFilters = getCollection(OptionKey.ACTIVE_MEMBER_OF, String.class); final Collection<String> referringRefSetIds = evaluateEclFilter(context, refSetFilters); final Expression expression = Expressions .builder() .should(SnomedComponentDocument.Expressions.referringRefSets(referringRefSetIds)) .should(SnomedComponentDocument.Expressions.referringMappingRefSets(referringRefSetIds)) .build(); queryBuilder.filter(expression); } }
Source:
protected boolean isIPv6(final char firstChar, String s, final boolean checkIPv6, final boolean checkIPv4MappedIPv6) { if (s.length() < 3 || !(isHexCharacter(firstChar) || firstChar == ':') || s.indexOf(':') < 0 || StringUtils.countMatches(s, ':') < 2) { return false; } Matcher matcher = IPV6_PATTERN.matcher(s); if (matcher.matches()) { boolean zeroSubstitution = false; if (s.startsWith("::")) { s = s.substring(2); zeroSubstitution = true; } else if (s.endsWith("::")) { s = s.substring(0, s.length() - 2); zeroSubstitution = true; } if (s.endsWith(":")) { return false; } int count = 0; boolean ipv4Mapped = false; String[] parts = s.split(":"); for (int i = 0; i < parts.length; i++) { final String part = parts[i]; if (part.length() == 0) { if (zeroSubstitution) { return false; } else { zeroSubstitution = true; } continue; } else { count++; } try { int value = Integer.parseInt(part, 16); if (value < 0 || value > 65535) { return false; } } catch (NumberFormatException e) { if (i != parts.length - 1 || !isIPv4(firstChar, part)) { return false; } ipv4Mapped = true; } } if (zeroSubstitution) { if (ipv4Mapped) { return checkIPv4MappedIPv6 && 1 <= count && count <= 6; } else { return checkIPv6 && 1 <= count && count <= 7; } } else { if (ipv4Mapped) { return checkIPv4MappedIPv6 && count == 7; } else { return checkIPv6 && count == 8; } } } else { return false; } }

Target:
protected boolean isIPv6(final char firstChar, String s, final boolean checkIPv6, final boolean checkIPv4MappedIPv6) { if (s.length() < 3 || !(isHexCharacter(firstChar) || firstChar == ':') || StringUtils.countMatches(s, ':') < 2) { return false; } Matcher matcher = IPV6_PATTERN.matcher(s); if (matcher.matches()) { boolean zeroSubstitution = false; if (s.startsWith("::")) { s = s.substring(2); zeroSubstitution = true; } else if (s.endsWith("::")) { s = s.substring(0, s.length() - 2); zeroSubstitution = true; } if (s.endsWith(":")) { return false; } int count = 0; boolean ipv4Mapped = false; String[] parts = s.split(":"); for (int i = 0; i < parts.length; i++) { final String part = parts[i]; if (part.length() == 0) { if (zeroSubstitution) { return false; } else { zeroSubstitution = true; } continue; } else { count++; } try { int value = Integer.parseInt(part, 16); if (value < 0 || value > 65535) { return false; } } catch (NumberFormatException e) { if (i != parts.length - 1 || !isIPv4(firstChar, part)) { return false; } ipv4Mapped = true; } } if (zeroSubstitution) { if (ipv4Mapped) { return checkIPv4MappedIPv6 && 1 <= count && count <= 6; } else { return checkIPv6 && 1 <= count && count <= 7; } } else { if (ipv4Mapped) { return checkIPv4MappedIPv6 && count == 7; } else { return checkIPv6 && count == 8; } } } else { return false; } }
Source:
protected String getRecentItemsUrl() { return String.format("%s/recent_items", getBaseUri()); }

Target:
protected String getRecentItemsUrl() { return String.format("%s/" + ENDPOINT_NAME, getBaseUri()); }
Source:
public SamplerConfig( @JsonProperty("numRows") Integer numRows, @JsonProperty("cacheKey") String cacheKey, @JsonProperty("skipCache") Boolean skipCache, @JsonProperty("timeoutMs") Integer timeoutMs ) { this.numRows = numRows != null ? numRows : DEFAULT_NUM_ROWS; this.cacheKey = cacheKey; this.skipCache = skipCache != null ? skipCache : DEFAULT_SKIP_CACHE; this.timeoutMs = timeoutMs != null ? timeoutMs : DEFAULT_TIMEOUT_MS; }

Target:
public SamplerConfig( @JsonProperty("numRows") Integer numRows, @JsonProperty("cacheKey") String cacheKey, @JsonProperty("skipCache") Boolean skipCache, @JsonProperty("timeoutMs") Integer timeoutMs ) { this.numRows = numRows != null ? numRows : DEFAULT_NUM_ROWS; this.cacheKey = cacheKey; this.skipCache = skipCache != null ? skipCache : DEFAULT_SKIP_CACHE; this.timeoutMs = timeoutMs != null ? timeoutMs : DEFAULT_TIMEOUT_MS; Preconditions.checkArgument(this.numRows <= MAX_NUM_ROWS, "numRows must be <= %s", MAX_NUM_ROWS); }
Source:
private void migrateProperties(SecureStore currentStore, SecureStore newStore) { log.info("Migrate entries"); for (EntryKey key : currentStore.list()) { String[] value = currentStore.getList(key.section, key.subsection, key.name); if (value != null) { newStore.setList(key.section, key.subsection, key.name, Arrays.asList(value)); } else { String msg = String.format("Cannot migrate entry for %s", key.section); if (key.subsection != null) { msg = msg + String.format("[%s]", key.subsection); } msg = msg + String.format(".%s", key.name); throw new RuntimeException(msg); } } }

Target:
private void migrateProperties(SecureStore currentStore, SecureStore newStore) { log.info("Migrate entries"); for (EntryKey key : currentStore.list()) { String[] value = currentStore.getList(key.section, key.subsection, key.name); if (value != null) { newStore.setList(key.section, key.subsection, key.name, Arrays.asList(value)); } else { String msg = String.format("Cannot migrate entry for %s", key.section); if (key.subsection != null) { msg = msg + String.format(".%s", key.subsection); } msg = msg + String.format(".%s", key.name); throw new RuntimeException(msg); } } }
Source:
public UnifyResult apply(UnifyRuleCall call) { final MutableAggregate query = (MutableAggregate) call.query; final MutableAggregate target = (MutableAggregate) call.target; if (!(query.getInput() instanceof MutableProject)) { return null; } final MutableProject project = (MutableProject) query.getInput(); if (project.getInput() != target.getInput()) { return null; } final Mappings.TargetMapping mapping = project.getMapping(); if (mapping == null) { return null; } final MutableAggregate aggregate2 = permute(query, project.getInput(), mapping.inverse()); final MutableRel unifiedAggregate = unifyAggregates(aggregate2, target); if (unifiedAggregate == null) { return null; } MutableRel result = unifiedAggregate; if (!Mappings.keepsOrdering(mapping)) { final List<Integer> posList = new ArrayList<>(); final int fieldCount = aggregate2.rowType.getFieldCount(); for (int group: aggregate2.groupSet) { if (mapping.inverse().getTargetOpt(group) != -1) { posList.add(mapping.inverse().getTarget(group)); } } for (int i = posList.size(); i < fieldCount; i++) { posList.add(i); } result = MutableRels.createProject(unifiedAggregate, posList); } return call.result(result); }

Target:
public UnifyResult apply(UnifyRuleCall call) { final MutableAggregate query = (MutableAggregate) call.query; final MutableAggregate target = (MutableAggregate) call.target; if (!(query.getInput() instanceof MutableProject)) { return null; } final MutableProject project = (MutableProject) query.getInput(); if (project.getInput() != target.getInput()) { return null; } final Mappings.TargetMapping mapping = project.getMapping(); if (mapping == null) { return null; } Mapping inverseMapping = mapping.inverse(); final MutableAggregate aggregate2 = permute(query, project.getInput(), inverseMapping); final MutableRel unifiedAggregate = unifyAggregates(aggregate2, target); if (unifiedAggregate == null) { return null; } MutableRel result = unifiedAggregate; if (!Mappings.keepsOrdering(mapping)) { final List<Integer> posList = new ArrayList<>(); final int fieldCount = aggregate2.rowType.getFieldCount(); for (int group: aggregate2.groupSet) { if (inverseMapping.getTargetOpt(group) != -1) { posList.add(inverseMapping.getTarget(group)); } } for (int i = posList.size(); i < fieldCount; i++) { posList.add(i); } result = MutableRels.createProject(unifiedAggregate, posList); } return call.result(result); }
Source:
public void testClusterSnapshotWithRebalancing() throws Exception { IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, CACHE_KEYS_RANGE); TestRecordingCommunicationSpi commSpi = TestRecordingCommunicationSpi.spi(ignite); commSpi.blockMessages((node, msg) -> msg instanceof GridDhtPartitionSupplyMessage); startGrid(2); ignite.cluster().setBaselineTopology(ignite.cluster().topologyVersion()); commSpi.waitForBlocked(); IgniteFuture<Void> fut = ignite.snapshot().createSnapshot(SNAPSHOT_NAME); commSpi.stopBlock(true); fut.get(); stopAllGrids(); IgniteEx snp = startGridsFromSnapshot(3, SNAPSHOT_NAME); awaitPartitionMapExchange(); assertSnapshotCacheKeys(snp.cache(dfltCacheCfg.getName())); }

Target:
public void testClusterSnapshotWithRebalancing() throws Exception { IgniteEx ignite = startGridsWithCache(2, dfltCacheCfg, CACHE_KEYS_RANGE); TestRecordingCommunicationSpi commSpi = TestRecordingCommunicationSpi.spi(ignite); commSpi.blockMessages((node, msg) -> msg instanceof GridDhtPartitionSupplyMessage); startGrid(2); ignite.cluster().setBaselineTopology(ignite.cluster().topologyVersion()); commSpi.waitForBlocked(); IgniteFuture<Void> fut = ignite.snapshot().createSnapshot(SNAPSHOT_NAME); commSpi.stopBlock(true); fut.get(); stopAllGrids(); IgniteEx snp = startGridsFromSnapshot(3, SNAPSHOT_NAME); awaitPartitionMapExchange(); checkPartitionMapExchangeFinished(); assertSnapshotCacheKeys(snp.cache(dfltCacheCfg.getName())); }
Source:
int compareTo(byte[] other, int otherOffset, int otherLength) { if (value.hasArray()) { return Binary.compareTwoByteArrays(value.array(), value.arrayOffset() + offset, length, other, otherOffset, otherLength); } byte[] bytes = getBytes(); return Binary.compareTwoByteArrays(bytes, 0, bytes.length, other, otherOffset, otherLength); }

Target:
int compareTo(byte[] other, int otherOffset, int otherLength) { if (value.hasArray()) { return Binary.compareTwoByteArrays(value.array(), value.arrayOffset() + offset, length, other, otherOffset, otherLength); } { return Binary.compareByteBufferToByteArray(value, offset, length, other, otherOffset, otherLength); } }
Source:
private PageRef getPageRef(SashWindowsMngr sashWindowsManager, EObject emfPageIdentifier) { EList<PageRef> allPageRef = sashWindowsManager.getSashModel().getCurrentSelection().getChildren(); Iterator<PageRef> iterator = allPageRef.iterator(); PageRef pageRef = null; boolean match = false; while (!match && iterator.hasNext()) { PageRef currentPage = iterator.next(); match = currentPage.getEmfPageIdentifier() != null && emfPageIdentifier.equals(currentPage.getEmfPageIdentifier()); if (match) { pageRef = currentPage; } } return pageRef; }

Target:
private PageRef getPageRef(SashWindowsMngr sashWindowsManager, EObject emfPageIdentifier) { PageRef pageRef = null; boolean match = false; Iterator<Window> windowsIterator = sashWindowsManager.getSashModel().getWindows().iterator(); while (!match && windowsIterator.hasNext()) { Window window = windowsIterator.next(); Iterator<AbstractPanel> panelIterator = window.getChildren().iterator(); while (!match && panelIterator.hasNext()) { pageRef = parseAbstractFolder(panelIterator.next(), emfPageIdentifier); match = pageRef != null; } } return pageRef; }
Source:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); Matcher m = PARSE_PATTERN.matcher(filters); while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); boolean exclude = "exclude".equals(m.group("exclude")); String event = m.group("event"); String recipient = m.group("recipient"); ret.add(FilterEntry.createEntry(event, exclude, recipient)); } return ret; }

Target:
public static List<FilterEntry> parse(String filters) { List<FilterEntry> ret = new LinkedList<>(); Matcher m = PARSE_PATTERN.matcher(filters); while (m.find()) { log.debug(String.format("parse: handling '%s'", m.group(0))); boolean exclude = "exclude".equals(m.group("exclude")); String event = m.group("event"); String recipient = m.group("recipient"); String transport = null; String name = null; if ("*".equals(event)) { event = null; } if (!"*".equals(recipient)) { String s[] = recipient.split(":", 2); if (s.length != 2) { throw new RuntimeException( String.format( "Invalid recipient: '%s'", recipient )); } transport = s[0]; name = s[1]; } ret.add(new FilterEntry(event, exclude,transport, name)); } return Collections.unmodifiableList(ret); }
Source:
private void recomputeScheduleCache() { Map<Object, Integer> nextCache = new HashMap<Object, Integer>(); for (Map.Entry<Object, List<AtomicLong>> entry : callCosts.entrySet()) { Object id = entry.getKey(); if (isServiceUser((String)id)) { nextCache.put(id, 0); continue; } AtomicLong value = entry.getValue().get(0); long snapshot = value.get(); int computedLevel = computePriorityLevel(snapshot); nextCache.put(id, computedLevel); } scheduleCacheRef.set(Collections.unmodifiableMap(nextCache)); }

Target:
private void recomputeScheduleCache() { Map<Object, Integer> nextCache = new HashMap<Object, Integer>(); for (Map.Entry<Object, List<AtomicLong>> entry : callCosts.entrySet()) { Object id = entry.getKey(); AtomicLong value = entry.getValue().get(0); long snapshot = value.get(); int computedLevel = computePriorityLevel(snapshot, id); nextCache.put(id, computedLevel); } scheduleCacheRef.set(Collections.unmodifiableMap(nextCache)); }
Source:
private <T> Optional<T> recast(Optional<?> source) { return (Optional<T>) source; }

Target:
private static <T> Optional<T> recast(Optional<?> source) { return (Optional<T>) source; }