auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Result apply(LimitNode parent, Captures captures, Context context) { JoinNode joinNode = captures.get(CHILD); PlanNode leftSource = joinNode.getLeft(); PlanNode rightSource = joinNode.getRight(); boolean noChange = true; if (isLeftOuter(joinNode.getType()) && !isLimited(leftSource, context.getLookup(), parent.getCount())) { leftSource = new LimitNode(context.getIdAllocator().getNextId(), leftSource, parent.getCount(), false); noChange = false; } if (isRightOuter(joinNode.getType()) && !isLimited(rightSource, context.getLookup(), parent.getCount())) { rightSource = new LimitNode(context.getIdAllocator().getNextId(), rightSource, parent.getCount(), false); noChange = false; } if (noChange) { return Result.empty(); } return Result.ofPlanNode( parent.replaceChildren(ImmutableList.of( joinNode.replaceChildren(ImmutableList.of(leftSource, rightSource))))); }

Target:
public Result apply(LimitNode parent, Captures captures, Context context) { JoinNode joinNode = captures.get(CHILD); PlanNode left = joinNode.getLeft(); PlanNode right = joinNode.getRight(); if (isLeftOuter(joinNode.getType()) && !isLimited(left, context.getLookup(), parent.getCount())) { left = new LimitNode(context.getIdAllocator().getNextId(), left, parent.getCount(), false); } if (isRightOuter(joinNode.getType()) && !isLimited(right, context.getLookup(), parent.getCount())) { right = new LimitNode(context.getIdAllocator().getNextId(), right, parent.getCount(), false); } if (joinNode.getLeft() != left || joinNode.getRight() != right) { return Result.ofPlanNode( parent.replaceChildren(ImmutableList.of( joinNode.replaceChildren(ImmutableList.of(left, right))))); } return Result.empty(); }
Source:
public void onBackPressed() { if (projectListFragment != null) { projectListFragment.cancelLoadProjectTask(); Log.d(TAG, "Back press detected!"); } super.onBackPressed(); }

Target:
public void onBackPressed() { projectListFragment.cancelLoadProjectTask(); super.onBackPressed(); }
Source:
public JobExecutionResult toJobExecutionResult(ClassLoader classLoader) throws JobExecutionException, IOException, ClassNotFoundException { if (applicationStatus == ApplicationStatus.SUCCEEDED) { return new JobExecutionResult( jobId, netRuntime, AccumulatorHelper.deserializeAccumulators( accumulatorResults, classLoader)); } else { final JobExecutionException exception = getJobExecutionException(serializedThrowable, classLoader); throw applicationStatus == ApplicationStatus.CANCELED || applicationStatus == ApplicationStatus.FAILED ? new JobExecutionException(jobId, applicationStatus, "Application Status: " + applicationStatus.name(), exception) : new JobExecutionException(jobId, ApplicationStatus.UNKNOWN, "Job failed for unknown reason.", exception); } }

Target:
public JobExecutionResult toJobExecutionResult(ClassLoader classLoader) throws JobExecutionException, IOException, ClassNotFoundException { if (applicationStatus != ApplicationStatus.SUCCEEDED) { throw getJobExecutionException(serializedThrowable, classLoader); } return new JobExecutionResult(jobId, netRuntime, AccumulatorHelper.deserializeAccumulators(accumulatorResults, classLoader)); }
Source:
public <T> List<T> loadClasses(ILanguageComponent component, Class<T> type) throws MetaborgException { @SuppressWarnings("rawtypes") final Map<Class, ServiceLoader> serviceLoaderCacheLevel2; if(serviceLoaderCache.containsKey(component)) { serviceLoaderCacheLevel2 = serviceLoaderCache.get(component); if(serviceLoaderCacheLevel2.containsKey(type)) { @SuppressWarnings("unchecked") ServiceLoader<T> serviceLoader = (ServiceLoader<T>) serviceLoaderCacheLevel2.get(type); return initializeInjectionFields(serviceLoader.iterator()); } } else { serviceLoaderCacheLevel2 = Maps.newHashMap(); serviceLoaderCache.put(component, serviceLoaderCacheLevel2); } final ClassLoader classLoader = classLoader(component); final ServiceLoader<T> serviceLoader = ServiceLoader.load(type, classLoader); serviceLoaderCacheLevel2.put(type, serviceLoader); return initializeInjectionFields(serviceLoader.iterator()); }

Target:
public <T> List<T> loadClasses(ILanguageComponent component, Class<T> type) throws MetaborgException { final Map<Class<?>, ServiceLoader<?>> serviceLoaderCacheLevel2; if(serviceLoaderCache.containsKey(component)) { serviceLoaderCacheLevel2 = serviceLoaderCache.get(component); if(serviceLoaderCacheLevel2.containsKey(type)) { @SuppressWarnings("unchecked") ServiceLoader<T> serviceLoader = (ServiceLoader<T>) serviceLoaderCacheLevel2.get(type); return initializeInjectionFields(serviceLoader.iterator()); } } else { serviceLoaderCacheLevel2 = Maps.newHashMap(); serviceLoaderCache.put(component, serviceLoaderCacheLevel2); } final ClassLoader classLoader = classLoader(component); final ServiceLoader<T> serviceLoader = ServiceLoader.load(type, classLoader); serviceLoaderCacheLevel2.put(type, serviceLoader); return initializeInjectionFields(serviceLoader.iterator()); }
Source:
public CanvasHighlight invalid(final Iterable<? extends RuleViolation> violations) { violations.forEach(v -> { final String uuid = v.getUUID(); if (null != uuid) { applyStateToShape(uuid, ShapeState.INVALID); } }); getCanvas().draw(); return this; }

Target:
public CanvasHighlight invalid(final Iterable<? extends RuleViolation> violations) { violations.forEach(v -> { final String uuid = v.getUUID(); applyStateToShape(uuid, ShapeState.INVALID); }); getCanvas().draw(); return this; }
Source:
public void testDialogClosed() { ExLangsPreference target = new ExLangsPreference(getActivity(), null, true, sharedPrefs); target.setKey("pref_key_native_tongue"); target.callOnDialogClosed(false); assertNull(sharedPrefs.getString("pref_key_native_tongue", null)); target.callOnDialogClosed(true); assertEquals(sharedPrefs.getString("pref_key_native_tongue", null), LanguageUtils.getDefaultLangCode()); }

Target:
public void testDialogClosed() { ExLangsPreference target = new ExLangsPreference(getActivity(), null, true, sharedPrefs); target.setKey("pref_key_native_tongue"); target.callOnDialogClosed(false); assertNull(target.persistedStringValue); target.setValue("base"); target.callOnDialogClosed(true); assertNotSame("base", target.persistedStringValue); }
Source:
public SegmentLoaderLocalCacheManager( QueryableIndexFactory factory, SegmentLoaderConfig config, @Json ObjectMapper mapper ) { this.factory = factory; this.config = config; this.jsonMapper = mapper; this.locations = Sets.newTreeSet(new Comparator<StorageLocation>() { @Override public int compare(StorageLocation left, StorageLocation right) { return -Longs.compare(left.available(), right.available()); } }); for (StorageLocationConfig locationConfig : config.getLocations()) { locations.add(new StorageLocation(locationConfig.getPath(), locationConfig.getMaxSize())); } }

Target:
public SegmentLoaderLocalCacheManager( QueryableIndexFactory factory, SegmentLoaderConfig config, @Json ObjectMapper mapper ) { this.factory = factory; this.config = config; this.jsonMapper = mapper; this.locations = Sets.newTreeSet(new Comparator<StorageLocation>() { @Override public int compare(StorageLocation left, StorageLocation right) { return Longs.compare(right.available(), left.available()); } }); for (StorageLocationConfig locationConfig : config.getLocations()) { locations.add(new StorageLocation(locationConfig.getPath(), locationConfig.getMaxSize())); } }
Source:
public static <TSource> Enumerable<TSource> except( Enumerable<TSource> source0, Enumerable<TSource> source1, boolean all) { Set<TSource> set = new HashSet<>(); Collection<TSource> resultCollection = all ? HashMultiset.create() : new HashSet<>(); source1.into(set); try (Enumerator<TSource> os = source0.enumerator()) { while (os.moveNext()) { TSource o = os.current(); if (set.contains(o)) { continue; } resultCollection.add(o); } return Linq4j.asEnumerable(resultCollection); } }

Target:
public static <TSource> Enumerable<TSource> except( Enumerable<TSource> source0, Enumerable<TSource> source1, boolean all) { Collection<TSource> collection = all ? HashMultiset.create() : new HashSet<>(); source0.into(collection); try (Enumerator<TSource> os = source1.enumerator()) { while (os.moveNext()) { TSource o = os.current(); collection.remove(o); } return Linq4j.asEnumerable(collection); } }
Source:
void handleDelayedWriteBookieFailure() { int curBlockAddCompletions = blockAddCompletions.get(); if (bk.getDisableEnsembleChangeFeature().isAvailable()) { if (LOG.isDebugEnabled()) { LOG.debug("Ensemble change is disabled. Failed bookies for ledger {}.", delayedWriteFailedBookies, ledgerId); } return; } int curNumEnsembleChanges = numEnsembleChanges.incrementAndGet(); if (curNumEnsembleChanges > maxAllowedEnsembleChanges) { if (LOG.isDebugEnabled()) { LOG.debug("Exceeding maxAllowedEnsembeChanges {}. Failed bookies for ledger {}.", maxAllowedEnsembleChanges, delayedWriteFailedBookies, ledgerId); } return; } if (writeFlags.contains(WriteFlag.DEFERRED_SYNC)) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot perform ensemble changee with writeflags {}." + "Failed bookies for ledger {}.", writeFlags, delayedWriteFailedBookies, ledgerId); } return; } synchronized (metadata) { try { EnsembleInfo ensembleInfo = replaceBookieInMetadata(delayedWriteFailedBookies, curNumEnsembleChanges); if (ensembleInfo.replacedBookies.isEmpty()) { return; } if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : writing new ensemble info = {}", getId(), curNumEnsembleChanges, ensembleInfo); } writeLedgerConfig(new ChangeEnsembleCb(ensembleInfo, curBlockAddCompletions, curNumEnsembleChanges, false)); } catch (BKException.BKNotEnoughBookiesException e) { LOG.error("Could not get additional bookie to remake ensemble: {}", ledgerId); } delayedWriteFailedBookies.clear(); } }

Target:
void handleDelayedWriteBookieFailure() { int curBlockAddCompletions = blockAddCompletions.get(); if (bk.getDisableEnsembleChangeFeature().isAvailable()) { if (LOG.isDebugEnabled()) { LOG.debug("Ensemble change is disabled. Failed bookies for ledger {}.", delayedWriteFailedBookies, ledgerId); } return; } int curNumEnsembleChanges = numEnsembleChanges.incrementAndGet(); if (curNumEnsembleChanges > maxAllowedEnsembleChanges) { if (LOG.isDebugEnabled()) { LOG.debug("Exceeding maxAllowedEnsembeChanges {}. Failed bookies for ledger {}.", maxAllowedEnsembleChanges, delayedWriteFailedBookies, ledgerId); } return; } if (writeFlags.contains(WriteFlag.DEFERRED_SYNC)) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot perform ensemble change with writeflags {}." + "Failed bookies for ledger {}.", writeFlags, delayedWriteFailedBookies, ledgerId); } return; } synchronized (metadata) { try { EnsembleInfo ensembleInfo = replaceBookieInMetadata(delayedWriteFailedBookies, curNumEnsembleChanges); if (ensembleInfo.replacedBookies.isEmpty()) { return; } if (LOG.isDebugEnabled()) { LOG.debug("[EnsembleChange-L{}-{}] : writing new ensemble info = {}", getId(), curNumEnsembleChanges, ensembleInfo); } writeLedgerConfig(new ChangeEnsembleCb(ensembleInfo, curBlockAddCompletions, curNumEnsembleChanges, false)); } catch (BKException.BKNotEnoughBookiesException e) { LOG.error("Could not get additional bookie to remake ensemble: {}", ledgerId); } delayedWriteFailedBookies.clear(); } }
Source:
@Override Bitmap decodeStream(InputStream stream, PicassoBitmapOptions options) throws IOException { if (options != null && options.inJustDecodeBounds) { InputStream is = null; try { BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(options); } return BitmapFactory.decodeStream(stream, null, options); }

Target:
private Bitmap decodeStream(InputStream stream, PicassoBitmapOptions options) throws IOException { if (options != null && options.inJustDecodeBounds) { InputStream is = getInputStream(); try { BitmapFactory.decodeStream(is, null, options); } finally { Utils.closeQuietly(is); } calculateInSampleSize(options); } return BitmapFactory.decodeStream(stream, null, options); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("SpProcedureTask:"); sb.append(" TXN ID: ").append(TxnEgo.txnIdToString(getTxnId())); sb.append(" SP HANDLE ID: ").append(TxnEgo.txnIdToString(getSpHandle())); sb.append(" ON HSID: ").append(CoreUtils.hsIdToString(m_initiator.getHSId())); if (m_initiator instanceof InitiatorMailbox) { InitiatorMailbox imbx = (InitiatorMailbox) m_initiator; sb.append(" TRUNC: ").append(TxnEgo.txnIdToString(imbx.getRepairLog().getTruncationHandle())); sb.append(" FROM: ").append(CoreUtils.hsIdToString(imbx.getRepairLog().getTruncationOrigin())); } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("SpProcedureTask:"); sb.append(" TXN ID: ").append(TxnEgo.txnIdToString(getTxnId())); sb.append(" SP HANDLE ID: ").append(TxnEgo.txnIdToString(getSpHandle())); sb.append(" ON HSID: ").append(CoreUtils.hsIdToString(m_initiator.getHSId())); if (m_txnState != null) { SpTransactionState txnState = (SpTransactionState)m_txnState; if (txnState.m_initiationMsg != null) { sb.append(" TRUNC HANDLE: ").append(TxnEgo.txnIdToString(txnState.m_initiationMsg.getTruncationHandle())); } } if (m_initiator instanceof InitiatorMailbox) { InitiatorMailbox imbx = (InitiatorMailbox) m_initiator; sb.append(" LAST TRUNC: ").append(TxnEgo.txnIdToString(imbx.getRepairLog().getTruncationHandle())); sb.append(" FROM: ").append(CoreUtils.hsIdToString(imbx.getRepairLog().getTruncationOrigin())); } return sb.toString(); }
Source:
public Integer resolve(ITmfEvent event) { @SuppressWarnings("null") @NonNull Integer cpu = Integer.parseInt(fAspect.resolve(event)); return cpu; }

Target:
public Integer resolve(ITmfEvent event) { Integer cpu = Ints.tryParse(fAspect.resolve(event)); if (cpu == null) { return TmfCpuAspect.CPU_UNAVAILABLE; } return cpu; }
Source:
public void process(Exchange exchange) throws Exception { JobParameters jobParameters = prepareJobParameters(exchange.getIn().getHeaders()); String messageJobName = jobParameters.getString(SpringBatchComponent.DYNAMIC_JOBNAME); Job job2run = this.job; if (messageJobName != null) { Job dynamicJob = CamelContextHelper.mandatoryLookup(getEndpoint().getCamelContext(), messageJobName, Job.class); job2run = dynamicJob; if (job2run == null) { exchange.setException(new CamelExchangeException("Found header " + SpringBatchComponent.DYNAMIC_JOBNAME + " with value " +messageJobName + " but could not find a Job in camel context", exchange)); return; } } if (job2run == null) { exchange.setException( new CamelExchangeException("jobName was not specified in the endpoint construction " + " and header "+ SpringBatchComponent.DYNAMIC_JOBNAME + " could not be found", exchange)); return; } JobExecution jobExecution = jobLauncher.run(job2run, jobParameters); exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders()); exchange.getOut().setBody(jobExecution); }

Target:
public void process(Exchange exchange) throws Exception { JobParameters jobParameters = prepareJobParameters(exchange.getIn().getHeaders()); String messageJobName = jobParameters.getString(SpringBatchComponent.JOB_NAME); Job job2run = this.job; if (messageJobName != null) { job2run = CamelContextHelper.mandatoryLookup(getEndpoint().getCamelContext(), messageJobName, Job.class); } if (job2run == null) { exchange.setException(new CamelExchangeException("jobName was not specified in the endpoint construction " + " and header " + SpringBatchComponent.JOB_NAME + " could not be found", exchange)); return; } JobExecution jobExecution = jobLauncher.run(job2run, jobParameters); exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders()); exchange.getOut().setBody(jobExecution); }
Source:
public void update(Guid vdsId, Map<String, Object> values) { int entryCount = values!=null ? values.size() : 0; String[] pluginTypes = new String[entryCount]; String[] bindingIds = new String[entryCount]; if (values!=null) { int i=0; for (Map.Entry<String, Object> pair: values.entrySet()) { pluginTypes[i] = pair.getKey(); bindingIds[i] = (String) pair.getValue(); } } MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vds_id", vdsId) .addValue("plugin_types", createArrayOf("text", pluginTypes)) .addValue("provider_binding_host_ids" , createArrayOf("text", bindingIds)); getCallsHandler().executeModification("UpdateHostProviderBinding", parameterSource); }

Target:
public void update(Guid vdsId, Map<String, Object> values) { int entryCount = values!=null ? values.size() : 0; String[] pluginTypes = new String[entryCount]; String[] bindingIds = new String[entryCount]; if (values!=null) { int i=0; for (Map.Entry<String, Object> pair: values.entrySet()) { pluginTypes[i] = pair.getKey(); bindingIds[i] = (String) pair.getValue(); i++; } } MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vds_id", vdsId) .addValue("plugin_types", createArrayOf("text", pluginTypes)) .addValue("provider_binding_host_ids" , createArrayOf("text", bindingIds)); getCallsHandler().executeModification("UpdateHostProviderBinding", parameterSource); }
Source:
default short readShort() throws IOException { final byte[] buf = new byte[2]; final int read = read(buf, 0, 2); if (read < 2) throw new EOFException(); return Bytes.toShort(buf, isLittleEndian()); }

Target:
default short readShort() throws IOException { final byte[] buf = conversionBuffer(); final int read = read(buf, 0, 2); if (read < 2) throw new EOFException(); return Bytes.toShort(buf, isLittleEndian()); }
Source:
private static void writeFsLayout(Path rootDir, Configuration conf) throws IOException { LOG.info("BOOTSTRAP: creating hbase:meta region"); FileSystem fs = rootDir.getFileSystem(conf); Path tableDir = CommonFSUtils.getTableDir(rootDir, TableName.META_TABLE_NAME); if (fs.exists(tableDir)) { LOG.info("Meta table directory exists, continue..."); } FSTableDescriptors.tryUpdateMetaTableDescriptor(conf, fs, rootDir, builder -> builder.setRegionReplication( conf.getInt(HConstants.META_REPLICAS_NUM, HConstants.DEFAULT_META_REPLICA_NUM))); TableDescriptor metaDescriptor = new FSTableDescriptors(conf).get(TableName.META_TABLE_NAME); HRegion .createHRegion(RegionInfoBuilder.FIRST_META_REGIONINFO, rootDir, conf, metaDescriptor, null) .close(); }

Target:
private static void writeFsLayout(Path rootDir, Configuration conf) throws IOException { LOG.info("BOOTSTRAP: creating hbase:meta region"); FileSystem fs = rootDir.getFileSystem(conf); Path tableDir = CommonFSUtils.getTableDir(rootDir, TableName.META_TABLE_NAME); boolean removeMeta = conf.getBoolean(HConstants.REMOVE_META_ON_RESTART, HConstants.DEFAULT_REMOVE_META_ON_RESTART); if (removeMeta && fs.exists(tableDir) && !fs.delete(tableDir, true)) { LOG.warn("Can not delete partial created meta table, continue..."); } FSTableDescriptors.tryUpdateMetaTableDescriptor(conf, fs, rootDir, builder -> builder.setRegionReplication( conf.getInt(HConstants.META_REPLICAS_NUM, HConstants.DEFAULT_META_REPLICA_NUM))); TableDescriptor metaDescriptor = new FSTableDescriptors(conf).get(TableName.META_TABLE_NAME); HRegion .createHRegion(RegionInfoBuilder.FIRST_META_REGIONINFO, rootDir, conf, metaDescriptor, null) .close(); }
Source:
public void mergeResolutionCompleted(Comparison comparison) { EList<MatchResource> matchResources = comparison.getMatchedResources(); final List<IResource> resources = new LinkedList<IResource>(); for (MatchResource matchResource : matchResources) { URI matchUri = matchResource.getLeft().getURI(); Set<URI> dependencyUris = dependencies.of(matchUri, matchResource.getLeft().getResourceSet() .getURIConverter()); for (URI uri : dependencyUris) { IResource resource = getResourceFromURI(uri); resources.add(resource); } } Display.getDefault().asyncExec(new Runnable() { public void run() { promptUser(resources.toArray(new IResource[0])); } }); }

Target:
public void mergeResolutionCompleted(Comparison comparison) { EList<MatchResource> matchResources = comparison.getMatchedResources(); final List<IResource> resources = new LinkedList<IResource>(); for (MatchResource matchResource : matchResources) { URI matchUri = matchResource.getLeft().getURI(); Set<URI> dependencyUris = dependencies.of(matchUri, matchResource.getLeft().getResourceSet() .getURIConverter()); for (URI uri : dependencyUris) { IResource resource = getResourceFromURI(uri); resources.add(resource); } } Display.getDefault().asyncExec(new Runnable() { public void run() { promptUser(resources.toArray(new IResource[resources.size()])); } }); }
Source:
public static AdColonyAdSize adColonyAdSizeFromAdMobAdSize(Context context, AdSize adSize) { ArrayList<AdSize> potentials = new ArrayList<>(3); potentials.add(0, AdSize.BANNER); potentials.add(1, AdSize.LEADERBOARD); potentials.add(2, AdSize.MEDIUM_RECTANGLE); potentials.add(3, AdSize.WIDE_SKYSCRAPER); AdSize closestSize = AdColonyAdapterUtils.findClosestSize(context, adSize, potentials); if (AdSize.BANNER.equals(closestSize)) { return AdColonyAdSize.BANNER; } else if (AdSize.MEDIUM_RECTANGLE.equals(closestSize)) { return AdColonyAdSize.MEDIUM_RECTANGLE; } else if (AdSize.LEADERBOARD.equals(closestSize)) { return AdColonyAdSize.LEADERBOARD; } else if (AdSize.WIDE_SKYSCRAPER.equals(closestSize)) { return AdColonyAdSize.SKYSCRAPER; } else { return new AdColonyAdSize(adSize.getWidth(),adSize.getHeight()); } }

Target:
public static AdColonyAdSize adColonyAdSizeFromAdMobAdSize(Context context, AdSize adSize) { ArrayList<AdSize> potentials = new ArrayList<>(3); potentials.add(0, AdSize.BANNER); potentials.add(1, AdSize.LEADERBOARD); potentials.add(2, AdSize.MEDIUM_RECTANGLE); potentials.add(3, AdSize.WIDE_SKYSCRAPER); AdSize closestSize = AdColonyAdapterUtils.findClosestSize(context, adSize, potentials); if (AdSize.BANNER.equals(closestSize)) { return AdColonyAdSize.BANNER; } else if (AdSize.MEDIUM_RECTANGLE.equals(closestSize)) { return AdColonyAdSize.MEDIUM_RECTANGLE; } else if (AdSize.LEADERBOARD.equals(closestSize)) { return AdColonyAdSize.LEADERBOARD; } else if (AdSize.WIDE_SKYSCRAPER.equals(closestSize)) { return AdColonyAdSize.SKYSCRAPER; } else { return null; } }
Source:
public Collection<com.datatorrent.api.Partitioner.Partition<AbstractJdbcPollInputOperator<T>>> definePartitions( Collection<Partition<AbstractJdbcPollInputOperator<T>>> partitions, PartitioningContext context) { List<Partition<AbstractJdbcPollInputOperator<T>>> newPartitions = new ArrayList<Partition<AbstractJdbcPollInputOperator<T>>>( getPartitionCount()); HashMap<Integer, KeyValPair<Integer, Integer>> partitionToRangeMap = null; try { store.connect(); intializeDSLContext(); partitionToRangeMap = getPartitionedQueryRangeMap(getPartitionCount()); } catch (SQLException e) { LOG.error("Exception in initializing the partition range", e); throw new RuntimeException(e); } finally { store.disconnect(); } KryoCloneUtils<AbstractJdbcPollInputOperator<T>> cloneUtils = KryoCloneUtils.createCloneUtils(this); for (int i = 0; i <= getPartitionCount(); i++) { AbstractJdbcPollInputOperator<T> jdbcPoller = cloneUtils.getClone(); if (i < getPartitionCount()) { jdbcPoller.rangeQueryPair = partitionToRangeMap.get(i); jdbcPoller.lastEmittedRecord = partitionToRangeMap.get(i).getKey(); } else { int partitionKey = partitionToRangeMap.get(i - 1).getValue(); jdbcPoller.rangeQueryPair = new KeyValPair<Integer, Integer>(partitionKey, null); jdbcPoller.lastEmittedRecord = partitionKey; jdbcPoller.isPollerPartition = true; } newPartitions.add(new DefaultPartition<AbstractJdbcPollInputOperator<T>>(jdbcPoller)); } return newPartitions; }

Target:
public Collection<com.datatorrent.api.Partitioner.Partition<AbstractJdbcPollInputOperator<T>>> definePartitions( Collection<Partition<AbstractJdbcPollInputOperator<T>>> partitions, PartitioningContext context) { List<Partition<AbstractJdbcPollInputOperator<T>>> newPartitions = new ArrayList<Partition<AbstractJdbcPollInputOperator<T>>>( getPartitionCount()); HashMap<Integer, KeyValPair<Integer, Integer>> partitionToRangeMap = null; try { store.connect(); intializeDSLContext(); partitionToRangeMap = getPartitionedQueryRangeMap(getPartitionCount()); } catch (SQLException e) { LOG.error("Exception in initializing the partition range", e); throw new RuntimeException(e); } finally { store.disconnect(); } KryoCloneUtils<AbstractJdbcPollInputOperator<T>> cloneUtils = KryoCloneUtils.createCloneUtils(this); for (int i = 0; i <= getPartitionCount(); i++) { AbstractJdbcPollInputOperator<T> jdbcPoller = cloneUtils.getClone(); if (i < getPartitionCount()) { jdbcPoller.rangeQueryPair = partitionToRangeMap.get(i); jdbcPoller.lastEmittedRow = partitionToRangeMap.get(i).getKey(); jdbcPoller.isPollerPartition = false; } else { int partitionKey = partitionToRangeMap.get(i - 1).getValue(); jdbcPoller.rangeQueryPair = new KeyValPair<Integer, Integer>(partitionKey, null); jdbcPoller.lastEmittedRow = partitionKey; jdbcPoller.isPollerPartition = true; } newPartitions.add(new DefaultPartition<AbstractJdbcPollInputOperator<T>>(jdbcPoller)); } return newPartitions; }
Source:
int adjustValue(long value, int offsetIndex) { if (inDictionaryStream != null) { if (!inDictionaryFlags[offsetIndex]) { value += stripeDictionarySize; } } return toIntExact(value); }

Target:
private int adjustValue(long value, int offsetIndex) { if (inDictionaryStream != null && !inDictionaryFlags[offsetIndex]) { return toIntExact(value + stripeDictionarySize); } return toIntExact(value); }
Source:
public void testStoreAndLoadWithRolloutTrigger() throws InterruptedException { String srvStateInXML = client.configMaps().inNamespace(testNamespace) .withName(TEST_KIE_SERVER_ID).get().getData().get(KieServerStateCloudRepository.CFG_MAP_DATA_KEY); KieServerState kieServerState = (KieServerState) xs.fromXML(srvStateInXML); repo.store(TEST_KIE_SERVER_ID, kieServerState); assertNotNull(client.configMaps().inNamespace(testNamespace) .withName(TEST_KIE_SERVER_ID) .get() .getMetadata() .getAnnotations() .containsKey(KieServerStateCloudRepository.ROLLOUT_REQUIRED)); }

Target:
public void testStoreAndLoadWithRolloutTrigger() throws InterruptedException { String srvStateInXML = client.configMaps().inNamespace(testNamespace) .withName(TEST_KIE_SERVER_ID).get().getData().get(KieServerStateCloudRepository.CFG_MAP_DATA_KEY); KieServerState kieServerState = (KieServerState) xs.fromXML(srvStateInXML); repo.store(TEST_KIE_SERVER_ID, kieServerState); assertTrue(client.configMaps().inNamespace(testNamespace) .withName(TEST_KIE_SERVER_ID) .get() .getMetadata() .getAnnotations() .containsKey(KieServerStateCloudRepository.ROLLOUT_REQUIRED)); }
Source:
public void findCollections() throws Exception { getClient().perform(get("/api/config/submissiondefinitions/traditional/collections")) .andExpect(status().isForbidden()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissiondefinitions/traditional/collections")) .andExpect(status().isNoContent()); }

Target:
public void findCollections() throws Exception { getClient().perform(get("/api/config/submissiondefinitions/traditional/collections")) .andExpect(status().isUnauthorized()); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/config/submissiondefinitions/traditional/collections")) .andExpect(status().isNoContent()); }
Source:
private boolean validateArgumentTypes(JsonToken tokenType, String expectedType) { if (expectedType != null && expectedType.equalsIgnoreCase(tokenType.toString())) { return true; } else if (tokenType == JsonToken.NULL) { return true; } else if (tokenType == JsonToken.NUMBER) { if (expectedType != null && (expectedType.equals("int") || expectedType.equals("long") || expectedType.equals("double") || expectedType.equals("float") || expectedType.equals("decimal") || expectedType.equals("byte") || expectedType.equals("short"))) { return true; } } else if (tokenType == JsonToken.STRING) { if (expectedType != null && (expectedType.equals("string") || expectedType.equals("date") || expectedType.equals("time") || expectedType.equals("datetime") || expectedType.equals("base64Binary"))) { return true; } } return false; }

Target:
private boolean validateArgumentTypes(JsonToken tokenType, String expectedType) { if (expectedType != null && expectedType.equalsIgnoreCase(tokenType.toString())) { return true; } else if (tokenType == JsonToken.NULL) { return true; } else if (tokenType == JsonToken.NUMBER) { if ("int".equals(expectedType) || "long".equals(expectedType) || "double".equals(expectedType) || "float".equals(expectedType) || "decimal".equals(expectedType) || "byte".equals(expectedType) || "short".equals(expectedType)) { return true; } } else if (tokenType == JsonToken.STRING) { if ("string".equals(expectedType) || "date".equals(expectedType) || "time".equals(expectedType) || "datetime".equals(expectedType) || "base64Binary".equals(expectedType)) { return true; } } return false; }
Source:
public void afterTaskCompletedEvent(TaskEvent event) { Task task = event.getTask(); long processInstanceId = task.getTaskData().getProcessInstanceId(); if (processInstanceId <= 0) { return; } RuntimeManager manager = getManager(task); if (manager == null) { throw new RuntimeException("No RuntimeManager registered with identifier: " + task.getTaskData().getDeploymentId()); } RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); KieSession session = runtime.getKieSession(); if (session != null) { logger.debug(">> I've recieved an event for a known session (" + task.getTaskData().getProcessSessionId()+")"); processTaskState(task); } else { logger.error("EE: I've recieved an event but the session is not known by this handler ( "+task.getTaskData().getProcessSessionId()+")"); } processTaskState(task); }

Target:
public void afterTaskCompletedEvent(TaskEvent event) { Task task = event.getTask(); long processInstanceId = task.getTaskData().getProcessInstanceId(); if (processInstanceId <= 0) { return; } RuntimeManager manager = getManager(task); if (manager == null) { throw new RuntimeException("No RuntimeManager registered with identifier: " + task.getTaskData().getDeploymentId()); } RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId)); KieSession session = runtime.getKieSession(); if (session != null) { logger.debug(">> I've recieved an event for a known session (" + task.getTaskData().getProcessSessionId()+")"); processTaskState(task); } else { logger.error("EE: I've recieved an event but the session is not known by this handler ( "+task.getTaskData().getProcessSessionId()+")"); } }
Source:
protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { return new ArrayList<>(); }

Target:
protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { return Collections.EMPTY_LIST; }
Source:
protected void init() throws IOException { _selector = Selector.open(); Task task = null; try { _clientConnection = SocketChannel.open(); s_logger.info("Connecting to " + _host + ":" + _port); final InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); _clientConnection.connect(peerAddr); _clientConnection.configureBlocking(false); final SSLContext sslContext = Link.initSSLContext(true); SSLEngine sslEngine = sslContext.createSSLEngine(_host, _port); sslEngine.setUseClientMode(true); sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols())); sslEngine.beginHandshake(); if (!Link.doHandshake(_clientConnection, sslEngine)) { s_logger.error("SSL Handshake failed!"); _selector.close(); throw new IOException("SSL Handshake failed!"); } s_logger.info("SSL: Handshake done"); s_logger.info("Connected to " + _host + ":" + _port); final Link link = new Link(peerAddr, this); link.setSSLEngine(sslEngine); final SelectionKey key = _clientConnection.register(_selector, SelectionKey.OP_READ); link.setKey(key); key.attach(link); task = _factory.create(Task.Type.CONNECT, link, null); } catch (final GeneralSecurityException e) { _selector.close(); throw new IOException("Failed to initialise security", e); } catch (final IOException e) { _selector.close(); throw e; } _executor.submit(task); }

Target:
protected void init() throws IOException { _selector = Selector.open(); Task task = null; try { _clientConnection = SocketChannel.open(); s_logger.info("Connecting to " + _host + ":" + _port); final InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); _clientConnection.connect(peerAddr); _clientConnection.configureBlocking(false); final SSLContext sslContext = Link.initSSLContext(true); SSLEngine sslEngine = sslContext.createSSLEngine(_host, _port); sslEngine.setUseClientMode(true); sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols())); sslEngine.beginHandshake(); if (!Link.doHandshake(_clientConnection, sslEngine, true)) { s_logger.error("SSL Handshake failed while connecting to host: " + _host + " port: " + _port); _selector.close(); throw new IOException("SSL Handshake failed while connecting to host: " + _host + " port: " + _port); } s_logger.info("SSL: Handshake done"); s_logger.info("Connected to " + _host + ":" + _port); final Link link = new Link(peerAddr, this); link.setSSLEngine(sslEngine); final SelectionKey key = _clientConnection.register(_selector, SelectionKey.OP_READ); link.setKey(key); key.attach(link); task = _factory.create(Task.Type.CONNECT, link, null); } catch (final GeneralSecurityException e) { _selector.close(); throw new IOException("Failed to initialise security", e); } catch (final IOException e) { _selector.close(); throw e; } _executor.submit(task); }
Source:
private void queueWork(int maximumMessageCount, Duration maxWaitTime, FluxSink<ServiceBusReceivedMessageContext> emitter) { if (continuesMessageSubscriber.get() != null && continuesMessageSubscriber.get().isDisposed()) { logger.error("[{}]: Can not receive messaged because client is closed.", asyncClient.getEntityPath()); return; } if (continuesMessageSubscriber.get() == null) { ContinuesMessageSubscriber messageSubscriber = asyncClient.receive(DEFAULT_RECEIVE_OPTIONS) .subscribeWith(new ContinuesMessageSubscriber(maximumMessageCount, emitter)); if (!continuesMessageSubscriber.compareAndSet(null, messageSubscriber)) { messageSubscriber.dispose(); } logger.info("[{}]: Started ContinuesMessageSubscriber message subscriber for entity.", asyncClient.getEntityPath()); } else { continuesMessageSubscriber.get().request(maximumMessageCount, emitter); } }

Target:
private void queueWork(int maximumMessageCount, Duration maxWaitTime, FluxSink<ServiceBusReceivedMessageContext> emitter) { synchronized (lock) { final long id = idGenerator.getAndIncrement(); EmitterProcessor<ServiceBusReceivedMessageContext> emitterProcessor = messageProcessor.get(); final SynchronousReceiveWork work = new SynchronousReceiveWork(id, maximumMessageCount, maxWaitTime, emitter); final SynchronousMessageSubscriber syncSubscriber = new SynchronousMessageSubscriber(work); logger.info("[{}]: Started synchronous message subscriber.", id); if (emitterProcessor == null) { emitterProcessor = this.asyncClient.receive(DEFAULT_RECEIVE_OPTIONS) .subscribeWith(EmitterProcessor.create(asyncClient.getReceiverOptions().getPrefetchCount(), false)); messageProcessor.set(emitterProcessor); } emitterProcessor.subscribe(syncSubscriber); } }
Source:
public synchronized void add(PrestoWarning warning) { requireNonNull(warning, "warning is null"); if (size < config.getMaxWarnings() && (warningCodeCounts.containsKey(warning.getWarningCode().getCode()) ? warningCodeCounts.size() <= config.getMaxDistinctWarningCodes() : warningCodeCounts.size() < config.getMaxDistinctWarningCodes())) { int warningCodeCount = warningCodeCounts.getOrDefault(warning.getWarningCode().getCode(), 0); if (warningCodeCount < config.getMaxWarningsPerWarningCode()) { warnings.add(warning); warningCodeCounts.put(warning.getWarningCode().getCode(), ++warningCodeCount); size++; } } }

Target:
public synchronized void add(PrestoWarning warning) { requireNonNull(warning, "warning is null"); if (warnings.size() < config.getMaxWarnings()) { warnings.putIfAbsent(warning.getWarningCode(), warning); } }
Source:
public static Clan fromDto(com.faforever.client.api.dto.Clan dto) { Clan clan = new Clan(); clan.setId(Integer.parseInt(dto.getId())); clan.setName(dto.getName()); clan.setDescription(dto.getDescription()); clan.setFounder(Player.fromDto(dto.getFounder())); clan.setLeader(Player.fromDto(dto.getLeader())); clan.setCreateTime(dto.getCreateTime().toInstant()); clan.setTag(dto.getTag()); clan.setTagColor(dto.getTagColor()); clan.setWebsiteUrl(dto.getWebsiteUrl()); clan.membersProperty().setAll(dto.getMemberships().stream() .map(membership -> Player.fromDto(membership.getPlayer())) .collect(Collectors.toList())); return clan; }

Target:
public static Clan fromDto(com.faforever.client.api.dto.Clan dto) { Clan clan = new Clan(); clan.setId(dto.getId()); clan.setName(dto.getName()); clan.setDescription(dto.getDescription()); clan.setFounder(Player.fromDto(dto.getFounder())); clan.setLeader(Player.fromDto(dto.getLeader())); clan.setCreateTime(dto.getCreateTime().toInstant()); clan.setTag(dto.getTag()); clan.setTagColor(dto.getTagColor()); clan.setWebsiteUrl(dto.getWebsiteUrl()); clan.membersProperty().setAll(dto.getMemberships().stream() .map(membership -> Player.fromDto(membership.getPlayer())) .collect(Collectors.toList())); return clan; }
Source:
public ScheduledFuture scheduleTask() { return scheduler.scheduleWithFixedDelay(() -> { try { LOG.info("Checking for job model version upgrade"); String blobJMV = blob.getJobModelVersion(); LOG.info("Blob JMV: {}", blobJMV); String blobBarrierState = blob.getBarrierState(); String currentJMV = currentJMVersion.get(); LOG.info("currentJMV: {}", currentJMV); String expectedBarrierState = BarrierState.START.toString() + " " + blobJMV; List<String> processorList = blob.getLiveProcessorList(); if (processorList != null && processorList.contains(processorId) && !currentJMV.equals(blobJMV) && blobBarrierState.equals(expectedBarrierState) && !versionUpgradeDetected.get()) { listener.onStateChange(); } } catch (Exception e) { errorHandler.accept("Exception in Job Model Version Upgrade Scheduler. Stopping the processor..."); } }, JMV_UPGRADE_DELAY_SEC, JMV_UPGRADE_DELAY_SEC, TimeUnit.SECONDS); }

Target:
public ScheduledFuture scheduleTask() { return scheduler.scheduleWithFixedDelay(() -> { try { LOG.info("Checking for job model version upgrade"); String blobJMV = blob.getJobModelVersion(); LOG.info("Job Model Version seen on the blob: {}", blobJMV); String blobBarrierState = blob.getBarrierState(); String currentJMV = currentJMVersion.get(); LOG.info("Current Job Model Version that the job coordinator is working on: {}", currentJMV); String expectedBarrierState = BarrierState.START.toString() + " " + blobJMV; List<String> processorList = blob.getLiveProcessorList(); if (processorList != null && processorList.contains(processorId) && !currentJMV.equals(blobJMV) && blobBarrierState.equals(expectedBarrierState) && !versionUpgradeDetected.get()) { listener.onStateChange(); } } catch (Exception e) { errorHandler.accept("Exception in Job Model Version Upgrade Scheduler. Stopping the processor..."); } }, JMV_UPGRADE_DELAY_SEC, JMV_UPGRADE_DELAY_SEC, TimeUnit.SECONDS); }
Source:
public synchronized void onConfigurationChange(Configuration newConf) { initReconfigurable(newConf); if (scheduler instanceof ConfigurationObserver) { ((ConfigurationObserver)scheduler).onConfigurationChange(newConf); } System.setProperty("hadoop.policy.file", "hbase-policy.xml"); this.authManager.refresh(newConf, new HBasePolicyProvider()); LOG.info("Refreshed hbase-policy.xml successfully"); ProxyUsers.refreshSuperUserGroupsConfiguration(newConf); LOG.info("Refreshed super and proxy users successfully"); }

Target:
public void onConfigurationChange(Configuration newConf) { initReconfigurable(newConf); if (scheduler instanceof ConfigurationObserver) { ((ConfigurationObserver)scheduler).onConfigurationChange(newConf); } if (authorize) { refreshAuthManager(newConf, new HBasePolicyProvider()); } }
Source:
public void testCourseStartingDateBeforeExpiry() { final String expectedOutput = "Starting December 5"; final String expiry = "2018-12-30T00:00:00+05:00"; final String start = "2018-12-05T00:00:00+05:00"; final String end = "2019-12-01T00:00:00+05:00"; final String output = CourseCardUtils.getFormattedDate(context, today, expiry, start, end, StartType.TIMESTAMP, null); assertEquals(expectedOutput, output); }

Target:
public void testCourseStartingDateBeforeExpiry() { final String expectedOutput = "Starting December 5"; final String expiry = "2018-12-30T00:00:00+05:00"; final String start = "2018-12-05T00:00:00+05:00"; final String output = CourseCardUtils.getFormattedDate(context, today, expiry, start, end, StartType.TIMESTAMP, null); assertEquals(expectedOutput, output); }
Source:
public Long getMinLockedInVersionId(String client) { log.warn("Client attempted to getMinLockedInVersionId() on a non-transactional lock service!" + " If you are using async timelock, this suggests that one of your AtlasDB clients still" + " expects synchronous lock (i.e. is on a version of AtlasDB prior to 0.49.0). Please check" + " that all AtlasDB clients are using AtlasDB >= 0.49.0." + " This check may be disabled by explicitly setting 'useAsyncSafetyCheck' to false in" + " your timelock server configuration, but note that this may cause *DATA CORRUPTION* if" + " performing a rolling upgrade of an AtlasDB client to >= 0.49.0.", UnsafeArg.of("client", client)); throw new BadRequestException("getMinLockedInVersionId() not supported on non-transactional lock" + " service. Please consult the server logs for more detail."); }

Target:
public Long getMinLockedInVersionId(String client) { log.warn("Client attempted to getMinLockedInVersionId() on a non-transactional lock service!" + " If you are using async timelock, this suggests that one of your AtlasDB clients still" + " expects synchronous lock (i.e. is on a version of AtlasDB prior to 0.49.0). Please check" + " that all AtlasDB clients are using AtlasDB >= 0.49.0.", UnsafeArg.of("client", client)); throw new BadRequestException("getMinLockedInVersionId() not supported on non-transactional lock" + " service. Please consult the server logs for more detail."); }
Source:
public Matrix4d[] getNcsOperators(boolean orthonormalBasis) { if(orthonormalBasis) { return ncsOperators; } if(ncsOperators==null || ncsOperators.length == 0) { return null; } Matrix4d[] ncsOperatorsCrystal = new Matrix4d[ncsOperators.length]; for(int i=0;i<ncsOperators.length;i++) { ncsOperatorsCrystal[i] = cell.transfToCrystal(ncsOperators[i]); } return ncsOperatorsCrystal; }

Target:
public Matrix4d[] getNcsOperators(boolean orthonormalBasis) { if(orthonormalBasis) { return ncsOperators; } if(ncsOperators==null || ncsOperators.length == 0) { return null; } if(cell==null) { throw new IllegalArgumentException("Cannot transform to the crystal basis if there is no cell."); } Matrix4d[] ncsOperatorsCrystal = new Matrix4d[ncsOperators.length]; for(int i=0;i<ncsOperators.length;i++) { ncsOperatorsCrystal[i] = cell.transfToCrystal(ncsOperators[i]); } return ncsOperatorsCrystal; }
Source:
public String getTournament(Model model, HttpSession session) { Member member = (Member) session.getAttribute("member"); MemberDao memberDao = new MemberDao(); member = memberDao.getMemberById(member.getId()); if (member == null || member.getContext() != UserType.ADMIN) { System.out.println("shouldn't be here"); System.out.println(member.getContext()); return "redirect:/denied"; } Set<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); return "admin"; }

Target:
public String getTournament(Model model, HttpSession session) { Member member = (Member) session.getAttribute("member"); MemberDao memberDao = new MemberDao(); member = memberDao.getMemberById(member.getId()); if (member == null || member.getContext() != UserType.ADMIN) { return "redirect:/denied"; } Set<Team> teams = member.getTeams(); model.addAttribute("teams", teams); TournamentDao tournamentDao = new TournamentDao(); List<Tournament> tournaments = tournamentDao.getLastXTournaments(5); model.addAttribute("tournaments", tournaments); return "admin"; }
Source:
protected FilterNode rewrite(Context context, FilterNode node, BiMap<DereferenceExpression, VariableReferenceExpression> expressions) { PlanNode source = node.getSource(); ImmutableMap<VariableReferenceExpression, RowExpression> dereferencesMap = expressions.inverse().entrySet().stream().collect(toImmutableMap(Map.Entry::getKey, entry -> castToRowExpression(entry.getValue()))); Assignments assignments = Assignments.builder().putAll(identityAssignmentsAsSymbolReferences(source.getOutputVariables())).putAll(dereferencesMap).build(); ProjectNode projectNode = new ProjectNode(context.getIdAllocator().getNextId(), source, assignments); RowExpression filter = castToRowExpression(ExpressionTreeRewriter.rewriteWith(new DereferenceReplacer(expressions), castToExpression(node.getPredicate()))); return new FilterNode( context.getIdAllocator().getNextId(), projectNode, filter); }

Target:
protected FilterNode rewrite(Context context, FilterNode node, BiMap<DereferenceExpression, VariableReferenceExpression> expressions) { PlanNode source = node.getSource(); Map<VariableReferenceExpression, RowExpression> dereferencesMap = expressions.inverse().entrySet().stream() .collect(toImmutableMap(Map.Entry::getKey, entry -> castToRowExpression(entry.getValue()))); Assignments assignments = Assignments.builder() .putAll(identityAssignmentsAsSymbolReferences(source.getOutputVariables())) .putAll(dereferencesMap) .build(); ProjectNode projectNode = new ProjectNode(context.getIdAllocator().getNextId(), source, assignments); return new FilterNode( context.getIdAllocator().getNextId(), projectNode, replaceDereferences(node.getPredicate(), expressions)); }
Source:
private Map<ByteArray, PersistableNetworkPayload> getMapForDataResponse(String requestersVersion) { Map<ByteArray, PersistableNetworkPayload> map = new HashMap<>(); appendOnlyDataStoreService.getServices() .forEach(service -> { Map<ByteArray, PersistableNetworkPayload> serviceMap; if (service instanceof HistoricalDataStoreService) { var historicalDataStoreService = (HistoricalDataStoreService<? extends PersistableNetworkPayloadStore>) service; serviceMap = historicalDataStoreService.getMapSinceVersion(requestersVersion); map.putAll(serviceMap); } else { serviceMap = service.getMap(); map.putAll(serviceMap); } log.info("We added entries from to be filtered by excluded keys", serviceMap.size(), service.getClass().getSimpleName()); }); return map; }

Target:
private Map<ByteArray, PersistableNetworkPayload> getMapForDataResponse(String requestersVersion) { Map<ByteArray, PersistableNetworkPayload> map = new HashMap<>(); appendOnlyDataStoreService.getServices() .forEach(service -> { Map<ByteArray, PersistableNetworkPayload> serviceMap; if (service instanceof HistoricalDataStoreService) { var historicalDataStoreService = (HistoricalDataStoreService<? extends PersistableNetworkPayloadStore>) service; serviceMap = historicalDataStoreService.getMapSinceVersion(requestersVersion); } else { serviceMap = service.getMap(); } map.putAll(serviceMap); log.info("We added entries from to be filtered by excluded keys", serviceMap.size(), service.getClass().getSimpleName()); }); return map; }