auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean checkClientSecret(final OAuthRegisteredService registeredService, final String clientSecret) { LOGGER.debug("Found: in secret check", registeredService); final String registeredServiceClientSecret = registeredService.getClientSecret(); final boolean isClientSecretNeeded = ( "".equals(registeredServiceClientSecret) )? false : true; if (isClientSecretNeeded && !StringUtils.equals(registeredServiceClientSecret, clientSecret)) { LOGGER.error("Wrong client secret for service: [{}]", registeredService); return false; } return true; }

Target:
public boolean checkClientSecret(final OAuthRegisteredService registeredService, final String clientSecret) { LOGGER.debug("Found: in secret check", registeredService); if (StringUtils.isNotBlank(registeredService.getClientSecret()) && !StringUtils.equals(registeredService.getClientSecret(), clientSecret)) { LOGGER.error("Wrong client secret for service: [{}]", registeredService); return false; } return true; }
Source:
protected boolean set(EntityArmorStand container, Vector3d value) { container.getDataWatcher().updateObject(16, VecHelper.toRotation(value)); return true; }

Target:
protected boolean set(EntityArmorStand container, Vector3d value) { container.setRightLegRotation(VecHelper.toRotation(value)); return true; }
Source:
public static boolean isGerritVersion(String verString) { return verString != null && GERRIT_SSHD_REPLY.matcher(verString).matches(); }

Target:
static boolean isGerritVersion(String verString) { return verString != null && GERRIT_SSHD_REPLY.matcher(verString).matches(); }
Source:
public void writeRepositoryConfigFile() { if (repositoryConfigurationFile != null) { try (ObjectOutputStream out = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(repositoryConfigurationFile)))) { Set<RepositoryConfiguration> tempConfigs; synchronized (repositoryConfigurations) { tempConfigs = new HashSet<RepositoryConfiguration>(repositoryConfigurations.values()); } if (tempConfigs.size() > 0) { out.writeInt(tempConfigs.size()); for (RepositoryConfiguration repositoryConfiguration : tempConfigs) { if (repositoryConfiguration != null) { out.writeObject(repositoryConfiguration); } } } } catch (IOException e) { StatusHandler.log(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, 0, "Failed to write repository configuration cache", e)); } } }

Target:
public void writeRepositoryConfigFile() { if (repositoryConfigurationFile != null) { try { Set<RepositoryConfiguration> tempConfigs; synchronized (repositoryConfigurations) { tempConfigs = new HashSet<RepositoryConfiguration>(repositoryConfigurations.values()); } if (tempConfigs.size() > 0) { try (ObjectOutputStream out = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(repositoryConfigurationFile)))) { out.writeInt(tempConfigs.size()); for (RepositoryConfiguration repositoryConfiguration : tempConfigs) { if (repositoryConfiguration != null) { out.writeObject(repositoryConfiguration); } } } } } catch (IOException e) { StatusHandler.log(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN, 0, "Failed to write repository configuration cache", e)); } } }
Source:
private <T> Key.ComplexKey addObjects(T... keys) { if (!canAddKeys) { throw new IllegalArgumentException("Can't add keys after EndKey has been added"); } for (T key : keys) { json.add(gson.toJsonTree(key)); } return this; }

Target:
private <T> Key.ComplexKey addObjects(T... keys) { if (!canAddKeys) { throw new IllegalStateException("Cannot add keys after addHighSentinel() has been called"); } for (T key : keys) { json.add(gson.toJsonTree(key)); } return this; }
Source:
public void validateQueryStringAndGiveColorFeedback(TextField querySource, String queryString) { Matcher queryValidation = queryPattern.matcher(queryString.strip()); if (queryValidation.matches()) { if (containsYearAndYearRange(queryString)) { querySource.setStyle("-fx-background-color: rgba(240, 128, 128, 0.5);"); querySource.setTooltip(new Tooltip(Localization.lang("The query cannot contain a year and year-range field."))); } else { querySource.setStyle("-fx-background-color: rgba(50, 205, 50, 0.5);"); querySource.setTooltip(new Tooltip(Localization.lang("This search contains entries that match all specified terms."))); } } else { querySource.setStyle("-fx-background-color: rgba(240, 128, 128, 0.5);"); querySource.setTooltip(new Tooltip(Localization.lang("This query uses an unsupported syntax."))); } }

Target:
public void validateQueryStringAndGiveColorFeedback(TextField querySource, String queryString) { Matcher queryValidation = queryPattern.matcher(queryString.strip()); if (!queryString.strip().isBlank() && !queryValidation.matches()) { Matcher laxQueryValidation = laxQueryPattern.matcher(queryString.strip()); if (laxQueryValidation.matches()) { setPseudoClassToUnsupported(querySource); querySource.setTooltip(new Tooltip(Localization.lang("This query uses unsupported fields."))); } else { setPseudoClassToInvalid(querySource); querySource.setTooltip(new Tooltip(Localization.lang("This query uses unsupported syntax."))); } } else if (containsYearAndYearRange(queryString)) { setPseudoClassToInvalid(querySource); querySource.setTooltip(new Tooltip(Localization.lang("The query cannot contain a year and year-range field."))); } else { setPseudoClassToValid(querySource); } }
Source:
private boolean isEnrollLink(String strUrl) { if (actionListener != null && strUrl != null && strUrl.startsWith(URL_TYPE_ENROLL)) { Uri uri = Uri.parse(strUrl); String query = uri.getQuery(); if (query != null) { query = query.trim(); String[] params = query.split("&"); Map<String, String> queryParams = new HashMap<>(); for (String q : params) { int equalsIndex = q.indexOf('='); if (equalsIndex <= 0) { queryParams.put(q, null); } else { String key = q.substring(0, equalsIndex); String value = equalsIndex < q.length() - 1 ? q.substring(equalsIndex + 1) : null; queryParams.put(key, value); } } String courseId = queryParams.get("course_id"); if (courseId != null) { boolean emailOptIn = Boolean.parseBoolean(queryParams.get("email_opt_in")); actionListener.onClickEnroll(courseId, emailOptIn); logger.debug("found enroll URL: " + strUrl); return true; } } } return false; }

Target:
private boolean isEnrollLink(String strUrl) { if (actionListener != null && strUrl != null && strUrl.startsWith(URL_TYPE_ENROLL)) { Uri uri = Uri.parse(strUrl); String courseId = uri.getQueryParameter("course_id"); if (courseId != null) { boolean emailOptIn = Boolean.parseBoolean(uri.getQueryParameter("email_opt_in")); actionListener.onClickEnroll(courseId, emailOptIn); logger.debug("found enroll URL: " + strUrl); return true; } } return false; }
Source:
public static void start() { synchronized (lock) { if (forklift != null && forklift.isRunning()) return; try { activemq = new BrokerService(); activemq.addConnector("tcp://127.0.0.1:61618"); activemq.setDataDirectoryFile(Files.createTempDir()); activemq.start(); System.out.println("HEY" + activemq.getDataDirectoryFile()); connector = new ActiveMQConnector(brokerUrl); connector.start(); forklift = new Forklift(); forklift.start(connector); count++; } catch (Throwable e) { e.printStackTrace(); } } }

Target:
public static void start() { synchronized (lock) { if (forklift != null && forklift.isRunning()) return; try { activemq = new BrokerService(); activemq.addConnector("tcp://127.0.0.1:61618"); activemq.setDataDirectoryFile(Files.createTempDir()); activemq.start(); connector = new ActiveMQConnector(brokerUrl); connector.start(); forklift = new Forklift(); forklift.start(connector); count++; } catch (Throwable e) { e.printStackTrace(); } } }
Source:
private void initCoordinator(Process p, AffinityTopologyVersion topVer) { Set<UUID> aliveSrvNodesIds = new HashSet<>(); for (ClusterNode node : ctx.discovery().serverNodes(topVer)) { if (ctx.discovery().alive(node)) aliveSrvNodesIds.add(node.id()); } synchronized (mux) { if (p.initCrdFut.isDone()) return; assert p.remaining.isEmpty(); p.remaining.addAll(aliveSrvNodesIds); p.initCrdFut.onDone(); } }

Target:
private void initCoordinator(Process p, AffinityTopologyVersion topVer) { synchronized (mux) { if (p.initCrdFut.isDone()) return; assert p.remaining.isEmpty(); p.remaining.addAll(F.viewReadOnly(ctx.discovery().serverNodes(topVer), F.node2id())); p.initCrdFut.onDone(); } }
Source:
public void validate(final T credentials) { try { final UserProfile profile = this.cache.get(credentials, new Callable<UserProfile>() { @Override public UserProfile call() throws Exception { logger.debug("Delegating authentication to {}...", delegate); delegate.validate(credentials); final UserProfile profile = credentials.getUserProfile(); logger.debug("Cached authentication result"); return profile; } }); credentials.setUserProfile(profile); logger.debug("Found cached credential. Using cached profile {}...", profile); } catch (final Exception e) { throw new TechnicalException(e); } }

Target:
public void validate(final T credentials) { try { final UserProfile profile = this.cache.get(credentials); credentials.setUserProfile(profile); logger.debug("Found cached credential. Using cached profile {}...", profile); } catch (Exception e) { throw new CredentialsException(e); } }
Source:
public void TestRoadblock_001( String wikiName, String article, String screenImageUrl, Dimension windowResolution, int skinWidth, String skinLeftSide, String skinRightSide ) { String testedPage = urlBuilder.getUrlForPath(wikiName, article); AdsBaseObject wikiPage = new AdsBaseObject(driver, testedPage, windowResolution); wikiPage.verifyRoadblockServedAfterMultiplePageViews( testedPage, screenImageUrl, windowResolution, skinWidth, skinLeftSide, skinRightSide, 3 ); }

Target:
public void TestRoadblock_001( String wikiName, String article, String screenImageUrl, Dimension windowResolution, int skinWidth, String skinLeftSide, String skinRightSide ) { String testedPage = urlBuilder.getUrlForPath(wikiName, article); AdsBaseObject wikiPage = new AdsBaseObject(driver, testedPage, windowResolution); wikiPage.verifyRoadblockServedAfterMultiplePageViews( testedPage, screenImageUrl, windowResolution, skinWidth, skinLeftSide, skinRightSide, pageViewsCount ); }
Source:
private Optional<Resource> getRawResource(String id) { if (isEmpty(id)) { throw new IllegalArgumentException("Resource id must be not null"); } IspnResource ispnResource = (IspnResource) resource.get(id); return Optional.ofNullable(ispnResource == null ? null : ispnResource.getResource()); }

Target:
private Optional<Resource> getRawResource(String id) { if (isEmpty(id)) { throw new IllegalArgumentException("Resource id must be not null"); } return Optional.ofNullable((IspnResource) resource.get(id)).map(IspnResource::getResource); }
Source:
public int nextBatch() throws IOException { filePosition += currentBatchSize; currentPosition += currentBatchSize; if (nextRowInGroup >= currentGroupRowCount) { if (!advanceToNextRowGroup()) { filePosition = fileRowCount; currentPosition = totalRowCount; return -1; } } currentBatchSize = toIntExact(min(nextBatchSize, min(maxBatchSize, currentGroupRowCount - nextRowInGroup))); for (StreamReader column : streamReaders) { if (column != null) { column.prepareNextRead(currentBatchSize); } } nextRowInGroup += currentBatchSize; nextBatchSize = currentBatchSize * BATCH_SIZE_GROWTH_FACTOR; validateWritePageChecksum(); return currentBatchSize; }

Target:
public int nextBatch() throws IOException { filePosition += currentBatchSize; currentPosition += currentBatchSize; if (nextRowInGroup >= currentGroupRowCount) { if (!advanceToNextRowGroup()) { filePosition = fileRowCount; currentPosition = totalRowCount; return -1; } } currentBatchSize = toIntExact(min(nextBatchSize, maxBatchSize)); nextBatchSize = min(currentBatchSize * BATCH_SIZE_GROWTH_FACTOR, MAX_BATCH_SIZE); currentBatchSize = toIntExact(min(currentBatchSize, currentGroupRowCount - nextRowInGroup)); for (StreamReader column : streamReaders) { if (column != null) { column.prepareNextRead(currentBatchSize); } } nextRowInGroup += currentBatchSize; validateWritePageChecksum(); return currentBatchSize; }
Source:
public String resolve(HttpRequest request) { String path = request.getURI().getPath(); return path != null ? path : ""; }

Target:
public String resolve(HttpRequest request) { return request.getMethod().name(); }
Source:
private boolean isResourceNamespaced(JDefinedClass resourceClass) { switch (resourceClass.name()) { case "MutatingWebhookConfiguration": case "ValidatingWebhookConfiguration": case "CustomResourceDefinition": case "ComponentStatus": case "Namespace": case "Node": case "PersistentVolume": case "PodSecurityPolicy": case "ClusterRoleBinding": case "ClusterRole": case "PriorityClass": case "StorageClass": return false; default: return true; } }

Target:
private boolean isResourceNamespaced(JDefinedClass resourceClass) { return !NON_NAMESPACED_RESOURCES.contains(resourceClass.name()); }
Source:
private String createViolationMessage(org.codenarc.rule.Violation codeNarcViolation, Rule rule) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(rule.getName()); if (codeNarcViolation.getMessage() != null) { stringBuilder.append(": ").append(codeNarcViolation.getMessage()); } return stringBuilder.toString(); }

Target:
private String createViolationMessage(org.codenarc.rule.Violation codeNarcViolation, Rule rule) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(rule.getName()); if (StringUtils.isNotBlank(codeNarcViolation.getMessage())) { stringBuilder.append(": ").append(codeNarcViolation.getMessage()); } return stringBuilder.toString(); }
Source:
public boolean performDrop(Object data) { if (!this.rebaseInteractiveView.isDragAndDropEnabled()) return false; DropTargetEvent event = getCurrentEvent(); RebaseInteractivePlan.PlanElement sourceElement = null; if (event.data instanceof IStructuredSelection) { final IStructuredSelection structuredSelection = (IStructuredSelection) data; if (structuredSelection.size() > 1) return false; if (structuredSelection.getFirstElement() instanceof RebaseInteractivePlan.PlanElement) sourceElement = (RebaseInteractivePlan.PlanElement) structuredSelection .getFirstElement(); } if (sourceElement == null) return false; Object targetObj = getCurrentTarget(); if (!(targetObj instanceof RebaseInteractivePlan.PlanElement)) return false; RebaseInteractivePlan.PlanElement targetElement = (RebaseInteractivePlan.PlanElement) targetObj; boolean before = false; switch (getCurrentLocation()) { case ViewerDropAdapter.LOCATION_BEFORE: before = true; break; case ViewerDropAdapter.LOCATION_NONE: return false; } if (RebaseInteractivePreferences.isOrderReversed()) { before = !before; } rebaseInteractiveView.getCurrentPlan().moveTodoEntry(sourceElement, targetElement, before); return true; }

Target:
public boolean performDrop(Object data) { if (!this.rebaseInteractiveView.isDragAndDropEnabled()) return false; DropTargetEvent event = getCurrentEvent(); RebaseInteractivePlan.PlanElement sourceElement = null; if (event.data instanceof IStructuredSelection) { final IStructuredSelection structuredSelection = (IStructuredSelection) data; if (structuredSelection.size() > 1) return false; if (structuredSelection.getFirstElement() instanceof RebaseInteractivePlan.PlanElement) sourceElement = (RebaseInteractivePlan.PlanElement) structuredSelection .getFirstElement(); } if (sourceElement == null) return false; Object targetObj = getCurrentTarget(); if (!(targetObj instanceof RebaseInteractivePlan.PlanElement)) return false; RebaseInteractivePlan.PlanElement targetElement = (RebaseInteractivePlan.PlanElement) targetObj; boolean before = false; switch (getCurrentLocation()) { case ViewerDropAdapter.LOCATION_BEFORE: before = true; break; case ViewerDropAdapter.LOCATION_NONE: return false; } if (RebaseInteractivePreferences.isOrderReversed()) before = !before; rebaseInteractiveView.getCurrentPlan().moveTodoEntry(sourceElement, targetElement, before); return true; }
Source:
public void deleteFromIndex(RepositoryPath path) throws IOException { Repository repository = path.getFileSystem().getRepository(); if (!repositoryFeatures.isIndexingEnabled(repository) || isMetadata(path.toString())) { return; } final RepositoryIndexer indexer = getRepositoryIndexer(path); if (indexer != null) { String extension = FilenameUtils.getExtension(path.getFileName().toString()); MavenArtifactCoordinates coordinates = getArtifactCoordinates(path.toString()); indexer.delete(Collections.singletonList(new ArtifactInfo(repository.getId(), coordinates.getGroupId(), coordinates.getArtifactId(), coordinates.getVersion(), coordinates.getClassifier(), extension))); } }

Target:
public void deleteFromIndex(RepositoryPath path) throws IOException { Repository repository = path.getFileSystem().getRepository(); if (!repositoryFeatures.isIndexingEnabled(repository) || RepositoryFiles.isMetadata(path)) { return; } final RepositoryIndexer indexer = getRepositoryIndexer(path); if (indexer != null) { MavenArtifactCoordinates coordinates = (MavenArtifactCoordinates) RepositoryFiles.readCoordinates(path); indexer.delete(Collections.singletonList(new ArtifactInfo(repository.getId(), coordinates.getGroupId(), coordinates.getArtifactId(), coordinates.getVersion(), coordinates.getClassifier(), coordinates.getExtension()))); } }
Source:
public void nonReferencedObjects_onlyExpiredPruned() throws Exception { RevBlob a = tr.blob("a"); long start = now(); RevBlob b = tr.blob("b"); gc.setExpireAgeMillis(now() - start); gc.prune(Collections.<ObjectId> emptySet()); assertFalse(repo.hasObject(a)); assertTrue(repo.hasObject(b)); }

Target:
public void nonReferencedObjects_onlyExpiredPruned() throws Exception { RevBlob a = tr.blob("a"); fsTick(); long start = now(); fsTick(); RevBlob b = tr.blob("b"); gc.setExpireAgeMillis(now() - start); gc.prune(Collections.<ObjectId> emptySet()); assertFalse(repo.hasObject(a)); assertTrue(repo.hasObject(b)); }
Source:
TelescopeProxy(Process process) { this.process = process; TelescopeClientImpl client = TelescopeClientImpl.create(TelescopeConfiguration.TELESCOPE_HOST); if (client == null) { log.error( "Could not get a TelescopeClientImpl object with the given TELESCOPE_HOST={}", TelescopeConfiguration.TELESCOPE_HOST ); log.error( "This telescope proxy will not report to telescope, and will not print any further messages."); } else { this.telescopeClient = IngestTelescopeClientImpl.create(client); this.objectMapper = new ObjectMapper(); } }

Target:
TelescopeProxy(Process process) { this.process = process; TelescopeClientImpl client = TelescopeClientImpl.create(TelescopeFactory.TELESCOPE_HOST); if (client == null) { log.error( "Could not get a TelescopeClientImpl object with the given TELESCOPE_HOST={}", TelescopeFactory.TELESCOPE_HOST ); log.error( "This telescope proxy will not report to telescope, and will not print any further messages."); } else { this.telescopeClient = IngestTelescopeClientImpl.create(client); this.objectMapper = new ObjectMapper(); } }
Source:
private void installProject() throws Exception { if (isSupportedType(project.getPackaging())) { if (looseConfig) { switch(project.getPackaging()) { case "war": installLooseConfigApp(); break; case "liberty-assembly": File dir = new File(project.getBasedir() + "/src/main/webapp"); if (dir.exists()) { installLooseConfigApp(); } else { log.debug("liberty-assembly project does not have soruce code for web project."); } break; default: log.info("Can not generate loose configuration for Project artifact type. Project aritifact will be installed as is."); installApp(project.getArtifact()); break; } } else { installApp(project.getArtifact()); } } else { throw new MojoExecutionException("Application type is not supported," + project.getPackaging()); } }

Target:
private void installProject() throws Exception { if (isSupportedType(project.getPackaging())) { if (looseApplication) { switch(project.getPackaging()) { case "war": installLooseConfigApp(); break; case "liberty-assembly": File dir = new File(project.getBasedir() + "/src/main/webapp"); if (dir.exists()) { installLooseConfigApp(); } else { log.debug("liberty-assembly project does not have source code for web project."); } break; default: log.info(MessageFormat.format("Loose application configuration is not supported for packaging type {0}. The project artifact will be installed as is.", project.getPackaging())); installApp(project.getArtifact()); break; } } else { installApp(project.getArtifact()); } } else { throw new MojoExecutionException("Application type is not supported," + project.getPackaging()); } }
Source:
public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); softwareComponents = (SoftwareComponent[]) getArguments() .getParcelableArray(ARG_COMPONENTS); if (savedInstanceState != null) { Serializable license = savedInstanceState.getSerializable(LICENSE_KEY); if (license instanceof License) { activeLicense = (License) license; } } Arrays.sort(softwareComponents, (o1, o2) -> o1.getName().compareTo(o2.getName())); }

Target:
public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); softwareComponents = (SoftwareComponent[]) getArguments() .getParcelableArray(ARG_COMPONENTS); if (savedInstanceState != null) { final Serializable license = savedInstanceState.getSerializable(LICENSE_KEY); if (license != null) { activeLicense = (License) license; } } Arrays.sort(softwareComponents, (o1, o2) -> o1.getName().compareTo(o2.getName())); }
Source:
protected boolean shouldProcess(Map<String, String[]> requestParams) { for (String requiredParam : requiredParams) { if (StringUtils.isEmpty(getParameterValueOrNull(requiredParam, requestParams))) { return false; } } return typeToProcess == null || typeToProcess.equals(getParameterValueOrNull(PARAMETER_TYPE, requestParams)); }

Target:
protected boolean shouldProcess(Map<String, String[]> requestParams) { for (String requiredParam : requiredParams) { if (StringUtils.isEmpty(getParameterValueOrNull(requiredParam, requestParams))) { return false; } } if (typeToProcess.equals(TYPE_ALL)) { return true; } final String type = getParameterValueOrNull(ClientSpanServlet.PARAMETER_TYPE, requestParams); return typeToProcess.equals(type); }
Source:
public void initialize(Bootstrap<TimeLockServerConfiguration> bootstrap) { MetricRegistry metricRegistry = SharedMetricRegistries.getOrCreate("AtlasDbTest"); AtlasDbMetrics.setMetricRegistry(metricRegistry); bootstrap.setMetricRegistry(metricRegistry); bootstrap.getObjectMapper().registerSubtypes(NonBlockingFileAppenderFactory.class); bootstrap.getObjectMapper().registerModule(new Jdk8Module()); super.initialize(bootstrap); }

Target:
public void initialize(Bootstrap<TimeLockServerConfiguration> bootstrap) { MetricRegistry metricRegistry = SharedMetricRegistries .getOrCreate("AtlasDbTest" + UUID.randomUUID().toString()); TaggedMetricRegistry taggedMetricRegistry = new DefaultTaggedMetricRegistry(); AtlasDbMetrics.setMetricRegistries(metricRegistry, taggedMetricRegistry); bootstrap.setMetricRegistry(metricRegistry); bootstrap.getObjectMapper().registerSubtypes(NonBlockingFileAppenderFactory.class); bootstrap.getObjectMapper().registerModule(new Jdk8Module()); super.initialize(bootstrap); }
Source:
protected String match(Pattern re) { if (index >= input.length()) { return null; } try { Matcher matcher = re.matcher(input); matcher.region(index, input.length()); boolean m = matcher.find(); if (m) { index = matcher.end(); return matcher.group(); } else { return null; } } catch (Error e) { return null; } }

Target:
private String match(Pattern re) { if (index >= input.length()) { return null; } try { Matcher matcher = re.matcher(input); matcher.region(index, input.length()); boolean m = matcher.find(); if (m) { index = matcher.end(); return matcher.group(); } else { return null; } } catch (StackOverflowError e) { return null; } }
Source:
protected void setTemplateRegistry(TemplateRegistry<RuleTemplate> templateRegistry) { this.templateRegistry = templateRegistry; templateRegistry.addRegistryChangeListener(this); }

Target:
protected void setTemplateRegistry(TemplateRegistry<RuleTemplate> templateRegistry) { if (templateRegistry instanceof RuleTemplateRegistry) { this.templateRegistry = (RuleTemplateRegistry) templateRegistry; templateRegistry.addRegistryChangeListener(this); } }
Source:
private static IConfigurationAnnotation createConfiguration( IConfigurationAnnotation bs, IConfigurationAnnotation as, IConfigurationAnnotation bt, IConfigurationAnnotation at, IConfigurationAnnotation bg, IConfigurationAnnotation ag, IConfigurationAnnotation bc, IConfigurationAnnotation ac, IConfigurationAnnotation bm, IConfigurationAnnotation am) { ConfigurationAnnotation result = new ConfigurationAnnotation(); if (bs != null) { result.setBeforeSuite(true); finishInitialize(result, bs); } if (as != null) { result.setAfterSuite(true); finishInitialize(result, as); } if (bt != null) { result.setBeforeTest(true); finishInitialize(result, bt); } if (at != null) { result.setAfterTest(true); finishInitialize(result, at); } if (bg != null) { result.setBeforeGroups(bg.getBeforeGroups()); result.setBeforeGroups(true); finishInitialize(result, bg); } if (ag != null) { result.setAfterGroups(ag.getAfterGroups()); result.setAfterGroups(true); finishInitialize(result, ag); } if (bc != null) { result.setBeforeTestClass(true); finishInitialize(result, bc); } if (ac != null) { result.setAfterTestClass(true); finishInitialize(result, ac); } if (bm != null) { result.setBeforeTestMethod(true); finishInitialize(result, bm); } if (am != null) { result.setAfterTestMethod(true); finishInitialize(result, am); } return result; }

Target:
private static IConfigurationAnnotation createConfiguration( IConfigurationAnnotation bs, IConfigurationAnnotation as, IConfigurationAnnotation bt, IConfigurationAnnotation at, IConfigurationAnnotation bg, IConfigurationAnnotation ag, IConfigurationAnnotation bc, IConfigurationAnnotation ac, IConfigurationAnnotation bm, IConfigurationAnnotation am) { ConfigurationAnnotation result = new ConfigurationAnnotation(); if (bs != null) { result.setBeforeSuite(true); finishInitialize(result, bs); } if (as != null) { result.setAfterSuite(true); finishInitialize(result, as); } if (bt != null) { result.setBeforeTest(true); finishInitialize(result, bt); } if (at != null) { result.setAfterTest(true); finishInitialize(result, at); } if (bg != null) { result.setBeforeGroups(bg.getBeforeGroups()); finishInitialize(result, bg); } if (ag != null) { result.setAfterGroups(ag.getAfterGroups()); finishInitialize(result, ag); } if (bc != null) { result.setBeforeTestClass(true); finishInitialize(result, bc); } if (ac != null) { result.setAfterTestClass(true); finishInitialize(result, ac); } if (bm != null) { result.setBeforeTestMethod(true); finishInitialize(result, bm); } if (am != null) { result.setAfterTestMethod(true); finishInitialize(result, am); } return result; }
Source:
public void processCommands(String aQuery) { GerritUi.Ftracer.traceInfo(NLS.bind(Messages.GerritTableView_processCommand, aQuery)); String lastSaved = fServerUtil.getLastSavedGerritServer(); if (lastSaved != null) { fTaskRepository = fServerUtil.getTaskRepo(lastSaved); } if (fTaskRepository == null) { fMapRepoServer = GerritServerUtility.getInstance().getGerritMapping(); Set<TaskRepository> mapSet = fMapRepoServer.keySet(); if (fMapRepoServer.size() == 1) { for (TaskRepository key : mapSet) { fTaskRepository = key; fServerUtil.saveLastGerritServer(key.getRepositoryUrl()); break; } } else if (fMapRepoServer.size() > 1) { List<TaskRepository> listTaskRepository = new ArrayList<TaskRepository>(); for (TaskRepository key : mapSet) { listTaskRepository.add(key); } fTaskRepository = getSelectedRepositoryURL(listTaskRepository); if (fTaskRepository != null) { fServerUtil.saveLastGerritServer(fTaskRepository.getRepositoryUrl()); } } } if (fTaskRepository == null) { UIUtils.showErrorDialog(Messages.GerritTableView_defineRepository, Messages.GerritTableView_noGerritRepository); } else { if (aQuery != null && !aQuery.equals("")) { updateTable(fTaskRepository, aQuery); } } }

Target:
public void processCommands(String aQuery) { GerritUi.Ftracer.traceInfo("Process command : " + aQuery); String lastSaved = fServerUtil.getLastSavedGerritServer(); if (lastSaved != null) { fTaskRepository = fServerUtil.getTaskRepo(lastSaved); } if (fTaskRepository == null) { fMapRepoServer = GerritServerUtility.getInstance().getGerritMapping(); Set<TaskRepository> mapSet = fMapRepoServer.keySet(); if (fMapRepoServer.size() == 1) { for (TaskRepository key : mapSet) { fTaskRepository = key; fServerUtil.saveLastGerritServer(key.getRepositoryUrl()); break; } } else if (fMapRepoServer.size() > 1) { List<TaskRepository> listTaskRepository = new ArrayList<TaskRepository>(); for (TaskRepository key : mapSet) { listTaskRepository.add(key); } fTaskRepository = getSelectedRepositoryURL(listTaskRepository); if (fTaskRepository != null) { fServerUtil.saveLastGerritServer(fTaskRepository.getRepositoryUrl()); } } } if (fTaskRepository == null) { UIUtils.showErrorDialog(Messages.GerritTableView_defineRepository, Messages.GerritTableView_noGerritRepository); } else { if (aQuery != null && !aQuery.equals("")) { updateTable(fTaskRepository, aQuery); } } }
Source:
public BlockInfoContiguous(short size) { super(size); hasProvidedStorage = false; }

Target:
public BlockInfoContiguous(short size) { super(size); }
Source:
public void updateAllInTransaction(Map<Guid, DiskImageDynamic> vmDiskImageDynamicToSave) { updateAllInBatch("Updatedisk_image_dynamic", vmDiskImageDynamicToSave.values(), new MapSqlParameterMapper<DiskImageDynamic>() { @Override public MapSqlParameterSource map(DiskImageDynamic entity) { MapSqlParameterSource paramValue = new MapSqlParameterSource(); paramValue.addValue("image_id", entity.getId()); paramValue.addValue("read_rate", entity.getread_rate()); paramValue.addValue("write_rate", entity.getwrite_rate()); paramValue.addValue("actual_size", entity.getactual_size()); paramValue.addValue("read_latency_seconds", entity.getReadLatency()); paramValue.addValue("write_latency_seconds", entity.getWriteLatency()); paramValue.addValue("flush_latency_seconds", entity.getFlushLatency()); return paramValue; } }); }

Target:
public void updateAllInTransaction(Map<Guid, DiskImageDynamic> vmDiskImageDynamicToSave) { updateAllInBatch("Updatedisk_image_dynamic", vmDiskImageDynamicToSave.values(), new MapSqlParameterMapper<DiskImageDynamic>() { @Override public MapSqlParameterSource map(DiskImageDynamic entity) { MapSqlParameterSource paramValue = new MapSqlParameterSource() .addValue("image_id", entity.getId()) .addValue("read_rate", entity.getread_rate()) .addValue("write_rate", entity.getwrite_rate()) .addValue("actual_size", entity.getactual_size()) .addValue("read_latency_seconds", entity.getReadLatency()) .addValue("write_latency_seconds", entity.getWriteLatency()) .addValue("flush_latency_seconds", entity.getFlushLatency()); return paramValue; } }); }
Source:
private void matchNestedFile(Path file, List<Path> texFiles, List<Path> referencedFiles, String line) { Matcher includeMatch = INCLUDE_PATTERN.matcher(line); while (includeMatch.find()) { String include = includeMatch.group(INCLUDE_GROUP); Path inputFile = file.getParent().resolve( include.endsWith(TEX_EXT) ? include : String.format("%s%s", include, TEX_EXT)); if (!texFiles.contains(inputFile)) { referencedFiles.add(inputFile); } } }

Target:
private void matchNestedFile(Path file, List<Path> texFiles, List<Path> referencedFiles, String line) { Matcher includeMatch = INCLUDE_PATTERN.matcher(line); while (includeMatch.find()) { String include = includeMatch.group(INCLUDE_GROUP); Path nestedFile = file.getParent().resolve( include.endsWith(TEX_EXT) ? include : String.format("%s%s", include, TEX_EXT)); if (nestedFile.toFile().exists() && !texFiles.contains(nestedFile)) { referencedFiles.add(nestedFile); } } }
Source:
private void syncGroupControlsEnabledState(GroupViewState newViewState) { boolean noGroupSelected = newViewState == null || newViewState.getGroup() == null; tagGroupMenuButton.setDisable(noGroupSelected); catGroupMenuButton.setDisable(noGroupSelected); }

Target:
private void syncGroupControlsEnabledState(GroupViewState newViewState) { boolean noGroupSelected = (null == newViewState) || (null == newViewState.getGroup()); tagGroupMenuButton.setDisable(noGroupSelected); catGroupMenuButton.setDisable(noGroupSelected); }
Source:
public void testCloseChannelWithUnhandledMsg() { final List<Long> inboundMsgs = new ArrayList<Long>(); EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandlerAdapter() { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { inboundMsgs.add((Long) msg); } }); channel.config().setAutoRead(false); ChannelFuture channelFuture = channel.writeOneInbound(1L, channel.newPromise()); assertEquals(0, inboundMsgs.size()); Queue<Object> inboundMessages = channel.inboundMessages(); assertEquals(inboundMessages.size(), 0); channel.finish(); try { channelFuture.get(); fail(); } catch (InterruptedException e) { fail(); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof ClosedChannelException); } }

Target:
public void testCloseChannelWithUnhandledMsg() { final List<Long> inboundMsgs = new ArrayList<Long>(); EmbeddedChannel channel = new EmbeddedChannel(new ChannelInboundHandlerAdapter() { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { inboundMsgs.add((Long) msg); } }); channel.config().setAutoRead(false); ChannelFuture channelFuture = channel.writeOneInbound(1L, channel.newPromise()); assertEquals(0, inboundMsgs.size()); Queue<Object> inboundMessages = channel.inboundMessages(); assertEquals(inboundMessages.size(), 0); assertFalse(channel.finish()); try { channelFuture.get(); fail(); } catch (InterruptedException e) { fail(); } catch (ExecutionException e) { assertThat(e.getCause(), Matchers.instanceOf(ClosedChannelException.class)); } }
Source:
public StreamingOutput getContentOctets(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("path") final String path) throws IOException, ParseException { File file = getFile(path, response); if (file == null) { return null; } Document doc; if ((doc = getDocument(file)) == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot get document for file"); return null; } return transfer(file); }

Target:
public StreamingOutput getContentOctets(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam("path") final String path) throws IOException, ParseException { File file = getFile(path, response); if (file == null) { return null; } Document doc; if ((doc = getDocument(file)) == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot get document for file"); return null; } try { return transfer(file); } catch (FileNotFoundException e) { response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot find file"); return null; } }
Source:
public Response start(Action action) { RunVmParams params; ActionType actionType; if (action.isSetVm()) { Vm vm = action.getVm(); actionType = ActionType.RunVmOnce; params = createRunVmOnceParams(vm, action.isSetVolatile() && action.isVolatile()); } else { actionType = ActionType.RunVm; params = new RunVmParams(guid); } if (action.isSetPause() && action.isPause()) { params.setRunAndPause(true); } boolean sysPrepSet = action.isSetUseSysprep(); boolean useSysPrep = sysPrepSet && action.isUseSysprep(); boolean cloudInitSet = action.isSetUseCloudInit(); boolean useCloudInit = cloudInitSet && action.isUseCloudInit(); boolean ignitionSet = action.isSetUseIgnition(); boolean useIgnition = ignitionSet && action.isUseIgnition(); if (useSysPrep && useCloudInit || useSysPrep && useIgnition || useCloudInit && useIgnition) { Fault fault = new Fault(); fault.setReason(localize(Messages.CANT_USE_SYSPREP_AND_CLOUD_INIT_SIMULTANEOUSLY)); return Response.status(Response.Status.CONFLICT).entity(fault).build(); } if (useSysPrep) { params.setInitializationType(InitializationType.Sysprep); } else if (useCloudInit) { params.setInitializationType(InitializationType.CloudInit); } else if (useIgnition) { params.setInitializationType(InitializationType.Ignition); } else if ((sysPrepSet && !useSysPrep) || (cloudInitSet && !useCloudInit) || (ignitionSet && !useIgnition)) { params.setInitializationType(InitializationType.None); } else { params.setInitializationType(null); } return doAction(actionType, params, action); }

Target:
public Response start(Action action) { RunVmParams params; ActionType actionType; if (action.isSetVm()) { Vm vm = action.getVm(); actionType = ActionType.RunVmOnce; params = createRunVmOnceParams(vm, action.isSetVolatile() && action.isVolatile()); } else { actionType = ActionType.RunVm; params = new RunVmParams(guid); } if (action.isSetPause() && action.isPause()) { params.setRunAndPause(true); } boolean sysPrepSet = action.isSetUseSysprep(); boolean useSysPrep = sysPrepSet && action.isUseSysprep(); boolean cloudInitSet = action.isSetUseCloudInit(); boolean useCloudInit = cloudInitSet && action.isUseCloudInit(); boolean ignitionSet = action.isSetUseIgnition(); boolean useIgnition = ignitionSet && action.isUseIgnition(); if (useSysPrep && useCloudInit || useSysPrep && useIgnition || useCloudInit && useIgnition) { Fault fault = new Fault(); fault.setReason(localize(Messages.CANT_USE_MIXED_INIT_SIMULTANEOUSLY)); return Response.status(Response.Status.CONFLICT).entity(fault).build(); } if (useSysPrep) { params.setInitializationType(InitializationType.Sysprep); } else if (useCloudInit) { params.setInitializationType(InitializationType.CloudInit); } else if (useIgnition) { params.setInitializationType(InitializationType.Ignition); } else if ((sysPrepSet && !useSysPrep) || (cloudInitSet && !useCloudInit) || (ignitionSet && !useIgnition)) { params.setInitializationType(InitializationType.None); } else { params.setInitializationType(null); } return doAction(actionType, params, action); }
Source:
public List<Double> getConditionalProbabiltiesOfMeBeingInBed() { List<Double> condProbs = Lists.newArrayList(); for (int i = 0; i < conditionalProbsOfMeInBed.length; i++) { condProbs.add(conditionalProbsOfMeInBed[i]); } return condProbs; }

Target:
public List<Double> getConditionalProbabiltiesOfMeBeingInBed() { final List<Double> condProbs = Lists.newArrayList(); for (int i = 0; i < conditionalProbsOfMeInBed.length; i++) { condProbs.add(conditionalProbsOfMeInBed[i]); } return condProbs; }
Source:
public CardinalityAggregatorFactory( @JsonProperty("name") String name, @JsonProperty("fieldName") final String fieldName ) { Preconditions.checkNotNull(name, "Must have a valid, non-null aggregator name"); Preconditions.checkNotNull(fieldName, "Must have a valid, non-null fieldName"); this.name = name; this.fieldName = fieldName; }

Target:
public CardinalityAggregatorFactory( @JsonProperty("name") String name, @JsonProperty("fieldName") final String fieldName ) { Preconditions.checkArgument(fieldName != null && fieldName.length() > 0, "Must have a valid, non-null aggregator name"); Preconditions.checkArgument(fieldName != null && fieldName.length() > 0, "Must have a valid, non-null fieldName"); this.name = name; this.fieldName = fieldName; }
Source:
public boolean ok(Object object, RequestScope requestScope, Optional<ChangeSpec> changeSpec) { Principal principal = ((Principal) requestScope.getUser().getOpaqueUser()); if(object.getClass().equals(AsyncQuery.class)) { return ((AsyncQuery) object).getPrincipalName().equals(principal.getName()); } else { return ((AsyncQueryResult) object).getPrincipalName().equals(principal.getName()); } }

Target:
public boolean ok(Object object, RequestScope requestScope, Optional<ChangeSpec> changeSpec) { Principal principal = requestScope.getUser().getPrincipal(); return ((PrincipalOwned) object).getPrincipalName().equals(principal.getName()); }
Source:
private CVSTag[] fetchTags(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException { Set<CVSTag> tagSet = new HashSet<>(); ILogEntry[] entries = file.getLogEntries(monitor); for (ILogEntry entrie : entries) { CVSTag[] tags = entrie.getTags(); for (CVSTag tag : tags) { tagSet.add(tag); } } return tagSet.toArray(new CVSTag[0]); }

Target:
private CVSTag[] fetchTags(ICVSRemoteFile file, IProgressMonitor monitor) throws TeamException { Set<CVSTag> tagSet = new HashSet<>(); ILogEntry[] entries = file.getLogEntries(monitor); for (ILogEntry entry : entries) { CVSTag[] tags = entry.getTags(); for (CVSTag tag : tags) { tagSet.add(tag); } } return tagSet.toArray(new CVSTag[0]); }
Source:
protected void customizeWatchQueueReader(AbstractWatchService watchService, Path toWatch, boolean watchSubDirectories) { try { if (watchSubDirectories) { registerWithSubDirectories(watchService, toWatch); } else { registerDirectoryInternal(watchService, watchService.getWatchEventKinds(toWatch), toWatch); } } catch (IOException e) { e.printStackTrace(); logger.warn("Cannot customize folder watcher for folder '{}'", toWatch, e); } }

Target:
protected void customizeWatchQueueReader(AbstractWatchService watchService, Path toWatch, boolean watchSubDirectories) { try { if (watchSubDirectories) { registerWithSubDirectories(watchService, toWatch); } else { registerDirectoryInternal(watchService, watchService.getWatchEventKinds(toWatch), toWatch); } } catch (IOException e) { logger.warn("Cannot customize folder watcher for folder '{}'", toWatch, e); } }
Source:
public void recycleConnection(Connection<CL> connection) { try { this.closeConnection(connection); createConnectionWithRetries(); } finally { monitor.incConnectionRecycled(host); } }

Target:
public void recycleConnection(Connection<CL> connection) { this.closeConnection(connection); monitor.incConnectionReturned(host); if (createConnectionWithRetries()) { monitor.incConnectionRecycled(host); } else { Logger.error("Connection recycle failed to create a new connection"); } }
Source:
RFileScanner(Opts opts) { if (!opts.auths.equals(Authorizations.EMPTY) && !opts.useSystemIterators) { throw new IllegalArgumentException( "Set authorizations and specified not to use system iterators"); } this.opts = opts; ConfigurationCopy tableConf = new ConfigurationCopy(DefaultConfiguration.getInstance()); if (null != opts.tableConfig) { opts.tableConfig.forEach(tableConf::set); } this.tableConf = tableConf; if (opts.indexCacheSize > 0 || opts.dataCacheSize > 0) { ConfigurationCopy cc = new ConfigurationCopy(this.tableConf); try { blockCacheManager = BlockCacheManagerFactory.getClientInstance(cc); if (opts.indexCacheSize > 0) { cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(opts.indexCacheSize)); } if (opts.dataCacheSize > 0) { cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(opts.dataCacheSize)); } blockCacheManager.start(new BlockCacheConfiguration(cc)); this.indexCache = blockCacheManager.getBlockCache(CacheType.INDEX); this.dataCache = blockCacheManager.getBlockCache(CacheType.DATA); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } if (null == indexCache) { this.indexCache = new NoopCache(); } if (null == this.dataCache) { this.dataCache = new NoopCache(); } }

Target:
RFileScanner(Opts opts) { if (!opts.auths.equals(Authorizations.EMPTY) && !opts.useSystemIterators) { throw new IllegalArgumentException( "Set authorizations and specified not to use system iterators"); } this.opts = opts; if (null != opts.tableConfig && opts.tableConfig.size() > 0) { ConfigurationCopy tableCC = new ConfigurationCopy(DefaultConfiguration.getInstance()); opts.tableConfig.forEach(tableCC::set); this.tableConf = tableCC; } else { this.tableConf = DefaultConfiguration.getInstance(); } if (opts.indexCacheSize > 0 || opts.dataCacheSize > 0) { ConfigurationCopy cc = tableConf instanceof ConfigurationCopy ? (ConfigurationCopy) tableConf : new ConfigurationCopy(tableConf); try { blockCacheManager = BlockCacheManagerFactory.getClientInstance(cc); if (opts.indexCacheSize > 0) { cc.set(Property.TSERV_INDEXCACHE_SIZE, Long.toString(opts.indexCacheSize)); } if (opts.dataCacheSize > 0) { cc.set(Property.TSERV_DATACACHE_SIZE, Long.toString(opts.dataCacheSize)); } blockCacheManager.start(new BlockCacheConfiguration(cc)); this.indexCache = blockCacheManager.getBlockCache(CacheType.INDEX); this.dataCache = blockCacheManager.getBlockCache(CacheType.DATA); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } if (null == indexCache) { this.indexCache = new NoopCache(); } if (null == this.dataCache) { this.dataCache = new NoopCache(); } }
Source:
public void rightClickBlock(GlowPlayer player, GlowBlock against, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlock target = against.getRelative(face); GlowBlockState newState = target.getState(); if (against.getType() == Material.LONG_GRASS || against.getType() == Material.FIRE) { target = against; } else if (!target.isEmpty() && !target.isLiquid()) { return; } PlayerBucketEmptyEvent emptyBucketEvent = EventFactory.onPlayerBucketEmpty(player, against, face, holding.getType(), holding); if (emptyBucketEvent.isCancelled()) { return; } this.getPlaceAs().placeBlock(player, newState, face, holding, clickedLoc); newState.update(true); if (player.getGameMode() != GameMode.CREATIVE) { holding.setType(Material.BUCKET); } }

Target:
public void rightClickBlock(GlowPlayer player, GlowBlock against, BlockFace face, ItemStack holding, Vector clickedLoc) { GlowBlock target = against.getRelative(face); BlockType againstBlockType = ItemTable.instance().getBlock(against.getType()); if (againstBlockType.canAbsorb(target, face, holding)) { target = against; } else if (!target.isEmpty()) { BlockType targetType = ItemTable.instance().getBlock(target.getTypeId()); if (!targetType.canOverride(target, face, holding)) { return; } } GlowBlockState newState = target.getState(); PlayerBucketEmptyEvent emptyBucketEvent = EventFactory.onPlayerBucketEmpty(player, target, face, holding.getType(), holding); if (emptyBucketEvent.isCancelled()) { return; } this.getPlaceAs().placeBlock(player, newState, face, holding, clickedLoc); newState.update(true); if (player.getGameMode() != GameMode.CREATIVE) { holding.setType(Material.BUCKET); } }
Source:
public void searchForIsOnStockInChannels() { withChannelOfRole(client(), ChannelRole.INVENTORY_SUPPLY, channel -> { withProductOfStockAndChannel(client(), 2, channel, product -> { final ProductProjectionSearch request = ProductProjectionSearch.ofStaged() .plusQueryFilters(m -> m.id().is(product.getId())) .plusQueryFilters(m -> m.allVariants().availability() .isOnStockInChannels().channels(Arrays.asList("noChannelId", channel.getId()))); assertEventually(() -> { final PagedSearchResult<ProductProjection> res = client().executeBlocking(request); assertThat(res.getResults()).hasSize(1); }); }); }); }

Target:
public void searchForIsOnStockInChannels() { final String nonExistingChannel = "nonExistingChannelId"; withChannelOfRole(client(), ChannelRole.INVENTORY_SUPPLY, channel -> { withProductOfStockAndChannel(client(), 2, channel, product -> { final ProductProjectionSearch isOnStockInAnyChannelRequest = ProductProjectionSearch.ofStaged() .plusQueryFilters(m -> m.id().is(product.getId())) .plusQueryFilters(m -> m.allVariants().availability() .isOnStockByChannels().containsAny(Arrays.asList(nonExistingChannel, channel.getId()))); assertEventually(() -> { final PagedSearchResult<ProductProjection> res = client().executeBlocking(isOnStockInAnyChannelRequest); assertThat(res.getResults()).hasSize(1); }); final ProductProjectionSearch isOnStockInAnyChannelExistsRequest = ProductProjectionSearch.ofStaged() .plusQueryFilters(m -> m.id().is(product.getId())) .plusQueryFilters(m -> m.allVariants().availability() .isOnStockByChannels().exists()); assertEventually(() -> { final PagedSearchResult<ProductProjection> res = client().executeBlocking(isOnStockInAnyChannelExistsRequest); assertThat(res.getResults()).hasSize(1); }); final ProductProjectionSearch isOnStockInAllChannelsRequest = ProductProjectionSearch.ofStaged() .plusQueryFilters(m -> m.id().is(product.getId())) .plusQueryFilters(m -> m.allVariants().availability() .isOnStockByChannels().containsAll(Arrays.asList(nonExistingChannel, channel.getId()))); assertEventually(() -> { final PagedSearchResult<ProductProjection> res = client().executeBlocking(isOnStockInAllChannelsRequest); assertThat(res.getResults()).isEmpty(); }); }); }); }