auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testImportWizardGeneralProjectWithWorkingSet() throws Exception { deleteAllProjects(); assertProjectExistence(PROJ1, false); SWTBotTree tree = getOrOpenView().bot().tree(); String wizardTitle = NLS.bind( UIText.GitCreateProjectViaWizardWizard_WizardTitle, repositoryFile.getPath()); getWorkdirItem(tree, repositoryFile).expand().getNode(PROJ1).select(); ContextMenuHelper.clickContextMenu(tree, myUtil .getPluginLocalizedValue("ImportProjectsCommand")); SWTBotShell shell = bot.shell(wizardTitle); shell = bot.shell(wizardTitle); activateItemByKeyboard(shell, UIText.GitSelectWizardPage_ImportExistingButton); activateItemByKeyboard(shell, UIText.GitSelectWizardPage_AutoShareButton); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); waitInUI(); shell.bot().tree().getAllItems()[0].check(); shell.bot().checkBox().select(); shell.bot().button("Select...").click(); SWTBotShell workingSetDialog = bot.shell("Select Working Sets"); workingSetDialog.bot().button("New...").click(); SWTBotShell newDialog = bot.shell("New Working Set"); newDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); String workingSetName = "myWorkingSet"; newDialog.bot().text(0).setText(workingSetName); newDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); workingSetDialog.bot().table().getTableItem(workingSetName).check(); workingSetDialog.bot().button(IDialogConstants.OK_LABEL).click(); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); waitInUI(); assertProjectExistence(PROJ1, true); assertProjectInWorkingSet(workingSetName, PROJ1); }

Target:
public void testImportWizardGeneralProjectWithWorkingSet() throws Exception { deleteAllProjects(); assertProjectExistence(PROJ1, false); SWTBotTree tree = getOrOpenView().bot().tree(); String wizardTitle = NLS.bind( UIText.GitCreateProjectViaWizardWizard_WizardTitle, repositoryFile.getPath()); getWorkdirItem(tree, repositoryFile).expand().getNode(PROJ1).select(); ContextMenuHelper.clickContextMenu(tree, myUtil .getPluginLocalizedValue("ImportProjectsCommand")); SWTBotShell shell = bot.shell(wizardTitle); shell = bot.shell(wizardTitle); activateItemByKeyboard(shell, UIText.GitSelectWizardPage_ImportExistingButton); activateItemByKeyboard(shell, UIText.GitSelectWizardPage_AutoShareButton); shell.bot().button(IDialogConstants.NEXT_LABEL).click(); waitInUI(); shell.bot().tree().getAllItems()[0].check(); shell.bot().checkBox().select(); shell.bot().button("Select...").click(); SWTBotShell workingSetDialog = bot.shell("Select Working Sets"); workingSetDialog.bot().button("New...").click(); SWTBotShell newDialog = bot.shell("New Working Set"); newDialog.bot().table().select("Java"); newDialog.bot().button(IDialogConstants.NEXT_LABEL).click(); String workingSetName = "myWorkingSet"; newDialog.bot().text(0).setText(workingSetName); newDialog.bot().button(IDialogConstants.FINISH_LABEL).click(); workingSetDialog.bot().table().getTableItem(workingSetName).check(); workingSetDialog.bot().button(IDialogConstants.OK_LABEL).click(); shell.bot().button(IDialogConstants.FINISH_LABEL).click(); waitInUI(); assertProjectExistence(PROJ1, true); assertProjectInWorkingSet(workingSetName, PROJ1); }
Source:
private void onPreview() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { cancel(); return; } VM vm = getEntity(); SnapshotModel snapshotModel = (SnapshotModel) getWindow(); boolean memory = false; List<DiskImage> disks; Set<Guid> diskImages = null; if (snapshotModel.isShowPartialSnapshotWarning()) { switch (snapshotModel.getPartialPreviewSnapshotOptions().getSelectedItem()) { case preserveActiveDisks: disks = snapshotModel.getDisks(); disks.addAll(imagesSubtract(getVmDisks(), disks)); diskImages = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); break; case excludeActiveDisks: break; case openCustomPreviewDialog: setWindow(null); getCustomPreviewCommand().execute(); return; } } if (snapshotModel.isShowMemorySnapshotWarning()) { memory = snapshotModel.getMemory().getEntity(); } runTryBackToAllSnapshotsOfVm(snapshotModel, vm, snapshot, memory, diskImages); }

Target:
private void onPreview() { Snapshot snapshot = getSelectedItem(); if (snapshot == null) { cancel(); return; } VM vm = getEntity(); SnapshotModel snapshotModel = (SnapshotModel) getWindow(); boolean memory = false; List<DiskImage> disks; Set<Guid> diskIds = null; if (snapshotModel.isShowPartialSnapshotWarning()) { switch (snapshotModel.getPartialPreviewSnapshotOptions().getSelectedItem()) { case preserveActiveDisks: disks = snapshotModel.getDisks(); disks.addAll(imagesSubtract(getVmDisks(), disks)); diskIds = disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()); break; case excludeActiveDisks: break; case openCustomPreviewDialog: setWindow(null); getCustomPreviewCommand().execute(); return; } } if (snapshotModel.isShowMemorySnapshotWarning()) { memory = snapshotModel.getMemory().getEntity(); } runTryBackToAllSnapshotsOfVm(snapshotModel, vm, snapshot, memory, diskIds); }
Source:
public void testThreadLeakWhenClientCanNotConstructDueToNoMemberDiscoveryStrategyConfig() { ClientConfig config = new ClientConfig(); config.getNetworkConfig().getDiscoveryConfig().addDiscoveryStrategyConfig( new DiscoveryStrategyConfig(new ClientDiscoverySpiTest.NoMemberDiscoveryStrategyFactory(), Collections.<String, Comparable>emptyMap())); HazelcastClient.newHazelcastClient(config); Assert.fail(); }

Target:
public void testThreadLeakWhenClientCanNotConstructDueToNoMemberDiscoveryStrategyConfig() { ClientConfig config = new ClientConfig(); config.getNetworkConfig().getDiscoveryConfig().addDiscoveryStrategyConfig( new DiscoveryStrategyConfig(new ClientDiscoverySpiTest.NoMemberDiscoveryStrategyFactory(), Collections.<String, Comparable>emptyMap())); Set<Thread> testStartThreads = getThreads(); try { HazelcastClient.newHazelcastClient(config); } finally { assertHazelcastThreadShutdown(testStartThreads); } }
Source:
private List<VulnerabilityDTO> getDtosFromRelations(List<ReleaseVulnerabilityRelation> relations, User user) { Set<String> vulnerabilityIds = relations.stream() .map(ReleaseVulnerabilityRelation::getVulnerabilityId) .collect(Collectors.toSet()); List<Vulnerability> vulnerabilities = dbHandler.getByIds(Vulnerability.class, vulnerabilityIds); Map<String, Vulnerability> vulnerabilityMap = vulnerabilities.stream() .collect(Collectors.toMap(Vulnerability::getId, Function.identity())); LoadingCache<String, Release> releaseCache = makeReleaseCache(user); LoadingCache<String, Component> componentCache = makeComponentCache(user); return relations.stream() .map(relation -> getDtoFromRelation(relation, vulnerabilityMap.get(relation.getVulnerabilityId()))) .map(dto -> enrichVulnerabilityDTO(dto, componentCache, releaseCache)) .collect(Collectors.toList()); }

Target:
private List<VulnerabilityDTO> getDtosFromRelations(List<ReleaseVulnerabilityRelation> relations, User user) { Set<String> vulnerabilityIds = relations.stream() .map(ReleaseVulnerabilityRelation::getVulnerabilityId) .collect(Collectors.toSet()); List<Vulnerability> vulnerabilities = dbHandler.getByIds(Vulnerability.class, vulnerabilityIds); Map<String, Vulnerability> vulnerabilityMap= ThriftUtils.getIdMap(vulnerabilities); LoadingCache<String, Release> releaseCache = makeReleaseCache(user); LoadingCache<String, Component> componentCache = makeComponentCache(user); return relations.stream() .map(relation -> getDtoFromRelation(relation, vulnerabilityMap.get(relation.getVulnerabilityId()))) .map(dto -> enrichVulnerabilityDTO(dto, componentCache, releaseCache)) .collect(Collectors.toList()); }
Source:
private void process(final DuplicateSet set) { if (nextSetsIterator.hasNext()) { throw new PicardException("nextSetsIterator is expected to be empty, but already contains data."); } final UmiGraph umiGraph = new UmiGraph(set, umiTag, inferredUmiTag, allowMissingUmis); List<DuplicateSet> duplicateSets = umiGraph.joinUmisIntoDuplicateSets(maxEditDistanceToJoin); for (DuplicateSet ds : duplicateSets) { List<SAMRecord> records = ds.getRecords(); SAMRecord representativeRead = ds.getRepresentative(); String inferredUmi = representativeRead.getStringAttribute(inferredUmiTag); for (SAMRecord rec : records) { String currentUmi = UmiUtil.sanitizeUMI(rec, umiTag); if (currentUmi != null) { if (currentUmi.contains("N")) { metrics.addUmiObservationN(); } else { if (!haveWeSeenFirstRead) { metrics.MEAN_UMI_LENGTH = currentUmi.length(); haveWeSeenFirstRead = true; } else { if (metrics.MEAN_UMI_LENGTH != currentUmi.length()) { throw new PicardException("UMIs of differing lengths were found."); } } metrics.OBSERVED_BASE_ERRORS += hammingDistance(currentUmi, inferredUmi); observedUmiBases += currentUmi.length(); metrics.addUmiObservation(currentUmi, inferredUmi); } } } } metrics.DUPLICATE_SETS_WITH_UMI += duplicateSets.size(); metrics.DUPLICATE_SETS_IGNORING_UMI++; nextSetsIterator = duplicateSets.iterator(); }

Target:
private void process(final DuplicateSet set) { if (nextSetsIterator.hasNext()) { throw new PicardException("nextSetsIterator is expected to be empty, but already contains data."); } final UmiGraph umiGraph = new UmiGraph(set, umiTag, inferredUmiTag, allowMissingUmis); List<DuplicateSet> duplicateSets = umiGraph.joinUmisIntoDuplicateSets(maxEditDistanceToJoin); for (DuplicateSet ds : duplicateSets) { List<SAMRecord> records = ds.getRecords(); SAMRecord representativeRead = ds.getRepresentative(); String inferredUmi = representativeRead.getStringAttribute(inferredUmiTag); for (SAMRecord rec : records) { String currentUmi = UmiUtil.getSanitizedUMI(rec, umiTag); if (currentUmi != null) { if (currentUmi.contains("N")) { metrics.addUmiObservationN(); } else { if (!haveWeSeenFirstRead) { metrics.MEAN_UMI_LENGTH = currentUmi.length(); haveWeSeenFirstRead = true; } else { if (metrics.MEAN_UMI_LENGTH != currentUmi.length()) { throw new PicardException("UMIs of differing lengths were found."); } } metrics.OBSERVED_BASE_ERRORS += hammingDistance(currentUmi, inferredUmi); observedUmiBases += currentUmi.length(); metrics.addUmiObservation(currentUmi, inferredUmi); } } } } metrics.DUPLICATE_SETS_WITH_UMI += duplicateSets.size(); metrics.DUPLICATE_SETS_IGNORING_UMI++; nextSetsIterator = duplicateSets.iterator(); }
Source:
public void append(K key, V value) { int attempt = 0; boolean success = false; while(!success) { RootReference rootReference = getRoot(); if (rootReference.appendCounter >= keysPerPage) { rootReference = flushAppendBuffer(rootReference); assert rootReference.appendCounter < keysPerPage; } keysBuffer[rootReference.appendCounter] = key; valuesBuffer[rootReference.appendCounter] = value; RootReference updatedRootReference = new RootReference(rootReference, (byte) (rootReference.appendCounter + 1), ++attempt); success = root.compareAndSet(rootReference, updatedRootReference); } }

Target:
public void append(K key, V value) { int attempt = 0; boolean success = false; while(!success) { RootReference rootReference = getRoot(); int appendCounter = rootReference.getAppendCounter(); if (appendCounter >= keysPerPage) { rootReference = flushAppendBuffer(rootReference); appendCounter = rootReference.getAppendCounter(); assert appendCounter < keysPerPage; } keysBuffer[appendCounter] = key; valuesBuffer[appendCounter] = value; RootReference updatedRootReference = new RootReference(rootReference, appendCounter + 1, ++attempt); success = root.compareAndSet(rootReference, updatedRootReference); } }
Source:
public void testConcat() throws DatabaseEngineException { test5Columns(); engine.persist("TEST", entry().set("COL1", 1).set("COL5", "teste") .build()); engine.persist("TEST", entry().set("COL1", 2).set("COL5", "xpto") .build()); engine.persist("TEST", entry().set("COL1", 3).set("COL5", "xpto") .build()); engine.persist("TEST", entry().set("COL1", 4).set("COL5", "teste") .build()); engine.persist("TEST", entry().set("COL1", 5).set("COL5", "pomme de terre") .build()); final Query query = select( concat(k("."), column("COL5"), cast(column("COL1"), STRING)).alias("concat")) .from(table("TEST")); final List<Map<String, ResultColumn>> result = engine.query(query); assertEquals("Concat must be 'teste.1'", "teste.1", result.get(0).get("concat").toString()); assertEquals("Concat must be 'xpto.2'", "xpto.2", result.get(1).get("concat").toString()); assertEquals("Concat must be 'xpto.3'", "xpto.3", result.get(2).get("concat").toString()); assertEquals("Concat must be 'teste.4'", "teste.4", result.get(3).get("concat").toString()); assertEquals("Concat must be 'pomme de terre.5'", "pomme de terre.5", result.get(4).get("concat").toString()); }

Target:
public void testConcat() throws DatabaseEngineException { test6Columns(); engine.persist("TEST", entry().set("COL1", 1).set("COL5", "teste").set("COL6", "teste") .build()); engine.persist("TEST", entry().set("COL1", 2).set("COL5", "xpto").set("COL6", "xpto") .build()); engine.persist("TEST", entry().set("COL1", 3).set("COL5", "xpto").set("COL6", "xpto") .build()); engine.persist("TEST", entry().set("COL1", 4).set("COL5", "teste").set("COL6", "teste") .build()); engine.persist("TEST", entry().set("COL1", 5).set("COL5", "pomme de terre").set("COL6", "pomme de terre") .build()); final Query query = select( concat(k("."), column("COL5"), column("COL6")).alias("concat")) .from(table("TEST")); final List<Map<String, ResultColumn>> result = engine.query(query); assertEquals("teste.teste", result.get(0).get("concat").toString()); assertEquals("xpto.xpto", result.get(1).get("concat").toString()); assertEquals("xpto.xpto", result.get(2).get("concat").toString()); assertEquals("teste.teste", result.get(3).get("concat").toString()); assertEquals("pomme de terre.pomme de terre", result.get(4).get("concat").toString()); }
Source:
public void sendMessage_success_sendsFirebaseMessage() throws FirebaseMessagingException { UUID deviceAnonymizedId = UUID.randomUUID(); String registrationToken = "token-" + UUID.randomUUID(); SystemMessage message = SystemMessage.createInstance("Hi there!"); setId(message, 5); service.sendMessage(deviceAnonymizedId, registrationToken, message); verify(mockFirebaseMessaging, times(1)).send(any()); verify(mockDeviceService, never()).clearFirebaseInstanceId(any()); }

Target:
public void sendMessage_success_sendsFirebaseMessage() throws FirebaseMessagingException { UUID deviceAnonymizedId = UUID.randomUUID(); String registrationToken = "token-" + UUID.randomUUID(); SystemMessage message = createMessage(); service.sendMessage(deviceAnonymizedId, registrationToken, message); verify(mockFirebaseMessaging, times(1)).send(any()); verify(mockDeviceService, never()).clearFirebaseInstanceId(any()); }
Source:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() != Material.NETHERRACK && !block.isEmpty()) || block.getRelative(BlockFace.UP).getType() != Material.NETHERRACK) { return; } int netherrackBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).getType() == Material.NETHERRACK) { netherrackBlockCount++; } } int airBlockCount = 0; for (BlockFace face : SIDES) { if (block.getRelative(face).isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); new PulseTask((GlowBlock) block, true, 1, true).startPulseTask(); } }

Target:
public void decorate(World world, Random random, Chunk source) { int sourceX = (source.getX() << 4) + random.nextInt(16); int sourceZ = (source.getZ() << 4) + random.nextInt(16); int sourceY = flowing ? 4 + random.nextInt(120) : 10 + random.nextInt(108); Block block = world.getBlockAt(sourceX, sourceY, sourceZ); if ((block.getType() != Material.NETHERRACK && !block.isEmpty()) || block.getRelative(BlockFace.UP).getType() != Material.NETHERRACK) { return; } int netherrackBlockCount = 0; int airBlockCount = 0; for (BlockFace face : SIDES) { Block neighbor = block.getRelative(face); if (neighbor.getType() == Material.NETHERRACK) { netherrackBlockCount++; } else if (neighbor.isEmpty()) { airBlockCount++; } } if (netherrackBlockCount == 5 || flowing && airBlockCount == 1 && netherrackBlockCount == 4) { BlockState state = block.getState(); state.setType(Material.LAVA); state.update(true); new PulseTask((GlowBlock) block, true, 1, true).startPulseTask(); } }
Source:
public static SeekableInputStream wrap(FSDataInputStream stream) { if (byteBufferReadableClass != null && h2SeekableConstructor != null && byteBufferReadableClass.isInstance(stream) && supportsByteBufferReads(stream)) { try { return h2SeekableConstructor.newInstance(stream); } catch (InstantiationException e) { LOG.warn("Could not instantiate H2SeekableInputStream, falling back to byte array reads", e); return new H1SeekableInputStream(stream); } catch (IllegalAccessException e) { LOG.warn("Could not instantiate H2SeekableInputStream, falling back to byte array reads", e); return new H1SeekableInputStream(stream); } catch (InvocationTargetException e) { throw new ParquetDecodingException( "Could not instantiate H2SeekableInputStream", e.getTargetException()); } } else { return new H1SeekableInputStream(stream); } }

Target:
public static SeekableInputStream wrap(FSDataInputStream stream) { if (byteBufferReadableClass != null && h2SeekableConstructor != null && byteBufferReadableClass.isInstance(stream.getWrappedStream())) { try { return h2SeekableConstructor.newInstance(stream); } catch (InstantiationException e) { LOG.warn("Could not instantiate H2SeekableInputStream, falling back to byte array reads", e); return new H1SeekableInputStream(stream); } catch (IllegalAccessException e) { LOG.warn("Could not instantiate H2SeekableInputStream, falling back to byte array reads", e); return new H1SeekableInputStream(stream); } catch (InvocationTargetException e) { throw new ParquetDecodingException( "Could not instantiate H2SeekableInputStream", e.getTargetException()); } } else { return new H1SeekableInputStream(stream); } }
Source:
public void afterClass() { embeddedCacheManager.stop(); remoteCacheManager.stop(); hotrodServer.stop(); }

Target:
public void afterClass() { remoteCacheManager.stop(); hotrodServer.stop(); embeddedCacheManager.stop(); }
Source:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { IResource resource = (IResource) args[0]; IRootResource rootResource = coreModelCapability.getRootResource(resource); Class<?> apiClass = (Class<?>) args[1]; Endpoint ep = (endpointSelectionStrategy != null) ? endpointSelectionStrategy.select(internalAPIProvider.getProtocols(), rootResource.getEndpoints()) : new BasicEndpointSelectionStrategy().select(internalAPIProvider.getProtocols(), rootResource.getEndpoints()); if (ep == null) { String message = String.format("Unable to find any valid Endpoint from endpoints = %s and protocols = %s.", rootResource.getEndpoints(), internalAPIProvider.getProtocols()); log.error(message); throw new EndpointNotFoundException(message); } Credentials c = null; switch (args.length) { case 2: return internalAPIProvider.getClient(apiClass, ep, c); case 3: @SuppressWarnings("unchecked") CC clientConfiguration1 = (CC) args[2]; return internalAPIProvider.getClient(apiClass, ep, c, clientConfiguration1); case 4: @SuppressWarnings("unchecked") CC clientConfiguration2 = (CC) args[2]; Object applicationSpecificConfiguration = args[3]; return internalAPIProvider.getClient(apiClass, ep, c, clientConfiguration2, applicationSpecificConfiguration); } throw new IllegalStateException("No mapping for method " + method); }

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws EndpointNotFoundException { IResource resource = (IResource) args[0]; IRootResource rootResource = coreModelCapability.getRootResource(resource); Class<?> apiClass = (Class<?>) args[1]; Endpoint ep = endpointSelectionStrategy.select(internalAPIProvider.getProtocols(), rootResource.getEndpoints()); if (ep == null) { String message = String.format("Unable to find any valid Endpoint from endpoints = %s and protocols = %s.", rootResource.getEndpoints(), internalAPIProvider.getProtocols()); log.error(message); throw new EndpointNotFoundException(message); } Credentials c = null; switch (args.length) { case 2: return internalAPIProvider.getClient(apiClass, ep, c); case 3: @SuppressWarnings("unchecked") CC clientConfiguration1 = (CC) args[2]; return internalAPIProvider.getClient(apiClass, ep, c, clientConfiguration1); case 4: @SuppressWarnings("unchecked") CC clientConfiguration2 = (CC) args[2]; Object applicationSpecificConfiguration = args[3]; return internalAPIProvider.getClient(apiClass, ep, c, clientConfiguration2, applicationSpecificConfiguration); } throw new IllegalStateException("No mapping for method " + method); }
Source:
private void initSession(ActionContext actionContext) { if (actionContext.getSession() == null) { actionContext.setSession(new HashMap<String, Object>()); request.setSession(new MockHttpSession(servletContext)); } }

Target:
protected void initSession(ActionContext actionContext) { if (actionContext.getSession() == null) { actionContext.setSession(new HashMap<String, Object>()); request.setSession(new MockHttpSession(servletContext)); } }
Source:
public ContentType getContentType() { final ContentType contentType; try { contentType = APILocator.getContentTypeAPI(APILocator.systemUser()).find(contentTypeId); return contentType; } catch (final DotSecurityException e) { Logger.error(this, String.format("An error occurred when returning the Content Type associated to " + "Contentlet '%s'", this.getIdentifier())); } catch (final DotDataException e) { Logger.error(this, String.format("An error occurred when returning the Content Type associated to " + "Contentlet '%s'", this.getIdentifier())); } return null; }

Target:
public ContentType getContentType() { final ContentType contentType; try { contentType = APILocator.getContentTypeAPI(APILocator.systemUser()).find(contentTypeId); return contentType; } catch (final DotSecurityException | DotDataException e) { Logger.error(this, String.format("An error occurred when returning the Content Type associated to " + "Contentlet '%s'", this.getIdentifier())); } return null; }
Source:
private static InternalAggregationFunction generateAggregation(Type valueType, QuantileDigestType outputType, int arity) { DynamicClassLoader classLoader = new DynamicClassLoader(QuantileDigestAggregationFunction.class.getClassLoader()); List<Type> inputTypes = getInputTypes(valueType, arity); QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType); Type intermediateType = stateSerializer.getSerializedType(); checkArgument(inputFunctions.containsKey(valueType.getDisplayName()), "Unsupported type %s supplied, known types: %s", valueType.getDisplayName(), inputFunctions.keySet()); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(inputTypes), getMethodHandle(valueType, arity), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor( QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory); }

Target:
private static InternalAggregationFunction generateAggregation(Type valueType, QuantileDigestType outputType, int arity) { DynamicClassLoader classLoader = new DynamicClassLoader(QuantileDigestAggregationFunction.class.getClassLoader()); List<Type> inputTypes = getInputTypes(valueType, arity); QuantileDigestStateSerializer stateSerializer = new QuantileDigestStateSerializer(valueType); Type intermediateType = stateSerializer.getSerializedType(); AggregationMetadata metadata = new AggregationMetadata( generateAggregationName(NAME, outputType.getTypeSignature(), inputTypes.stream().map(Type::getTypeSignature).collect(toImmutableList())), createInputParameterMetadata(inputTypes), getMethodHandle(valueType, arity), COMBINE_FUNCTION, OUTPUT_FUNCTION.bindTo(stateSerializer), ImmutableList.of(new AccumulatorStateDescriptor( QuantileDigestState.class, stateSerializer, new QuantileDigestStateFactory())), outputType); GenericAccumulatorFactoryBinder factory = AccumulatorCompiler.generateAccumulatorFactoryBinder(metadata, classLoader); return new InternalAggregationFunction(NAME, inputTypes, ImmutableList.of(intermediateType), outputType, true, true, factory); }
Source:
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { if (menu.findItem(16) == null) { menu.add(Menu.NONE, 16, Menu.NONE, "Cloze deletion"); return true; } else { return false; } }

Target:
public boolean onPrepareActionMode(ActionMode mode, Menu menu) { if (menu.findItem(mMenuId) == null) { menu.add(Menu.NONE, mMenuId, Menu.NONE, R.string.multimedia_editor_popup_cloze); return true; } else { return false; } }
Source:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode deployment = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final boolean isEnabled = ENABLED.resolveModelAttribute(context, deployment).asBoolean(); final String runtimeName = RUNTIME_NAME.resolveModelAttribute(context, deployment).asString(); context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) { final ModelNode result = context.getResult(); if (!isEnabled) { result.set(AbstractDeploymentUnitService.DeploymentStatus.STOPPED.toString()); } else { final ServiceController<?> controller = context.getServiceRegistry(false).getService(Services.deploymentUnitName(runtimeName)); if (controller != null) { if (controller.getState() == ServiceController.State.DOWN) { result.set(AbstractDeploymentUnitService.DeploymentStatus.STOPPED.toString()); } else { result.set(((AbstractDeploymentUnitService) controller.getService()).getStatus().toString()); } } else { result.set(NO_METRICS); } } } }, OperationContext.Stage.RUNTIME); }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode deployment = context.readResource(PathAddress.EMPTY_ADDRESS).getModel(); final boolean isEnabled = ENABLED.resolveModelAttribute(context, deployment).asBoolean(); final String runtimeName = RUNTIME_NAME.resolveModelAttribute(context, deployment).asString(); context.addStep(new OperationStepHandler() { @Override public void execute(final OperationContext context, final ModelNode operation) { final ModelNode result = context.getResult(); if (!isEnabled) { result.set(AbstractDeploymentUnitService.DeploymentStatus.STOPPED.toString()); } else { final ServiceController<?> controller = context.getServiceRegistry(false).getService(Services.deploymentUnitName(runtimeName)); if (controller != null) { if (controller.getState() == ServiceController.State.DOWN && controller.getUnavailableDependencies().size() == 0) { result.set(AbstractDeploymentUnitService.DeploymentStatus.STOPPED.toString()); } else { result.set(((AbstractDeploymentUnitService) controller.getService()).getStatus().toString()); } } else { result.set(NO_METRICS); } } } }, OperationContext.Stage.RUNTIME); }
Source:
public ValidationResult isAnyDomainInProcess() { List<StoragePoolIsoMap> poolIsoMaps = getStoragePoolIsoMapDao().getAllForStoragePool(storagePool.getId()); for (StoragePoolIsoMap domainIsoMap : poolIsoMaps) { if (domainIsoMap.getStatus() != null && domainIsoMap.getStatus().isStorageDomainInProcess()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2, String.format("$status %1$s", StorageDomainStatus.Locked)); } } return ValidationResult.VALID; }

Target:
public ValidationResult isAnyDomainInProcess() { List<StoragePoolIsoMap> poolIsoMaps = getStoragePoolIsoMapDao().getAllForStoragePool(storagePool.getId()); for (StoragePoolIsoMap domainIsoMap : poolIsoMaps) { if (domainIsoMap.getStatus() != null && domainIsoMap.getStatus().isStorageDomainInProcess()) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2, String.format("$status %1$s", domainIsoMap.getStatus())); } } return ValidationResult.VALID; }
Source:
private void removeImage() { RemoveImageParameters removeImageParams = new RemoveImageParameters(getParameters().getImageId()); removeImageParams.setStorageDomainId(getParameters().getSourceDomainId().getValue()); removeImageParams.setEntityId(new ImageStorageDomainMapId(getParameters().getImageId(), getParameters().getSourceDomainId().getValue())); removeImageParams.setParentCommand(VdcActionType.RemoveImage); removeImageParams.setPerformDbOperationsStage(PerformOperationStage.NEVER); VdcReturnValueBase returnValue = Backend.getInstance().runInternalAction( VdcActionType.RemoveImage, removeImageParams, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (returnValue.getSucceeded()) { startPollingAsyncTasks(returnValue.getInternalTaskIdList()); } else { addAuditLogOnRemoveFailue(); } }

Target:
private void removeImage() { RemoveImageParameters removeImageParams = new RemoveImageParameters(getParameters().getImageId()); removeImageParams.setStorageDomainId(getParameters().getSourceDomainId().getValue()); removeImageParams.setEntityId(new ImageStorageDomainMapId(getParameters().getImageId(), getParameters().getSourceDomainId().getValue())); removeImageParams.setParentCommand(VdcActionType.RemoveImage); removeImageParams.setPerformDbOperationsStage(PerformOperationsStage.NEVER); VdcReturnValueBase returnValue = getBackend().runInternalAction( VdcActionType.RemoveImage, removeImageParams, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (returnValue.getSucceeded()) { startPollingAsyncTasks(returnValue.getInternalTaskIdList()); } else { addAuditLogOnRemoveFailue(); } }
Source:
protected List<Class<?>> discoverServices(Class<?> klass) { final List<Class<?>> serviceClasses = new ArrayList<>(); try { final Enumeration<URL> resources = getClassLoader().getResources("META-INF/services/" + klass.getName()); while (resources.hasMoreElements()) { final URL url = resources.nextElement(); try (InputStream input = url.openStream(); InputStreamReader streamReader = new InputStreamReader(input, StandardCharsets.UTF_8); BufferedReader reader = new BufferedReader(streamReader)) { String line; while ((line = reader.readLine()) != null) { if (!line.startsWith("#")) { final Class<?> loadedClass = loadClass(line); if (loadedClass != null) { serviceClasses.add(loadedClass); } } else { LOGGER.debug("Line began with a comment. Ignoring"); } } } } } catch (IOException e) { LOGGER.warn("Unable to load META-INF/services/{}", klass.getName(), e); } return serviceClasses; }

Target:
protected List<Class<?>> discoverServices(Class<?> klass) { final List<Class<?>> serviceClasses = new ArrayList<>(); try { final Enumeration<URL> resources = getClassLoader().getResources("META-INF/services/" + klass.getName()); while (resources.hasMoreElements()) { final URL url = resources.nextElement(); try (InputStream input = url.openStream(); InputStreamReader streamReader = new InputStreamReader(input, StandardCharsets.UTF_8); BufferedReader reader = new BufferedReader(streamReader)) { String line; while ((line = reader.readLine()) != null) { if (!line.startsWith("#")) { final Class<?> loadedClass = loadClass(line); if (loadedClass != null) { serviceClasses.add(loadedClass); } } } } } } catch (IOException e) { LOGGER.warn("Unable to load META-INF/services/{}", klass.getName(), e); } return serviceClasses; }
Source:
private Command selectCommand( Project project ) { return () -> { if ( hasAccessToPerspective( PerspectiveIds.AUTHORING ) ) { libraryBreadcrumbs.setupAuthoringBreadCrumbsForProject( project.getProjectName() ); placeManager.goTo( new DefaultPlaceRequest( PerspectiveIds.AUTHORING ) ); libraryContextSwitchEvent .fire( new LibraryContextSwitchEvent( LibraryContextSwitchEvent.EventType.PROJECT_SELECTED, project.getIdentifier() ) ); } else { InfoPopup.generate( ts.getTranslation( LibraryConstants.Error_NoAccessRights ) ); } }; }

Target:
private Command selectCommand( Project project ) { return () -> { if ( hasAccessToPerspective( PerspectiveIds.AUTHORING ) ) { libraryBreadcrumbs.setupAuthoringBreadCrumbsForProject( project.getProjectName() ); placeManager.goTo( new DefaultPlaceRequest( PerspectiveIds.AUTHORING ) ); libraryContextSwitchEvent .fire( new LibraryContextSwitchEvent( LibraryContextSwitchEvent.EventType.PROJECT_SELECTED, project.getIdentifier() ) ); } else { view.noRightsPopup(); } }; }
Source:
protected void kill() { super.kill(); closeChannel(); IOUtils.closeQuietly(log); try { Util.deleteRecursive(getLogFile().getParentFile()); } catch (IOException ex) { logger.log(Level.WARNING, "Unable to delete slave logs", ex); } }

Target:
protected void kill() { super.kill(); closeChannel(); IOUtils.closeQuietly(log); try { Util.deleteRecursive(getLogDir()); } catch (IOException ex) { logger.log(Level.WARNING, "Unable to delete slave logs", ex); } }
Source:
static <T1, T2, T3> Tuple3<Seq<T1>, Seq<T2>, Seq<T3>> sequence3(Iterable<? extends Tuple3<? extends T1, ? extends T2, ? extends T3>> tuples) { Objects.requireNonNull(tuples, "tuples is null"); return new Tuple3<>(Stream.ofAll(tuples).map(Tuple3::_1), Stream.ofAll(tuples).map(Tuple3::_2), Stream.ofAll(tuples).map(Tuple3::_3)); }

Target:
static <T1, T2, T3> Tuple3<Seq<T1>, Seq<T2>, Seq<T3>> sequence3(Iterable<? extends Tuple3<? extends T1, ? extends T2, ? extends T3>> tuples) { Objects.requireNonNull(tuples, "tuples is null"); final Stream<Tuple3<? extends T1, ? extends T2, ? extends T3>> s = Stream.ofAll(tuples); return new Tuple3<>(s.map(Tuple3::_1), s.map(Tuple3::_2), s.map(Tuple3::_3)); }
Source:
public UserInfo findUserByCredentials(@Nullable WebContext ctx, String user, String password) { if (Strings.isEmpty(password)) { return null; } UserInfo result = findUserByName(ctx, user); if (result == null) { auditLog.negative("AuditLog.lockedOrNonexitentUserTriedLogin").forUser(null, user).log(); return null; } U account = result.getUserObject(getUserClass()); if (account.getUserAccountData().isExternalLoginRequired() && !isWithinInterval(account.getUserAccountData() .getLogin() .getLastExternalLogin(), account.getTenant() .getValue() .getTenantData() .getExternalLoginIntervalDays())) { completeAuditLogForUser(auditLog.negative("AuditLog.externalLoginRequired"), account); throw Exceptions.createHandled().withNLSKey("UserAccount.externalLoginMustBePerformed").handle(); } LoginData loginData = account.getUserAccountData().getLogin(); if (acceptApiTokens && Strings.areEqual(password, loginData.getApiToken())) { completeAuditLogForUser(auditLog.neutral("AuditLog.apiTokenLogin"), account); return result; } LoginData.PasswordVerificationResult pwResult = loginData.checkPassword(password); if (pwResult != LoginData.PasswordVerificationResult.INVALID) { completeAuditLogForUser(auditLog.neutral("AuditLog.passwordLogin"), account); if (pwResult == LoginData.PasswordVerificationResult.VALID_NEEDS_RE_HASH) { return updatePasswordHashing(result, password); } return result; } completeAuditLogForUser(auditLog.negative("AuditLog.loginRejected"), account); return null; }

Target:
public UserInfo findUserByCredentials(@Nullable WebContext ctx, String user, String password) { if (Strings.isEmpty(password)) { return null; } UserInfo result = findUserByName(ctx, user); if (result == null) { auditLog.negative("AuditLog.lockedOrNonexitentUserTriedLogin").forUser(null, user).log(); return null; } U account = result.getUserObject(getUserClass()); if (account.getUserAccountData().isExternalLoginRequired() && !isWithinInterval(account.getUserAccountData() .getLogin() .getLastExternalLogin(), account.getTenant() .getValue() .getTenantData() .getExternalLoginIntervalDays())) { completeAuditLogForUser(auditLog.negative("AuditLog.externalLoginRequired"), account); throw Exceptions.createHandled().withNLSKey("UserAccount.externalLoginMustBePerformed").handle(); } LoginData loginData = account.getUserAccountData().getLogin(); if (acceptApiTokens && Strings.areEqual(password, loginData.getApiToken())) { completeAuditLogForUser(auditLog.neutral("AuditLog.apiTokenLogin"), account); return result; } LoginData.PasswordVerificationResult pwResult = loginData.checkPassword(user, password); if (pwResult != LoginData.PasswordVerificationResult.INVALID) { completeAuditLogForUser(auditLog.neutral("AuditLog.passwordLogin"), account); if (pwResult == LoginData.PasswordVerificationResult.VALID_NEEDS_RE_HASH) { return updatePasswordHashing(result, password); } return result; } auditLog.negative("AuditLog.loginRejected") .forTenant(String.valueOf(account.getTenant().getId()), account.getTenant().getValue().getTenantData().getName()) .log(); return null; }
Source:
private ActionEventRequest buildCreateEncounterAction(String configName) { SortedSet<ActionParameterRequest> actionParameters = new TreeSet<>(); int order = 0; String serviceMethod = "createEncounter"; actionParameters.add(prepareParameter(Keys.CONFIG_NAME, DisplayNames.CONFIG_NAME, configName, true, true, order++)); actionParameters.add(prepareParameter(Keys.ENCOUNTER_DATE, DisplayNames.ENCOUNTER_DATE, DATE, true, order++)); actionParameters.add(prepareParameter(Keys.ENCOUNTER_TYPE, DisplayNames.ENCOUNTER_TYPE, true, order++)); actionParameters.add(prepareParameter(Keys.LOCATION_NAME, DisplayNames.LOCATION_NAME, false, order++)); actionParameters.add(prepareParameter(Keys.PATIENT_UUID, DisplayNames.PATIENT_UUID, true, order++)); actionParameters.add(prepareParameter(Keys.PROVIDER_UUID, DisplayNames.PROVIDER_UUID, true, order++)); actionParameters.add(prepareParameter(Keys.OBSERVATION, DisplayNames.OBSERVATION, MAP, false, order)); return new ActionEventRequestBuilder() .setDisplayName(getDisplayName(CREATE_ENCOUNTER, configName)) .setServiceInterface(OPENMRS_ACTION_PROXY_SERVICE) .setServiceMethod(serviceMethod) .setSubject(serviceMethod + "." + configName) .setActionParameters(actionParameters) .createActionEventRequest(); }

Target:
private ActionEventRequest buildCreateEncounterAction(String configName) { SortedSet<ActionParameterRequest> actionParameters = new TreeSet<>(); int order = 0; String serviceMethod = "createEncounter"; actionParameters.add(prepareParameter(Keys.CONFIG_NAME, DisplayNames.CONFIG_NAME, configName, true, true, order++)); actionParameters.add(prepareParameter(Keys.ENCOUNTER_DATE, DisplayNames.ENCOUNTER_DATE, DATE, true, order++)); actionParameters.add(prepareParameter(Keys.ENCOUNTER_TYPE, DisplayNames.ENCOUNTER_TYPE, true, order++)); actionParameters.add(prepareParameter(Keys.LOCATION_NAME, DisplayNames.LOCATION_NAME, false, order++)); actionParameters.add(prepareParameter(Keys.PATIENT_UUID, DisplayNames.PATIENT_UUID, true, order++)); actionParameters.add(prepareParameter(Keys.PROVIDER_UUID, DisplayNames.PROVIDER_UUID, true, order++)); actionParameters.add(prepareParameter(Keys.OBSERVATION, DisplayNames.OBSERVATION, MAP, false, order)); return new ActionEventRequestBuilder() .setDisplayName(getDisplayName(CREATE_ENCOUNTER, configName)) .setServiceInterface(OPENMRS_ACTION_PROXY_SERVICE) .setServiceMethod(serviceMethod) .setSubject(getSubject(serviceMethod, configName)) .setActionParameters(actionParameters) .createActionEventRequest(); }
Source:
void logRenamedEntity() { if (getCurrentUser() != null && this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String oldEntityName = renameable.getEntityOldName(); String newEntityName = renameable.getEntityNewName(); if (!StringUtils.equals(oldEntityName, newEntityName)) { AuditLogable logable = new AuditLogableImpl(); String entityType = renameable.getEntityType(); logable.addCustomValue("EntityType", entityType); logable.addCustomValue("OldEntityName", oldEntityName); logable.addCustomValue("NewEntityName", newEntityName); logable.addCustomValue("UserName", getCurrentUser().getLoginName()); renameable.setEntityId(logable); auditLog(logable, AuditLogType.ENTITY_RENAMED); } } }

Target:
void logRenamedEntity() { if (this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String oldEntityName = renameable.getEntityOldName(); String newEntityName = renameable.getEntityNewName(); if (!StringUtils.equals(oldEntityName, newEntityName)) { AuditLogable logable = new AuditLogableImpl(); String entityType = renameable.getEntityType(); logable.addCustomValue("EntityType", entityType); logable.addCustomValue("OldEntityName", oldEntityName); logable.addCustomValue("NewEntityName", newEntityName); if (getCurrentUser() != null) { logable.addCustomValue("UserName", getCurrentUser().getLoginName()); } renameable.setEntityId(logable); auditLog(logable, getCurrentUser() != null ? AuditLogType.ENTITY_RENAMED : AuditLogType.ENTITY_RENAMED_INTERNALLY); } } }
Source:
private void runStoragePoolUpEvent(final StoragePool storagePool) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { if (DbFacade.getInstance().getStorageDomainDao(). getStorageDomains(_storagePoolId, StorageDomainType.Master).stream() .anyMatch(d -> d.getStatus() == StorageDomainStatus.Active || d.getStatus() == StorageDomainStatus.Unknown)) { ResourceManager.getInstance() .getEventListener() .storagePoolUpEvent(storagePool); } } catch (RuntimeException exp) { log.error("Error in StoragePoolUpEvent: {}", exp.getMessage()); log.debug("Exception", exp); } } }); }

Target:
private void runStoragePoolUpEvent(final StoragePool storagePool) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { if (isMasterDomainUp()) { ResourceManager.getInstance() .getEventListener() .storagePoolUpEvent(storagePool); } } catch (RuntimeException exp) { log.error("Error in StoragePoolUpEvent: {}", exp.getMessage()); log.debug("Exception", exp); } } private boolean isMasterDomainUp() { return DbFacade.getInstance().getStorageDomainDao(). getStorageDomains(_storagePoolId, StorageDomainType.Master).stream() .anyMatch(d -> d.getStatus() == StorageDomainStatus.Active || d.getStatus() == StorageDomainStatus.Unknown); } }); }
Source:
public static DataStoreRole getDataStoreRole(Snapshot snapshot, SnapshotDataStoreDao snapshotStoreDao, DataStoreManager dataStoreMgr) { SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary); if (snapshotStore == null) { return DataStoreRole.Image; } long storagePoolId = snapshotStore.getDataStoreId(); if (! snapshotStore.getState().equals(ObjectInDataStoreStateMachine.State.Destroyed)){ DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = new Boolean(value); if (supportsStorageSystemSnapshots) { return DataStoreRole.Primary; } } } return DataStoreRole.Image; }

Target:
public static DataStoreRole getDataStoreRole(Snapshot snapshot, SnapshotDataStoreDao snapshotStoreDao, DataStoreManager dataStoreMgr) { SnapshotDataStoreVO snapshotStore = snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary); if (snapshotStore == null) { return DataStoreRole.Image; } long storagePoolId = snapshotStore.getDataStoreId(); if (snapshotStore.getState() != null && ! snapshotStore.getState().equals(ObjectInDataStoreStateMachine.State.Destroyed)) { DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary); Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = Boolean.valueOf(value); if (supportsStorageSystemSnapshots) { return DataStoreRole.Primary; } } } return DataStoreRole.Image; }
Source:
public void afterCompletion(final MessageContext messageContext, final Exception ex) { LOGGER.debug("In after completion."); if (ex != null && ex instanceof IOException) { LOGGER.warn("An IOException occurred, indicate failure to the circuit breaker."); this.circuitBreaker.markFailure(); } }

Target:
public void afterCompletion(final MessageContext messageContext, final Exception ex) { LOGGER.debug("In after completion."); if (ex instanceof IOException) { LOGGER.warn("An IOException occurred, indicate failure to the circuit breaker."); this.circuitBreaker.markFailure(); } }
Source:
public static void shutdownModules(ServletContext servletContext) { String realPath = getRealPath(servletContext); String messagesPath = Paths.get(realPath,"WEB-INF").toString(); File folder = new File(messagesPath); File[] files = folder.listFiles(); if (folder.exists() && files != null) { Properties emptyProperties = new Properties(); for (File f : files) { if (f.getName().startsWith("module_messages")) { OpenmrsUtil.storeProperties(emptyProperties, f, ""); } } } for (Module mod : ModuleFactory.getLoadedModules()) { stopModule(mod, servletContext, true); } }

Target:
public static void shutdownModules(ServletContext servletContext) { String realPath = getRealPath(servletContext); File folder = Paths.get(realPath,"WEB-INF").toFile(); File[] files = folder.listFiles(); if (folder.exists() && files != null) { Properties emptyProperties = new Properties(); for (File f : files) { if (f.getName().startsWith("module_messages")) { OpenmrsUtil.storeProperties(emptyProperties, f, ""); } } } for (Module mod : ModuleFactory.getLoadedModules()) { stopModule(mod, servletContext, true); } }
Source:
public List<Task> findActiveTasksForTriggerSubject(final String subject) { List<Task> list = null; if (isNotBlank(subject)) { List enabledTasks = tasksDataService.executeQuery(new QueryExecution<List<Task>>() { @Override public List<Task> execute(Query query, InstanceSecurityRestriction restriction) { String byTriggerSubject = "trigger.subject == param"; String isTaskActive = "enabled == true"; String isNotUsingTimeWindow = "useTimeWindow != true"; String now = (new Time(LocalTime.now(DateTimeZone.UTC))).toString(); String isAfterStartTime = String.format("startTime < \"%s\"", now); String isBeforeEndTime = String.format("endTime > \"%s\"", now); String isEndTimeNextDay = "endTime < startTime"; String isBetweenStartTimeAndMidnight = String.format("(%s) && (\"24:00\" > \"%s\")", isAfterStartTime, now); String isBetweenMidnightAndEndTime = String.format("(%s) && (\"00:00\" < \"%s\")", isBeforeEndTime, now); String isInTimeWindow = String.format("(%s) || ((%s) && (%s)) || ((%s) && ((%s) || (%s)))", isNotUsingTimeWindow, isAfterStartTime, isBeforeEndTime, isEndTimeNextDay, isBetweenStartTimeAndMidnight, isBetweenMidnightAndEndTime); String filter = String.format("(%s) && (%s) && (%s)", isTaskActive, byTriggerSubject, isInTimeWindow); query.setFilter(filter); query.declareParameters("java.lang.String param"); query.setOrdering("id asc"); return (List) QueryExecutor.execute(query, subject, restriction); } }); if (enabledTasks != null) { checkChannelAvailableInTasks(enabledTasks); list = new ArrayList<>(enabledTasks); CollectionUtils.filter(list, tasksWithRegisteredChannel()); } } return list == null ? new ArrayList<>() : list; }

Target:
public List<Task> findActiveTasksForTriggerSubject(final String subject) { List<Task> list = null; if (isNotBlank(subject)) { List enabledTasks = tasksDataService.executeQuery(new QueryExecution<List<Task>>() { @Override public List<Task> execute(Query query, InstanceSecurityRestriction restriction) { String byTriggerSubject = "trigger.subject == param"; String isTaskActive = "enabled == true"; String filter = String.format("(%s) && (%s)", isTaskActive, byTriggerSubject); query.setFilter(filter); query.declareParameters("java.lang.String param"); query.setOrdering("id asc"); return (List) QueryExecutor.execute(query, subject, restriction); } }); if (enabledTasks != null) { checkChannelAvailableInTasks(enabledTasks); list = checkTimeWindowInTasks(enabledTasks); CollectionUtils.filter(list, tasksWithRegisteredChannel()); } } return list == null ? new ArrayList<>() : list; }