auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testGetNodes() { final DMNGraphProcessor processor = new DMNGraphProcessor(); final Graph graph = mock(Graph.class); final Decision decision1 = mock(Decision.class); final Decision decision2 = mock(Decision.class); final Node node1 = createNode(decision1, "id1"); final Node node2 = createNode(decision2, "id2"); final List<Node> graphNodes = createGraphNodes(node1, node2); when(graph.nodes()).thenReturn(graphNodes); final Iterable<? extends Node> nodes = processor.getNodes(graph); for (final Node r : nodes) { assertTrue(graphNodes.contains(r)); assertFalse(processor.isReplacedByAnotherNode(r.getUUID())); } }

Target:
public void testGetNodes() { final DMNGraphProcessor processor = new DMNGraphProcessor(); final Graph graph = mock(Graph.class); final Decision decision1 = mock(Decision.class); final Decision decision2 = mock(Decision.class); final Node node1 = createNode(decision1, "id1"); final Node node2 = createNode(decision2, "id2"); final List<Node> graphNodes = createGraphNodes(node1, node2); when(graph.nodes()).thenReturn(graphNodes); final Iterable<? extends Node> nodes = processor.getNodes(graph); for (final Node node : nodes) { assertTrue(graphNodes.contains(node)); assertFalse(processor.isReplacedByAnotherNode(node.getUUID())); } }
Source:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); helper.validate(); String sinkClass = helper.getOptions().get(TABLE_SINK_CLASS); boolean isInsertOnly = helper.getOptions().get(SINK_INSERT_ONLY); String runtimeSink = helper.getOptions().get(RUNTIME_SINK); int expectedNum = helper.getOptions().get(SINK_EXPECTED_MESSAGES_NUM); Integer parallelism = helper.getOptions().get(SINK_PARALLELISM); final Map<String, DataType> writableMetadata = convertToMetadataMap( helper.getOptions().get(WRITABLE_METADATA), context.getClassLoader()); ChangelogMode changelogMode = Optional.ofNullable(helper.getOptions().get(SINK_CHANGELOG_MODE_ENFORCED)).map(m -> parseChangelogMode(m)).orElse(null); final DataType consumedType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); final int[] primaryKeyIndices = TableSchemaUtils.getPrimaryKeyIndices(context.getCatalogTable().getSchema()); if (sinkClass.equals("DEFAULT")) { return new TestValuesTableSink( consumedType, primaryKeyIndices, context.getObjectIdentifier().getObjectName(), isInsertOnly, runtimeSink, expectedNum, writableMetadata, parallelism, changelogMode); } else { try { return InstantiationUtil.instantiate( sinkClass, DynamicTableSink.class, Thread.currentThread().getContextClassLoader()); } catch (FlinkException e) { throw new TableException("Can't instantiate class " + sinkClass, e); } } }

Target:
public DynamicTableSink createDynamicTableSink(Context context) { FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); helper.validate(); String sinkClass = helper.getOptions().get(TABLE_SINK_CLASS); boolean isInsertOnly = helper.getOptions().get(SINK_INSERT_ONLY); String runtimeSink = helper.getOptions().get(RUNTIME_SINK); int expectedNum = helper.getOptions().get(SINK_EXPECTED_MESSAGES_NUM); Integer parallelism = helper.getOptions().get(SINK_PARALLELISM); final Map<String, DataType> writableMetadata = convertToMetadataMap( helper.getOptions().get(WRITABLE_METADATA), context.getClassLoader()); final ChangelogMode changelogMode = Optional.ofNullable(helper.getOptions() .get(SINK_CHANGELOG_MODE_ENFORCED)).map(m -> parseChangelogMode(m)).orElse(null); final DataType consumedType = context.getCatalogTable().getSchema().toPhysicalRowDataType(); final int[] primaryKeyIndices = TableSchemaUtils.getPrimaryKeyIndices(context.getCatalogTable().getSchema()); if (sinkClass.equals("DEFAULT")) { return new TestValuesTableSink( consumedType, primaryKeyIndices, context.getObjectIdentifier().getObjectName(), isInsertOnly, runtimeSink, expectedNum, writableMetadata, parallelism, changelogMode); } else { try { return InstantiationUtil.instantiate( sinkClass, DynamicTableSink.class, Thread.currentThread().getContextClassLoader()); } catch (FlinkException e) { throw new TableException("Can't instantiate class " + sinkClass, e); } } }
Source:
public Single<List<PodcastSearchResult>> loadToplist(String country, int limit) { return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) emitter -> { OkHttpClient client = AntennapodHttpClient.getHttpClient(); String feedString; try { feedString = getTopListFeed(client, country, limit); } catch (IOException e) { feedString = getTopListFeed(client, "US", limit); } List<PodcastSearchResult> podcasts = parseFeed(feedString); emitter.onSuccess(podcasts); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); }

Target:
public Single<List<PodcastSearchResult>> loadToplist(String country, int limit) { return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) emitter -> { OkHttpClient client = AntennapodHttpClient.getHttpClient(); String feedString; String loadCountry = country; if (COUNTRY_CODE_UNSET.equals(country)) { loadCountry = Locale.getDefault().getCountry(); } try { feedString = getTopListFeed(client, loadCountry, limit); } catch (IOException e) { if (COUNTRY_CODE_UNSET.equals(country)) { feedString = getTopListFeed(client, "US", limit); } else { emitter.onError(e); return; } } List<PodcastSearchResult> podcasts = parseFeed(feedString); emitter.onSuccess(podcasts); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); }
Source:
public void registerAttributes(ManagementResourceRegistration registry) { for (AttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { registry.registerReadWriteAttribute(attr, null, new ReloadRequiredWriteAttributeHandler(ATTRIBUTES)); } } ClusterConnectionControlHandler.INSTANCE.registerAttributes(registry); for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, ClusterConnectionControlHandler.INSTANCE); } }

Target:
public void registerAttributes(ManagementResourceRegistration registry) { ReloadRequiredWriteAttributeHandler reloadRequiredWriteAttributeHandler = new ReloadRequiredWriteAttributeHandler(ATTRIBUTES); for (AttributeDefinition attr : ATTRIBUTES) { if (!attr.getFlags().contains(AttributeAccess.Flag.STORAGE_RUNTIME)) { registry.registerReadWriteAttribute(attr, null, reloadRequiredWriteAttributeHandler); } } ClusterConnectionControlHandler.INSTANCE.registerAttributes(registry); for (AttributeDefinition attr : READONLY_ATTRIBUTES) { registry.registerReadOnlyAttribute(attr, ClusterConnectionControlHandler.INSTANCE); } }
Source:
public TopNNode map(TopNNode node, PlanNode source, PlanNodeId newNodeId) { ImmutableList.Builder<Symbol> symbols = ImmutableList.builder(); ImmutableMap.Builder<Symbol, SortOrder> orderings = ImmutableMap.builder(); Set<Symbol> seenCanonicals = new HashSet<>(node.getOrderBy().size()); for (Symbol symbol : node.getOrderBy()) { Symbol canonical = map(symbol); if (seenCanonicals.contains(canonical)) { continue; } else { seenCanonicals.add(canonical); symbols.add(canonical); orderings.put(canonical, node.getOrderings().get(symbol)); } } return new TopNNode( newNodeId, source, node.getCount(), symbols.build(), orderings.build(), node.getStep()); }

Target:
public TopNNode map(TopNNode node, PlanNode source, PlanNodeId newNodeId) { ImmutableList.Builder<Symbol> symbols = ImmutableList.builder(); ImmutableMap.Builder<Symbol, SortOrder> orderings = ImmutableMap.builder(); Set<Symbol> seenCanonicals = new HashSet<>(node.getOrderBy().size()); for (Symbol symbol : node.getOrderBy()) { Symbol canonical = map(symbol); if (seenCanonicals.add(canonical)) { seenCanonicals.add(canonical); symbols.add(canonical); orderings.put(canonical, node.getOrderings().get(symbol)); } } return new TopNNode( newNodeId, source, node.getCount(), symbols.build(), orderings.build(), node.getStep()); }
Source:
public Indirect<T[]> convertIndirect(String instructions) { if ((instructions == null) || instructions.isEmpty()) { return new ArrayIndirect(ArrayUtilities.buildEmpty(getIndirectClass())); } Class<Indirect<T>> managedClass = getIndirectClass(); Indirect<T>[] array = null; if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; String[] groups = splitInstructions(instructions, groupSep); for (String group : groups) { Indirect<T>[] converted = dfm.convertViaDispatch(fm -> new Derived(fm), group); array = ArrayUtilities.mergeArray(managedClass, array, converted); } } else { array = convertInternal(componentManager::convertIndirect, instructions, managedClass); } return buildIndirect(array); }

Target:
public Indirect<T[]> convertIndirect(String instructions) { if ((instructions == null) || instructions.isEmpty()) { return new ArrayIndirect(ArrayUtilities.buildEmpty(getIndirectClass())); } Class<Indirect<T>> managedClass = getIndirectClass(); Indirect<T>[] array = null; if (componentManager instanceof DispatchingFormatManager) { @SuppressWarnings("unchecked") DispatchingFormatManager<T> dfm = (DispatchingFormatManager<T>) componentManager; String[] groups = splitInstructions(instructions, groupSeparator); for (String group : groups) { Indirect<T>[] converted = dfm.convertViaDispatch(fm -> new Derived(fm), group); array = ArrayUtilities.mergeArray(managedClass, array, converted); } } else { array = convertInternal(componentManager::convertIndirect, instructions, managedClass); } return buildIndirect(array); }
Source:
public ReadWriteKeyCommand(K key, Function<ReadWriteEntryView<K, V>, R> f, CommandInvocationId id, ValueMatcher valueMatcher, Params params, ComponentRegistry componentRegistry) { super(key, valueMatcher, id, params); this.f = f; if(f instanceof CommandFunction) componentRegistry.wireDependencies(((CommandFunction)f).getRemappingFunction()); }

Target:
public ReadWriteKeyCommand(K key, Function<ReadWriteEntryView<K, V>, R> f, CommandInvocationId id, ValueMatcher valueMatcher, Params params, ComponentRegistry componentRegistry) { super(key, valueMatcher, id, params); this.f = f; this.init(componentRegistry); }
Source:
public Object process(Object proxy, Method method, Object[] args) throws Throwable { CdiQueryInvocationContext queryContext = null; EntityManagerRef entityManagerRef = null; try { List<Class<?>> candidates = ProxyUtils.getProxyAndBaseTypes(proxy.getClass()); RepositoryComponent repo = components.lookupComponent(candidates); RepositoryMethod repoMethod = components.lookupMethod(repo, method); entityManagerRef = entityManagerRefLookup.lookupReference(repo); queryContext = createContext(proxy, method, args, entityManagerRef.getEntityManager(), repoMethod); QueryBuilder builder = queryBuilderFactory.build(repoMethod, queryContext); Object result = runner.executeQuery(builder, queryContext); return result; } catch (PersistenceException e) { throw e; } catch (Exception e) { log.log(Level.FINEST, "Query execution error", e); throw new QueryInvocationException(e, proxy.getClass(), method); } finally { if (entityManagerRef != null) { entityManagerRef.release(); } context.dispose(); } }

Target:
public Object process(Object proxy, Method method, Object[] args) throws Throwable { CdiQueryInvocationContext queryContext = null; EntityManagerRef entityManagerRef = null; try { List<Class<?>> candidates = ProxyUtils.getProxyAndBaseTypes(proxy.getClass()); RepositoryComponent repo = components.lookupComponent(candidates); RepositoryMethod repoMethod = components.lookupMethod(repo, method); entityManagerRef = entityManagerRefLookup.lookupReference(repo); queryContext = createContext(proxy, method, args, entityManagerRef.getEntityManager(), repoMethod); QueryBuilder builder = queryBuilderFactory.build(repoMethod, queryContext); Object result = runner.executeQuery(builder, queryContext); return result; } catch (PersistenceException e) { throw e; } catch (Exception e) { log.log(Level.FINEST, "Query execution error", e); if (queryContext != null) { throw new QueryInvocationException(e, queryContext); } throw new QueryInvocationException(e, proxy.getClass(), method); } finally { if (entityManagerRef != null) { entityManagerRef.release(); } context.dispose(); } }
Source:
public DBRecord(StructuredRecord record, int columnTypes) { this.record = record; this.columnTypes = columnTypes; this.bytesWritten = 0; }

Target:
public DBRecord(StructuredRecord record, int columnTypes) { this.record = record; this.columnTypes = columnTypes; }
Source:
public void testWritingNewSchedule() throws Exception { Interval interval = new Interval( getDateTime(3, 21, 16, 0), getDateTime(3, 21, 17, 0) ); Item item = new Item(Id.valueOf(1), Publisher.METABROADCAST); Broadcast broadcast = new Broadcast(channel, interval).withId("sid"); item.addBroadcast(broadcast); contentStore.writeContent(item); ScheduleRef scheduleRef = ScheduleRef.forChannel(channel.getId(), interval) .addEntry(item.getId(), broadcast.toRef()) .build(); updateSchedule(scheduleRef); EquivalentSchedule resolved = get(equivalentScheduleStore .resolveSchedules( ImmutableList.of(channel), interval, Publisher.METABROADCAST, ImmutableSet.of(Publisher.METABROADCAST) )); EquivalentChannelSchedule schedule = Iterables.getOnlyElement(resolved.channelSchedules()); Equivalent<Item> broadcastItems = Iterables.getOnlyElement(schedule.getEntries()) .getItems(); assertThat(Iterables.getOnlyElement(broadcastItems.getResources()), is(item)); }

Target:
public void testWritingNewSchedule() throws Exception { Interval interval = new Interval( makeDateTime(3, 21, 16, 0), makeDateTime(3, 21, 17, 0) ); Item item = new Item(Id.valueOf(1), Publisher.METABROADCAST); Broadcast broadcast = new Broadcast(channel, interval).withId("sid"); item.addBroadcast(broadcast); contentStore.writeContent(item); ScheduleRef scheduleRef = ScheduleRef.forChannel(channel.getId(), interval) .addEntry(item.getId(), broadcast.toRef()) .build(); updateSchedule(scheduleRef); EquivalentSchedule resolved = get(equivalentScheduleStore .resolveSchedules( ImmutableList.of(channel), interval, Publisher.METABROADCAST, ImmutableSet.of(Publisher.METABROADCAST) )); EquivalentChannelSchedule schedule = Iterables.getOnlyElement(resolved.channelSchedules()); Equivalent<Item> broadcastItems = Iterables.getOnlyElement(schedule.getEntries()) .getItems(); assertThat(Iterables.getOnlyElement(broadcastItems.getResources()), is(item)); }
Source:
public static void setUp() throws Exception { Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") <= 0); LOG.info("HBase minicluster: Starting"); TEST_UTIL.startMiniCluster(1); TEST_UTIL.getConfiguration().setInt("hbase.master.info.port", -1); TEST_UTIL.getConfiguration().set("hbase.zookeeper.quorum", "localhost:" + TEST_UTIL.getZkCluster().getClientPort()); conf = initialize(TEST_UTIL.getConfiguration()); LOG.info("HBase minicluster: Running"); }

Target:
public static void setUp() throws Exception { Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0); LOG.info("HBase minicluster: Starting"); TEST_UTIL.startMiniCluster(1); TEST_UTIL.getConfiguration().setInt("hbase.master.info.port", -1); TEST_UTIL.getConfiguration().set("hbase.zookeeper.quorum", "localhost:" + TEST_UTIL.getZkCluster().getClientPort()); conf = initialize(TEST_UTIL.getConfiguration()); LOG.info("HBase minicluster: Running"); }
Source:
protected void processTuple(Object tuple) { if(keyMethod == null && keyField != "") { pojoClass = tuple.getClass(); try { keyMethod = generateGetterForKeyField(); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + keyField + " is invalid: " + e); } } KeyedMessage msg; if(keyMethod != null) { msg = new KeyedMessage(getTopic(), keyMethod.get(tuple), tuple); } else { msg = new KeyedMessage(getTopic(), tuple, tuple); } if (isBatchProcessing) { if (messageList.size() == batchSize) { getProducer().send(messageList); messageList.clear(); } messageList.add(msg); } else { getProducer().send(msg); } messageCount++; if(tuple instanceof byte[]) { byteCount += ((byte[])tuple).length; } }

Target:
protected void processTuple(Object tuple) { if (keyMethod == null && keyField != "") { pojoClass = tuple.getClass(); try { keyMethod = generateGetterForKeyField(); } catch (NoSuchFieldException e) { throw new RuntimeException("Field " + keyField + " is invalid: " + e); } } KeyedMessage msg; if (keyMethod != null) { msg = new KeyedMessage(getTopic(), keyMethod.get(tuple), tuple); } else { msg = new KeyedMessage(getTopic(), tuple, tuple); } getProducer().send(msg); messageCount++; if (tuple instanceof byte[]) { byteCount += ((byte[])tuple).length; } }
Source:
public synchronized Set<PublicKeyHash> getOwnedKeys() { return ownedKeys; }

Target:
public synchronized Set<PublicKeyHash> getOwnedKeys() { return Collections.unmodifiableSet(ownedKeys); }
Source:
void runInIoThread(Runnable task) { this.taskRunQueue.add(task); try { getIoThread().execute(new Runnable() { @Override public void run() { while (!taskRunQueue.isEmpty()) { taskRunQueue.poll().run(); } } }); } catch (RejectedExecutionException e) { UndertowLogger.REQUEST_IO_LOGGER.warnf("Server is shutting down, task %s will not be executed", task); } }

Target:
void runInIoThread(Runnable task) { this.taskRunQueue.add(task); try { getIoThread().execute(taskRunQueueRunnable); } catch (RejectedExecutionException e) { Thread thread = new Thread(taskRunQueueRunnable); thread.setName(String.format("%s AbstractFramedChannel task queue", getWorker().getName()); thread.start(); } }
Source:
public static void cleanup() { if (context != null) { RabbitAdmin admin = context.getBean(RabbitAdmin.class); String deployerQueue = context.getEnvironment().resolvePlaceholders(XD_DEPLOYER_PLACEHOLDER); String undeployerExchange = context.getEnvironment().resolvePlaceholders(XD_UNDEPLOYER_PLACEHOLDER); admin.deleteQueue(deployerQueue); admin.deleteExchange(undeployerExchange); if (!queues.isEmpty()) { for (String queue : queues) { admin.deleteQueue(queue); } } if (!topics.isEmpty()) { for (String exchange : topics) { admin.deleteExchange(exchange); } } } }

Target:
public static void cleanup() { if (context != null) { RabbitAdmin admin = context.getBean(RabbitAdmin.class); String deployerQueue = context.getEnvironment().resolvePlaceholders(XD_DEPLOYER_PLACEHOLDER); String undeployerExchange = context.getEnvironment().resolvePlaceholders(XD_UNDEPLOYER_PLACEHOLDER); admin.deleteQueue(deployerQueue); admin.deleteExchange(undeployerExchange); } }
Source:
public List<DataTableRow>aroundReplacementDataTableStatementName(ProceedingJoinPoint pjp) throws Throwable { List<DataTableRow> dataTableOld = (List<DataTableRow>) pjp.proceed(); if(dataTableOld != null){ for(int i= 0; i < dataTableOld.size(); i++){ List<String> row = dataTableOld.get(i).getCells(); for(int x = 0; x < row.size(); x++){ String value = row.get(x); String newValue = replaceReflectionPlaceholders(value); dataTableOld.get(i).getCells().set(x, newValue); } } } return dataTableOld; }

Target:
public List<DataTableRow>aroundReplacementDataTableStatementName(ProceedingJoinPoint pjp) throws Throwable { List<DataTableRow> dataTableOld = (List<DataTableRow>) pjp.proceed(); if(dataTableOld != null){ for(int i= 0; i < dataTableOld.size(); i++){ List<String> row = dataTableOld.get(i).getCells(); for(int x = 0; x < row.size(); x++){ String value = row.get(x); if (value.contains("${")) { value = replaceEnvironmentPlaceholders(value); } if (value.contains("!{")) { value = replaceReflectionPlaceholders(value); } if (value.contains("@{")) { value = replaceCodePlaceholders(value); } dataTableOld.get(i).getCells().set(x, value); } } } return dataTableOld; }
Source:
public VirtualColumns getVirtualColumns(final ExprMacroTable macroTable, final boolean includeDimensions) { final List<VirtualColumn> retVal = new ArrayList<>(); if (selectProjection != null) { retVal.addAll(selectProjection.getVirtualColumns()); } else { if (sortProject != null) { for (Aggregation aggregation : sortProject.getPostAggregators()) { retVal.addAll(aggregation.getVirtualColumns()); } } if (grouping != null) { if (includeDimensions) { for (DimensionExpression dimensionExpression : grouping.getDimensions()) { retVal.addAll(dimensionExpression.getVirtualColumns(macroTable)); } } for (Aggregation aggregation : grouping.getAggregations()) { retVal.addAll(aggregation.getVirtualColumns()); } } } return VirtualColumns.create(retVal); }

Target:
public VirtualColumns getVirtualColumns(final ExprMacroTable macroTable, final boolean includeDimensions) { final List<VirtualColumn> retVal = new ArrayList<>(); if (selectProjection != null) { retVal.addAll(selectProjection.getVirtualColumns()); } else { if (grouping != null) { if (includeDimensions) { for (DimensionExpression dimensionExpression : grouping.getDimensions()) { retVal.addAll(dimensionExpression.getVirtualColumns(macroTable)); } } for (Aggregation aggregation : grouping.getAggregations()) { retVal.addAll(aggregation.getVirtualColumns()); } } } return VirtualColumns.create(retVal); }
Source:
public void jenkinsSecretHidden() throws Exception { SemaphoreStep.waitForStart("pod/1", b); List<SlaveComputer> kc = Arrays.stream(r.jenkins.getComputers()) .filter(SlaveComputer.class::isInstance) .map(SlaveComputer.class::cast) .collect(Collectors.toList()); assertThat(kc, hasSize(1)); SlaveComputer slaveComputer = kc.get(0); String jnlpMac = slaveComputer.getJnlpMac(); SemaphoreStep.success("pod/1", b); r.assertBuildStatusSuccess(r.waitForCompletion(b)); r.assertLogNotContains("value: \""+jnlpMac+"\"", b); }

Target:
public void jenkinsSecretHidden() throws Exception { SemaphoreStep.waitForStart("pod/1", b); Optional<SlaveComputer> scOptional = Arrays.stream(r.jenkins.getComputers()) .filter(SlaveComputer.class::isInstance) .map(SlaveComputer.class::cast) .findAny(); assertTrue(scOptional.isPresent()); String jnlpMac = scOptional.get().getJnlpMac(); SemaphoreStep.success("pod/1", b); r.assertBuildStatusSuccess(r.waitForCompletion(b)); r.assertLogNotContains(jnlpMac, b); }
Source:
public SampleList getLastCreatedByUserID(final Integer userID, final String programUUID) { try { if (userID != null) { final Criteria criteria = this.getSession().createCriteria(SampleList.class); criteria.add(Restrictions.eq("createdBy.userid", userID)); this.addCriteriaForProgramUUIDInLists(programUUID, criteria); this.hideSnapshotListTypes(criteria); criteria.addOrder(Order.desc("id")); final List result = criteria.list(); if (!result.isEmpty()) { return (SampleList) result.get(0); } else { return null; } } } catch (final HibernateException e) { this.logAndThrowException("Error with getByUserID(userID=" + userID + ") query from GermplasmList: " + e.getMessage(), e); } return null; }

Target:
public SampleList getLastCreatedByUserID(final Integer userID, final String programUUID) { try { if (userID != null) { final Criteria criteria = this.getSession().createCriteria(SampleList.class); criteria.add(Restrictions.eq("createdBy.userid", userID)); this.addCriteriaForProgramUUIDInLists(programUUID, criteria); this.hideSnapshotListTypes(criteria); criteria.addOrder(Order.desc("id")); final List result = criteria.list(); if (!result.isEmpty()) { return (SampleList) result.get(0); } else { return null; } } } catch (final HibernateException e) { throw new MiddlewareQueryException("Error with getByUserID(userID=" + userID + ") query from GermplasmList: " + e.getMessage(), e); } return null; }
Source:
protected boolean isDirectEditEnabled() { boolean directEditEnabled = false; final EObject eObj = resolveSemanticElement(); if (eObj instanceof DMappingBased) { final DMappingBased mappingBasedObject = (DMappingBased) eObj; if (mappingBasedObject.getMapping() != null && mappingBasedObject instanceof DDiagramElement && ((DDiagramElement) mappingBasedObject).getDiagramElementMapping().getLabelDirectEdit() != null) { directEditEnabled = !isInLayoutingModeDiagram((DDiagramElement) mappingBasedObject); DirectEditLabel labelDirectEdit = ((DDiagramElement) mappingBasedObject).getDiagramElementMapping().getLabelDirectEdit(); final DirectEditCommandBuilder builder = new DirectEditCommandBuilder((DDiagramElement) mappingBasedObject, labelDirectEdit, null); directEditEnabled = directEditEnabled && builder.checkPrecondition(); } } return directEditEnabled; }

Target:
protected boolean isDirectEditEnabled() { boolean directEditEnabled = false; final EObject eObj = resolveSemanticElement(); if (eObj instanceof DMappingBased) { final DMappingBased mappingBasedObject = (DMappingBased) eObj; if (mappingBasedObject.getMapping() != null && mappingBasedObject instanceof DDiagramElement && ((DDiagramElement) mappingBasedObject).getDiagramElementMapping().getLabelDirectEdit() != null) { DirectEditLabel labelDirectEdit = ((DDiagramElement) mappingBasedObject).getDiagramElementMapping().getLabelDirectEdit(); final DirectEditCommandBuilder builder = new DirectEditCommandBuilder((DDiagramElement) mappingBasedObject, labelDirectEdit, null); directEditEnabled = builder.canDirectEdit(); } } return directEditEnabled; }
Source:
public void deploy(DeploymentPhaseContext phaseContext) { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); ModuleLoader moduleLoader = Module.getBootModuleLoader(); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, "org.eclipse.microprofile.fault-tolerance.api", false, false, true, false)); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, "io.smallrye.fault-tolerance", false, false, true, false)); }

Target:
public void deploy(DeploymentPhaseContext phaseContext) { DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); Optional<WeldCapability> weldCapability = support.getOptionalCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); if (weldCapability.isPresent() && weldCapability.get().isPartOfWeldDeployment(deploymentUnit) && MicroProfileFaultToleranceMarker.hasMicroProfileFaultToleranceAnnotations(deploymentUnit)) { MicroProfileFaultToleranceMarker.mark(deploymentUnit); ModuleSpecification moduleSpecification = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION); ModuleLoader moduleLoader = Module.getBootModuleLoader(); moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, "org.eclipse.microprofile.fault-tolerance.api", false, false, false, false)); } }
Source:
private String parse(String fieldName, String qs, String lang) { qs = qs.replaceAll("\\:", "\\\\:") .replaceAll("\\+", "\\\\+") .replaceAll("\\-", "\\\\-") .replaceAll("\\=", "\\\\=") .replaceAll("\\&", "\\\\&") .replaceAll("\\|", "\\\\|") .replaceAll("\\>", "\\\\>") .replaceAll("\\<", "\\\\<") .replaceAll("\\!", "\\\\!") .replaceAll("\\(", "\\\\(") .replaceAll("\\)", "\\\\)") .replaceAll("\\{", "\\\\{") .replaceAll("\\}", "\\\\}") .replaceAll("\\]", "\\\\]") .replaceAll("\\[", "\\\\[") .replaceAll("\\^", "\\\\^") .replaceAll("\\~", "\\\\~") .replaceAll("\\?", "\\\\?"); if(fieldName != null && !fieldName.isEmpty()) { if(lang != null && !lang.equals("none")) { if (!ASTERISK.equals(lang)) { fieldName = fieldName + UNDERSCORE + lang.replaceAll(DASH, UNDERSCORE); qs = fieldName + COLON + qs; } else { if(!qs.contains("\\*")) { fieldName = fieldName + ASTERISK; qs = fieldName + COLON + qs; } } } else { qs = fieldName + COLON + qs; } } return qs.replaceAll("\\*", "\\\\*"); }

Target:
private String parse(String fieldName, String qs, String lang) { qs = QueryParserBase.escape(qs); if(fieldName != null && !fieldName.isEmpty()) { if(lang != null && !lang.equals("none")) { if (!ASTERISK.equals(lang)) { fieldName = fieldName + UNDERSCORE + lang.replaceAll(DASH, UNDERSCORE); qs = fieldName + COLON + qs; } else { if(!qs.contains("\\*")) { fieldName = fieldName + ASTERISK; qs = fieldName + COLON + qs; } } } else { qs = fieldName + COLON + qs; } } return qs.replaceAll("\\*", "\\\\*"); }
Source:
protected int getWorkersAlive() { int count = 0; for (int i = 0; i < requestWorkerThreads.size(); i++) { if (asyncRequestWorkers.get(i).isRunning() && requestWorkerThreads.get(i).isAlive()) { count++; } } return count; }

Target:
protected int getWorkersAlive() { int count = 0; for (int i = 0; i < asyncRequestWorkers.size(); i++) { if (asyncRequestWorkers.get(i).isRunning()) { count++; } } return count; }
Source:
protected void syncSearch() { if (getParentEntity() != null) { super.syncSearch(); AsyncQuery asyncQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { AffinityGroupListModel<?> affinityGroupListModel = (AffinityGroupListModel<?>) model; ArrayList<AffinityGroup> list = (ArrayList<AffinityGroup>) ((VdcQueryReturnValue) returnValue).getReturnValue(); affinityGroupListModel.setItems(list); } }); VdcQueryParametersBase parameters = new IdQueryParameters(getParentEntity().getId()); parameters.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(getQueryType(), parameters, asyncQuery); setIsQueryFirstTime(false); } }

Target:
protected void syncSearch() { if (getParentEntity() != null) { super.syncSearch(queryType, new IdQueryParameters(getParentEntity().getId())); } }
Source:
protected void process(String tenantId, List<S> items, int retryCount) throws Exception { ProcessingUnit<S, T> pu = new ProcessingUnit<S, T>(); pu.setProcessor(getProcessor()); pu.setRetryCount(retryCount); pu.setResultHandler(new Handler<T>() { @Override public void handle(String tenantId, List<T> items) throws Exception { getPublisher().publish(tenantId, items, getPublisher().getInitialRetryCount(), getProcessor().getDeliveryDelay(items)); } }); pu.setRetryHandler(new Handler<S>() { @Override public void handle(String tenantId, List<S> items) throws Exception { getRetryPublisher().publish(tenantId, items, pu.getRetryCount() - 1, getProcessor().getRetryDelay(items)); } }); pu.handle(tenantId, items); }

Target:
protected void process(String tenantId, List<S> items, int retryCount) throws Exception { ProcessingUnit<S, T> pu = new ProcessingUnit<S, T>(); pu.setProcessor(getProcessor()); pu.setRetryCount(retryCount); pu.setResultHandler( (tid, events) -> getPublisher().publish(tid, events, getPublisher().getInitialRetryCount(), getProcessor().getDeliveryDelay(events)) ); pu.setRetryHandler( (tid, events) -> getRetryPublisher().publish(tid, events, pu.getRetryCount() - 1, getProcessor().getRetryDelay(events)) ); pu.handle(tenantId, items); }
Source:
private Object calculate(SimpleFeatureCollection featureCollection) { FeatureCalc quantileVisit = getListVisitor(); if (progress == null) progress = new NullProgressListener(); try { featureCollection.accepts(quantileVisit, progress); } catch (IOException e) { LOGGER.log( Level.SEVERE, "QuantileFunction calculate(SimpleFeatureCollection) failed", e); return null; } if (progress.isCanceled()) return null; CalcResult calcResult = quantileVisit.getResult(); if (calcResult == null || calcResult == CalcResult.NULL_RESULT) { return null; } List[] bin = (List[]) calcResult.getValue(); Comparable globalMin = (Comparable) bin[0].toArray()[0]; Object lastBin[] = bin[bin.length - 1].toArray(); if (lastBin.length == 0) { return null; } Comparable globalMax = (Comparable) lastBin[lastBin.length - 1]; if ((globalMin instanceof Number) && (globalMax instanceof Number)) { return calculateNumerical(bin, globalMin, globalMax); } else { return calculateNonNumerical(bin); } }

Target:
private Object calculate(SimpleFeatureCollection featureCollection) { FeatureCalc quantityVisitor = getListVisitor(); if (progress == null) progress = new NullProgressListener(); try { featureCollection.accepts(quantityVisitor, progress); } catch (IOException e) { LOGGER.log( Level.SEVERE, "QuantileFunction calculate(SimpleFeatureCollection) failed", e); return null; } if (progress.isCanceled()) return null; CalcResult calcResult = quantityVisitor.getResult(); if (calcResult == null || calcResult == CalcResult.NULL_RESULT) { return null; } List[] bin = (List[]) calcResult.getValue(); Comparable globalMin = (Comparable) bin[0].toArray()[0]; Object lastBin[] = bin[bin.length - 1].toArray(); if (lastBin.length == 0) { return null; } Comparable globalMax = (Comparable) lastBin[lastBin.length - 1]; if ((globalMin instanceof Number) && (globalMax instanceof Number)) { return calculateNumerical(bin, globalMin, globalMax); } else { return calculateNonNumerical(bin); } }
Source:
public String getIconFilePathPattern() { if (Jenkins.RESOURCE_PATH.isEmpty()) { return "images/:size/freestyleproject.png"; } else { return Jenkins.RESOURCE_PATH.substring(1) + "/images/:size/freestyleproject.png"; } }

Target:
public String getIconFilePathPattern() { return (Jenkins.RESOURCE_PATH + "/images/:size/freestyleproject.png").replaceFirst("^/", ""); }
Source:
private HashMap<String, String> getContainerInfo(PID pid, int entry) { ObjectPath objPath = objectPathFactory.getPath(pid); String objAdminUnit = null; String objAdminUnitTitle = ""; String objContainer = ""; String objContainerTitle = ""; if (objPath != null) { List<ObjectPathEntry> objPathList = objPath.getEntries(); if (objPathList.size() > 1) { ObjectPathEntry destEntry = objPathList.get(1); objAdminUnit = destEntry.getPid(); objAdminUnitTitle = destEntry.getName(); ObjectPathEntry objContainerEntry = objPathList.get(objPathList.size() - entry); objContainer = objContainerEntry.getPid(); objContainerTitle = objContainerEntry.getName(); } } HashMap<String, String> entryValues = new HashMap<String, String>(); entryValues.put("adminUnit", objAdminUnit); entryValues.put("adminUnitTitle", objAdminUnitTitle); entryValues.put("container", objContainer); entryValues.put("containerTitle", objContainerTitle); return entryValues; }

Target:
private Map<String, String> getContainerInfo(PID pid, int entry) { ObjectPath objPath = objectPathFactory.getPath(pid); String objAdminUnit = null; String objAdminUnitTitle = ""; String objContainer = ""; String objContainerTitle = ""; if (objPath != null) { List<ObjectPathEntry> objPathList = objPath.getEntries(); if (objPathList.size() > 1) { ObjectPathEntry destEntry = objPathList.get(1); objAdminUnit = destEntry.getPid(); objAdminUnitTitle = destEntry.getName(); ObjectPathEntry objContainerEntry = objPathList.get(objPathList.size() - entry); objContainer = objContainerEntry.getPid(); objContainerTitle = objContainerEntry.getName(); } } Map<String, String> entryValues = new HashMap<>(); entryValues.put("adminUnit", objAdminUnit); entryValues.put("adminUnitTitle", objAdminUnitTitle); entryValues.put("container", objContainer); entryValues.put("containerTitle", objContainerTitle); return entryValues; }
Source:
private synchronized String loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.name); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.name, entry.getFileName(), alreadyLoadedEntry.getFileName() )); } try { entry.extension = new ExtensionProxy( loadExtension(props), ( new ExtMap().mput( Base.ContextKeys.GLOBAL_CONTEXT, globalContext ).mput( TRACE_LOG_CONTEXT_KEY, traceLog ).mput( Base.ContextKeys.INTERFACE_VERSION_MIN, 0 ).mput( Base.ContextKeys.INTERFACE_VERSION_MAX, Base.INTERFACE_VERSION_CURRENT ).mput( Base.ContextKeys.LOCALE, Locale.getDefault().toString() ).mput( Base.ContextKeys.CONFIGURATION, props ).mput( Base.ContextKeys.CONFIGURATION_SENSITIVE_KEYS, splitString(props.getProperty(Base.ConfigKeys.SENSITIVE_KEYS, "")) ).mput( Base.ContextKeys.INSTANCE_NAME, entry.name ).mput( Base.ContextKeys.PROVIDES, splitString(props.getProperty(Base.ConfigKeys.PROVIDES, "")) ) ) ); } catch (Exception e) { throw new RuntimeException(String.format("Error loading extension %1$s", entry.name)); } loadedEntries.put(entry.name, entry); setChanged(); notifyObservers(); return entry.name; }

Target:
private String loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.name); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.name, entry.getFileName(), alreadyLoadedEntry.getFileName() )); } try { entry.extension = new ExtensionProxy( loadExtension(props), ( new ExtMap().mput( Base.ContextKeys.GLOBAL_CONTEXT, globalContext ).mput( TRACE_LOG_CONTEXT_KEY, traceLog ).mput( Base.ContextKeys.INTERFACE_VERSION_MIN, 0 ).mput( Base.ContextKeys.INTERFACE_VERSION_MAX, Base.INTERFACE_VERSION_CURRENT ).mput( Base.ContextKeys.LOCALE, Locale.getDefault().toString() ).mput( Base.ContextKeys.CONFIGURATION, props ).mput( Base.ContextKeys.CONFIGURATION_SENSITIVE_KEYS, splitString(props.getProperty(Base.ConfigKeys.SENSITIVE_KEYS, "")) ).mput( Base.ContextKeys.INSTANCE_NAME, entry.name ).mput( Base.ContextKeys.PROVIDES, splitString(props.getProperty(Base.ConfigKeys.PROVIDES, "")) ) ) ); ExtMap output = entry.extension.invoke( new ExtMap().mput( Base.InvokeKeys.COMMAND, Base.InvokeCommands.LOAD ) ); if (output.<Integer>get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS) { throw new RuntimeException( String.format("Invoke of LOAD returned with error code: %1$s", output.<Integer>get(Base.InvokeKeys.RESULT) ) ); } } catch (Exception e) { throw new RuntimeException(String.format("Error loading extension %1$s", entry.name)); } loadedEntries.putIfAbsent(entry.name, entry); setChanged(); notifyObservers(); return entry.name; }
Source:
public static boolean isGranted(final Type type, @NonNull final String permissions[], @NonNull final int grantResults[]) { if (permissions.length != 1) { Lg.w("expected exactly one permission but got: ", TextUtils.join(", ", permissions)); } if (!Util.equalString(permissions[0], type.getPermission())) { Lg.w("expected permission: ", type.getPermission(), " but got: ", permissions[0]); return false; } if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Lg.i("permission granted: ", permissions[0]); return true; } else { Lg.i("permission denied: ", permissions[0]); return false; } }

Target:
public static boolean isGranted(final Type type, @NonNull final String permissions[], @NonNull final int grantResults[]) { if (permissions.length != 1) { Lg.w("expected exactly one permission but got: ", TextUtils.join(", ", permissions)); } final String permission = permissions[0]; if (!Util.equalString(permission, type.getPermission())) { Lg.w("expected permission: ", type.getPermission(), " but got: ", permission); return false; } if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Lg.i("permission granted: ", permission); return true; } else { Lg.i("permission denied: ", permission); return false; } }
Source:
protected Command getCommand(IEvaluationContext context) { TransactionalEditingDomain editingDomain = getEditingDomain(context); List<Table> tables = getSelectedTables(); if (editingDomain != null && tables.size() == 1) { final Table table = tables.get(0); final String tableLabel = LabelInternationalization.getInstance().getTableLabelWithoutName(table); if (null != tableLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(table)) { AbstractTransactionalCommand cmd = new RenameTableLabelCommand( editingDomain, "ChangeTableLabelCommand", table, tableLabel, "Rename table label...", "New label:"); return new GMFtoEMFCommandWrapper(cmd); } else { final String currentName = table.getName(); if (null != currentName) { return new RenameElementCommand( editingDomain, "RenameTableCommand", table, currentName, Messages.RenameTableHandler_RenameAnExistingTable, Messages.RenameTableHandler_NewName); } } } return UnexecutableCommand.INSTANCE; }

Target:
protected Command getCommand(IEvaluationContext context) { TransactionalEditingDomain editingDomain = getEditingDomain(context); List<Table> tables = getSelectedTables(); if (editingDomain != null && tables.size() == 1) { final Table table = tables.get(0); final String tableLabel = LabelInternationalization.getInstance().getTableLabelWithoutName(table); if (null != tableLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(table)) { AbstractTransactionalCommand cmd = new RenameTableLabelCommand(editingDomain, "ChangeTableLabelCommand", table, tableLabel, Messages.RenameTableHandler_Label_DialogTitle); return new GMFtoEMFCommandWrapper(cmd); } else { final String currentName = table.getName(); if (null != currentName) { EStructuralFeature nameFeature = table.eClass().getEStructuralFeature("name"); return new RenameElementCommand(editingDomain, "RenameTableCommand", table, currentName, nameFeature, Messages.RenameTableHandler_RenameAnExistingTable, Messages.RenameTableHandler_NewName); } } } return UnexecutableCommand.INSTANCE; }
Source:
V get( long idx ) { if ( idx < 0 ) { throw new IllegalArgumentException( "Index must be >= 0" ); } if ( idx > endIndex || idx < firstIndex() ) { return null; } return circle.read( toIntExact( idx - firstIndex() ) ); }

Target:
V get( long idx ) { if ( idx < 0 ) { throw new IllegalArgumentException( format( "Index must be >= 0 (was %d)", idx ) ); } if ( idx > endIndex || idx < firstIndex() ) { return null; } return circle.read( toIntExact( idx - firstIndex() ) ); }
Source:
protected APIResult update(InputStream inputStream, String type, String entityName, String colo, Boolean skipDryRun) { checkColo(colo); try { EntityType entityType = EntityType.getEnum(type); Entity entity = deserializeEntity(inputStream, entityType); return update(entity, type, entityName, skipDryRun); } catch (IOException | FalconException e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); } }

Target:
protected APIResult update(InputStream inputStream, String type, String entityName, String colo, Boolean skipDryRun) { checkColo(colo); try { EntityType entityType = EntityType.getEnum(type); Entity entity = deserializeEntity(inputStream, entityType); return update(entity, type, entityName, skipDryRun); } catch (IOException | FalconException e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { return runConnectionStorageToDomain(storageDomain, vdsId, type, null, Guid.Empty); }

Target:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type) { Guid poolId = Guid.Empty; if (storageDomain.getStoragePoolId() != null) { poolId = storageDomain.getStoragePoolId(); } return runConnectionStorageToDomain(storageDomain, vdsId, type, null, poolId); }
Source:
public void testGetMany() { String key1 = "foo1"; String key2 = "foo2"; String key3 = "foo3"; Set<String> keys = new HashSet<>(Arrays.asList(key1, key2, key3)); assertMapDeepEquals(new HashMap(0), store.get(keys)); Map<String, String> kvMap = new HashMap<>(); kvMap.put(key1, BAR); kvMap.put(key2, GEE); kvMap.put(key3, MOO); store.put(key1, BAR); store.put(key2, GEE); store.put(key3, MOO); assertMapDeepEquals(kvMap, store.getStrings(keys)); store.put(key1, BAR_B); store.put(key2, GEE_B); store.put(key3, MOO_B); Map<String, byte[]> storeKVBMap = store.get(keys); assertArrayEquals(BAR_B, storeKVBMap.get(key1)); assertArrayEquals(GEE_B, storeKVBMap.get(key2)); assertArrayEquals(MOO_B, storeKVBMap.get(key3)); keys.add("foo4"); assertMapDeepEquals(kvMap, store.getStrings(keys)); }

Target:
public void testGetMany() { String key1 = "foo1"; String key2 = "foo2"; String key3 = "foo3"; String key4 = "foo4"; String key5 = "foo5"; Set<String> keys = new HashSet<>(Arrays.asList(key1, key2, key3, key4, key5)); assertEquals(Collections.emptyMap(), store.get(keys)); Map<String, String> map = new HashMap<>(); map.put(key1, BAR); map.put(key2, GEE); map.put(key3, MOO); store.put(key1, BAR); store.put(key2, GEE); store.put(key3, MOO); store.put(key4, (String) null); assertEquals(map, store.getStrings(keys)); store.put(key1, BAR_B); store.put(key2, GEE_B); store.put(key3, MOO_B); Map<String, byte[]> storeBMap = store.get(keys); assertArrayEquals(BAR_B, storeBMap.get(key1)); assertArrayEquals(GEE_B, storeBMap.get(key2)); assertArrayEquals(MOO_B, storeBMap.get(key3)); assertEquals(3, storeBMap.entrySet().size()); }
Source:
public boolean hasResourceInstanceGroupTag() { return _resourceInstanceGroupTag != null; }

Target:
public boolean hasResourceInstanceGroupTag() { return _resourceInstanceGroupTag != null && !_resourceInstanceGroupTag.isEmpty(); }
Source:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { for (DocumentModel recordDoc : loadDocuments(session, ids)) { if (!recordDoc.hasFacet(RetentionConstants.RECORD_FACET)) { log.debug("Document is not a record, ignoring ...", recordDoc::getPathAsString); continue; } Record record = recordDoc.getAdapter(Record.class); if (!record.isRetentionIndeterminate()) { log.debug("Record has already a determinate retention date {}, ignoring ...", recordDoc::getPathAsString, () -> (recordDoc.getRetainUntil() == null ? null : recordDoc.getRetainUntil().toInstant())); continue; } RetentionRule rule = record.getRule(session); if (!rule.isEventBased()) { log.debug("Record does not have a event-based rule, ignoring ...", recordDoc::getPathAsString); continue; } session.setRetainUntil(recordDoc.getRef(), record.getRule(session).getRetainUntilDateFromNow(), null); } }

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { for (DocumentModel recordDoc : loadDocuments(session, ids)) { if (!recordDoc.hasFacet(RetentionConstants.RECORD_FACET)) { log.debug("Document is not a record, ignoring ...", recordDoc::getPathAsString); continue; } Record record = recordDoc.getAdapter(Record.class); if (!record.isRetentionIndeterminate()) { log.debug("Record has already a determinate retention date {}, ignoring ...", recordDoc::getPathAsString, () -> (recordDoc.getRetainUntil() == null ? null : recordDoc.getRetainUntil().toInstant())); continue; } RetentionRule rule = record.getRule(session); if (!rule.isEventBased()) { log.debug("Record does not have an event-based rule, ignoring ...", recordDoc::getPathAsString); continue; } session.setRetainUntil(recordDoc.getRef(), record.getRule(session).getRetainUntilDateFromNow(), null); } }