auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private QueryResponse query(QueryRequest queryRequest) { AtomicLong hitCount = new AtomicLong(0); QueryFunction queryFunction = qr -> { SourceResponse sourceResponse = catalogFramework.query(qr); hitCount.compareAndSet(0, sourceResponse.getHits()); return sourceResponse; }; ResultIterable results = ResultIterable.resultIterable(queryFunction, queryRequest, maxSubscriptions); List<Result> resultList = results.stream().collect(Collectors.toList()); long totalHits = hitCount.get(); totalHits = totalHits != 0 ? totalHits : resultList.size(); return new QueryResponseImpl(queryRequest, resultList, totalHits); }

Target:
private QueryResponse query(QueryRequest queryRequest) { AtomicLong hitCount = new AtomicLong(0); QueryFunction queryFunction = qr -> { SourceResponse sourceResponse = catalogFramework.query(qr); hitCount.compareAndSet(0, sourceResponse.getHits()); return sourceResponse; }; ResultIterable results = ResultIterable.resultIterable(queryFunction, queryRequest, maxSubscriptions); List<Result> resultList = results.stream().collect(Collectors.toList()); long totalHits = hitCount.get() != 0 ? hitCount.get() : resultList.size(); return new QueryResponseImpl(queryRequest, resultList, totalHits); }
Source:
public final void cacheResources(final HttpRequestCache httpRequestCache, final MfClientHttpRequestFactory clientHttpRequestFactory, final MapfishMapContext transformer) { final MapfishMapContext layerTransformer = getLayerTransformer(transformer); final double dpi = transformer.getDPI(); final TilePreparationTask task = new TilePreparationTask( clientHttpRequestFactory, dpi, layerTransformer, this.tileCacheInformation, httpRequestCache); this.tilePreparationInfo = this.forkJoinPool.invoke(task); }

Target:
public final void cacheResources(final HttpRequestCache httpRequestCache, final MfClientHttpRequestFactory clientHttpRequestFactory, final MapfishMapContext transformer) { final MapfishMapContext layerTransformer = getLayerTransformer(transformer); final double dpi = transformer.getDPI(); final TilePreparationTask task = new TilePreparationTask( clientHttpRequestFactory, dpi, layerTransformer, this.tileCacheInformation, httpRequestCache); this.tilePreparationInfo = task.call(); }
Source:
public void doSet(String attribute, Serializable value) { unregisterResource(attribute); put(attribute, value); }

Target:
private void doSet(String attribute, Serializable value) { unregisterResource(attribute); put(attribute, value); }
Source:
public final Set<String> excludeInternalImports(@NotNull final Set<String> imports) { final Set<String> internalImports = new HashSet<String>(); PackageIndex packageIndex = PackageIndex.getInstance(windowObjects.getProject()); for (String importName : imports) { int indexOfDot = importName.lastIndexOf(DOT); String packageName; if (indexOfDot != -1) { packageName = importName.substring(0, importName.lastIndexOf(DOT)); } else { packageName = ""; } List<VirtualFile> packageDirectories = Arrays.asList( packageIndex.getDirectoriesByPackageName(packageName, false)); if (packageDirectories.size() > 0) { VirtualFile packageDirectory = packageDirectories.get(0); if (!packageDirectory.isInLocalFileSystem()) { internalImports.add(importName); } } } return internalImports; }

Target:
public final Set<String> excludeInternalImports(@NotNull final Set<String> imports) { final Set<String> internalImports = new HashSet<String>(); PackageIndex packageIndex = PackageIndex.getInstance(windowObjects.getProject()); for (String importName : imports) { int indexOfDot = importName.lastIndexOf(DOT); String packageName; if (indexOfDot != -1) { packageName = importName.substring(0, importName.lastIndexOf(DOT)); List<VirtualFile> packageDirectories = Arrays.asList( packageIndex.getDirectoriesByPackageName(packageName, false)); if (packageDirectories.size() > 0) { VirtualFile packageDirectory = packageDirectories.get(0); if (!packageDirectory.isInLocalFileSystem()) { internalImports.add(importName); } } } } return internalImports; }
Source:
protected ModelAndView getRadiologyOrderFormWithExistingRadiologyOrderByOrderId( @RequestParam(value = "orderId", required = true) Order order) { ModelAndView modelAndView = new ModelAndView("module/radiology/radiologyOrderForm"); if (Context.isAuthenticated()) { RadiologyOrder radiologyOrder = radiologyService.getRadiologyOrderByOrderId(order.getOrderId()); modelAndView.addObject("order", order); modelAndView.addObject("isOrderActive", order.isActive()); modelAndView.addObject("radiologyOrder", radiologyOrder); modelAndView.addObject("discontinuationOrder", new Order()); Study study = radiologyOrder.getStudy(); DicomViewer dicomviewer = new DicomViewer(); dicomviewer.setRadiologyProperties(radiologyProperties); modelAndView.addObject("studyUID", study.isCompleted() ? study.getStudyInstanceUid() : null); modelAndView.addObject("dicomViewerUrl", dicomviewer.getDicomViewerUrl(study)); radiologyReportNeedsToBeCreated(modelAndView, order); } return modelAndView; }

Target:
protected ModelAndView getRadiologyOrderFormWithExistingRadiologyOrderByOrderId( @RequestParam(value = "orderId", required = true) Order order) { ModelAndView modelAndView = new ModelAndView(RADIOLOGY_ORDER_FORM_VIEW); if (Context.isAuthenticated()) { final RadiologyOrder radiologyOrder = radiologyService.getRadiologyOrderByOrderId(order.getOrderId()); modelAndView.addObject("order", order); modelAndView.addObject("isOrderActive", order.isActive()); modelAndView.addObject("radiologyOrder", radiologyOrder); modelAndView.addObject("discontinuationOrder", new Order()); Study study = radiologyOrder.getStudy(); modelAndView.addObject("studyUID", study.getStudyInstanceUid()); modelAndView.addObject("dicomViewerUrl", dicomViewer.getDicomViewerUrl(study)); radiologyReportNeedsToBeCreated(modelAndView, order); } return modelAndView; }
Source:
private void invocation() throws IOException { final String name = expect(StreamTokenizer.TT_WORD).sval; final List<Object> args = new ArrayList<Object>(); expect('('); if (!accept(')')) { args.add(argument()); while (!accept(')')) { expect(','); args.add(argument()); } } expect(';'); visitor.visitInvocation(ctx, name, args.toArray()); }

Target:
private void invocation() throws IOException { final String name = expect(StreamTokenizer.TT_WORD).sval; final List<Object> args = new ArrayList<Object>(); expect('('); if (!accept(')')) { args.add(argument()); while (!accept(')')) { expect(','); args.add(argument()); } } visitor.visitInvocation(ctx, name, args.toArray()); }
Source:
public void interceptSentText(String text) { try { outgoingTextSplitter.write(text.getBytes(Charset.defaultCharset())); } catch (IOException e) { LOGGER.log(Level.WARNING, "IOException encountered while parsing outgoing text" + text, e); } }

Target:
public void interceptSentText(String text) { try { outgoingTextSplitter.write(text.getBytes(Charset.defaultCharset())); } catch (IOException e) { LOGGER.log(Level.WARNING, "IOException encountered while parsing outgoing text: " + text, e); } }
Source:
protected void startNewInstance(List<String> ids) { Map<String, Serializable> vars = null; if (variables != null) { if (variables instanceof DataModelProperties) { vars = ((DataModelProperties) variables).getMap(); vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, false); } else { vars = new HashMap<>(); for (Entry<String, String> entry : variables.entrySet()) { vars.put(entry.getKey(), entry.getValue()); } vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, true); } } String workflowId = documentRoutingService.createNewInstance(id, ids, vars, session, Boolean.TRUE.equals(start)); ctx.put("WorkflowId", workflowId); ctx.put("workflowInstanceId", workflowId); }

Target:
protected void startNewInstance(List<String> ids) { Map<String, Serializable> vars = null; if (variables != null) { if (variables instanceof DataModelProperties) { vars = ((DataModelProperties) variables).getMap(); vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, false); } else { vars = new HashMap<>(variables); vars.put(DocumentRoutingConstants._MAP_VAR_FORMAT_JSON, true); } } String workflowId = documentRoutingService.createNewInstance(id, ids, vars, session, Boolean.TRUE.equals(start)); ctx.put("WorkflowId", workflowId); ctx.put("workflowInstanceId", workflowId); }
Source:
public List<Matcher> replaceRecursive(final String baseFileNameGlob, final Pattern pattern, final int index, final String immediate) throws IOException { final ImmutableList.Builder<Matcher> matchers = ImmutableList.<Matcher>builder(); final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + baseFileNameGlob); Files.walkFileTree(this.basePath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path filePath, BasicFileAttributes attributes) throws IOException { if (pathMatcher.matches(filePath.getFileName())) { final String originalData = read(filePath); Matcher first = null; int position = 0; String modifiedData = originalData; while (position < modifiedData.length()) { final String postModifiedData = modifiedData.substring(0,position); final String preModifiedData = modifiedData.substring(position); final Matcher matcher = pattern.matcher(preModifiedData); if (!matcher.find()) { break; } if (first == null) { first = matcher; } final String replacingString = immediate; modifiedData = postModifiedData + preModifiedData.substring(0, matcher.start(index)) + replacingString + preModifiedData.substring(matcher.end(index)); position = postModifiedData.length() + matcher.start(index) + replacingString.length() + (matcher.end() - matcher.end(index)); } if (first != null) { modify(filePath, modifiedData); matchers.add(first); } } return FileVisitResult.CONTINUE; } }); return matchers.build(); }

Target:
public List<Matcher> replaceRecursive(final String baseFileNameGlob, final Pattern pattern, final int index, final String immediate) throws IOException { final ImmutableList.Builder<Matcher> matchers = ImmutableList.<Matcher>builder(); final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:" + baseFileNameGlob); Files.walkFileTree(this.basePath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path filePath, BasicFileAttributes attributes) throws IOException { if (pathMatcher.matches(filePath.getFileName())) { final String originalData = read(filePath); Matcher first = null; int position = 0; String modifiedData = originalData; while (position < modifiedData.length()) { final String formerModifiedData = modifiedData.substring(0, position); final String latterModifiedData = modifiedData.substring(position); final Matcher matcher = pattern.matcher(latterModifiedData); if (!matcher.find()) { break; } if (first == null) { first = matcher; } final String replacingString = immediate; modifiedData = formerModifiedData + latterModifiedData.substring(0, matcher.start(index)) + replacingString + latterModifiedData.substring(matcher.end(index)); position = formerModifiedData.length() + matcher.start(index) + replacingString.length() + (matcher.end() - matcher.end(index)); } if (first != null) { modify(filePath, modifiedData); matchers.add(first); } } return FileVisitResult.CONTINUE; } }); return matchers.build(); }
Source:
public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { final Mono<ClientResponse> clientResponse = webClient.post() .uri(uri) .syncBody(message.getBody()) .headers(httpHeaders -> httpHeaders.setAll(message.getHeaders())) .exchange(); return clientResponse .toFuture() .thenApply(response -> response.bodyToMono(String.class).toFuture()) .thenCompose(Function.identity()) .thenCombine( clientResponse.toFuture().thenApply(res -> new HttpData(res.rawStatusCode(), res.headers().asHttpHeaders())), (body, httpData) -> hermesResponse() .withBody(body) .withHttpStatus(httpData.getStatusCode()) .withHeaderSupplier(header -> convertToCaseInsensitiveMap(httpData.getHeaders()) .getOrDefault(header, null)) .build()); }

Target:
public CompletableFuture<HermesResponse> send(URI uri, HermesMessage message) { return webClient.post() .uri(uri) .syncBody(message.getBody()) .headers(httpHeaders -> httpHeaders.setAll(message.getHeaders())) .exchange() .flatMap(response -> response .bodyToMono(String.class) .switchIfEmpty(NO_BODY) .map(body -> hermesResponse() .withBody(body) .withHttpStatus(response.rawStatusCode()) .withHeaderSupplier(header -> convertToCaseInsensitiveMap(response.headers().asHttpHeaders().toSingleValueMap()).get(header)) .build())) .toFuture(); }
Source:
public void addPages() { newFileCreationPage = new NewFileCreationPage("CPSWizardNewFileCreationPage", selection); newFileCreationPage.setTitle(TITLE); newFileCreationPage.setDescription("Create a new CyberPhysicalSystem model file"); newFileCreationPage.setFileName(DEFAULT_FILENAME + "." + EXTENSION); addPage(newFileCreationPage); if (selection != null && !selection.isEmpty()) { Object selectedElement = selection.iterator().next(); if (selectedElement instanceof IResource) { IResource selectedResource = (IResource) selectedElement; if (selectedResource.getType() == IResource.FILE) { selectedResource = selectedResource.getParent(); } if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); String modelFilename = DEFAULT_FILENAME + "." + EXTENSION; for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { modelFilename = DEFAULT_FILENAME + i + "." + EXTENSION; } newFileCreationPage.setFileName(modelFilename); } } } constraintPage = new ConstraintTypePage(); constraintPage.setTitle(TITLE); addPage(constraintPage); detailsPage = new ConstraintDetailsPage(); detailsPage.setTitle(TITLE); addPage(detailsPage); }

Target:
public void addPages() { newFileCreationPage = new NewFileCreationPage("CPSWizardNewFileCreationPage", selection, EXTENSION); newFileCreationPage.setTitle(TITLE); newFileCreationPage.setDescription("Create a new CyberPhysicalSystem model file"); newFileCreationPage.setFileName(DEFAULT_FILENAME + "." + EXTENSION); addPage(newFileCreationPage); if (selection != null && !selection.isEmpty()) { Object selectedElement = selection.iterator().next(); if (selectedElement instanceof IResource) { IResource selectedResource = (IResource) selectedElement; if (selectedResource.getType() == IResource.FILE) { selectedResource = selectedResource.getParent(); } if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); String modelFilename = DEFAULT_FILENAME + "." + EXTENSION; for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { modelFilename = DEFAULT_FILENAME + i + "." + EXTENSION; } newFileCreationPage.setFileName(modelFilename); } } } constraintPage = new ConstraintTypePage(); constraintPage.setTitle(TITLE); addPage(constraintPage); detailsPage = new ConstraintDetailsPage(); detailsPage.setTitle(TITLE); addPage(detailsPage); }
Source:
public boolean performClick() { if (mPopup != null) { if (!mPopup.isShowing()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { mPopup.show(getTextDirection(), getTextAlignment()); } else { mPopup.show(-1, -1); } } return true; } return super.performClick(); }

Target:
public boolean performClick() { if (mPopup != null) { if (!mPopup.isShowing()) { showPopup(); } return true; } return super.performClick(); }
Source:
public List<IPersonAttributeDao> scriptedAttributeRepositories() { final List<IPersonAttributeDao> list = new ArrayList<>(); casProperties.getAuthn().getAttributeRepository().getScript() .forEach(Unchecked.consumer(script -> { final String scriptContents = IOUtils.toString(script.getLocation().getInputStream(), StandardCharsets.UTF_8); final String engineName = script.getEngineName() == null ? ScriptEnginePersonAttributeDao.getScriptEngineName(script.getLocation().getFilename()) : script.getEngineName(); if (engineName == null) { LOGGER.warn("Unable to determine script engineName for script: {}", script.getLocation().getFilename()); } final ScriptEnginePersonAttributeDao dao = new ScriptEnginePersonAttributeDao(scriptContents, engineName); dao.setCaseInsensitiveUsername(script.isCaseInsensitive()); dao.setOrder(script.getOrder()); LOGGER.debug("Configured scripted attribute sources from [{}]", script.getLocation()); list.add(dao); })); return list; }

Target:
public List<IPersonAttributeDao> scriptedAttributeRepositories() { final List<IPersonAttributeDao> list = new ArrayList<>(); casProperties.getAuthn().getAttributeRepository().getScript() .forEach(Unchecked.consumer(script -> { final String scriptContents = IOUtils.toString(script.getLocation().getInputStream(), StandardCharsets.UTF_8); final String engineName = script.getEngineName() == null ? ScriptEnginePersonAttributeDao.getScriptEngineName(script.getLocation().getFilename()) : script.getEngineName(); final ScriptEnginePersonAttributeDao dao = new ScriptEnginePersonAttributeDao(scriptContents, engineName); dao.setCaseInsensitiveUsername(script.isCaseInsensitive()); dao.setOrder(script.getOrder()); LOGGER.debug("Configured scripted attribute sources from [{}]", script.getLocation()); list.add(dao); })); return list; }
Source:
protected String buildBody(JwtTokenInfoDTO jwtTokenInfoDTO) { long currentTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long expireIn; if (jwtTokenInfoDTO.getExpirationTime() == -1 || jwtTokenInfoDTO.getExpirationTime() > (Integer.MAX_VALUE-currentTime)) { expireIn = -1; } else { expireIn = currentTime + jwtTokenInfoDTO.getExpirationTime(); } String issuerIdentifier = OAuthServerConfiguration.getInstance().getOpenIDConnectIDTokenIssuerIdentifier(); JWTClaimsSet.Builder jwtClaimsSetBuilder = new JWTClaimsSet.Builder(); jwtClaimsSetBuilder.claim("sub", APIUtil.getUserNameWithTenantSuffix(jwtTokenInfoDTO.getEndUserName())); jwtClaimsSetBuilder.claim("jti", UUID.randomUUID().toString()); jwtClaimsSetBuilder.claim("iss", issuerIdentifier); jwtClaimsSetBuilder.claim("iat", currentTime); if (expireIn != -1) { jwtClaimsSetBuilder.claim("exp", expireIn); } jwtClaimsSetBuilder.claim("subscribedAPIs", jwtTokenInfoDTO.getSubscribedApiDTOList()); jwtClaimsSetBuilder.claim("tierInfo", jwtTokenInfoDTO.getSubscriptionPolicyDTOList()); jwtClaimsSetBuilder.claim("application", jwtTokenInfoDTO.getApplication()); jwtClaimsSetBuilder.claim("keytype", jwtTokenInfoDTO.getKeyType()); return jwtClaimsSetBuilder.build().toJSONObject().toJSONString(); }

Target:
protected String buildBody(JwtTokenInfoDTO jwtTokenInfoDTO) { long currentTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()); long expireIn; if (jwtTokenInfoDTO.getExpirationTime() == -1 || jwtTokenInfoDTO.getExpirationTime() > (Integer.MAX_VALUE-currentTime)) { expireIn = -1; } else { expireIn = currentTime + jwtTokenInfoDTO.getExpirationTime(); } String issuerIdentifier = OAuthServerConfiguration.getInstance().getOpenIDConnectIDTokenIssuerIdentifier(); JWTClaimsSet.Builder jwtClaimsSetBuilder = new JWTClaimsSet.Builder(); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.END_USERNAME, APIUtil.getUserNameWithTenantSuffix(jwtTokenInfoDTO.getEndUserName())); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.JWT_ID, UUID.randomUUID().toString()); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.ISSUER_IDENTIFIER, issuerIdentifier); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.ISSUED_TIME, currentTime); if (expireIn != -1) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.EXPIRY_TIME, expireIn); } jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.SUBSCRIBED_APIS, jwtTokenInfoDTO.getSubscribedApiDTOList()); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.TIER_INFO, jwtTokenInfoDTO.getSubscriptionPolicyDTOList()); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.APPLICATION, jwtTokenInfoDTO.getApplication()); jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.KEY_TYPE, jwtTokenInfoDTO.getKeyType()); if (jwtTokenInfoDTO.getPermittedIP() != null) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_IP, jwtTokenInfoDTO.getPermittedIP()); } if (jwtTokenInfoDTO.getPermittedReferer() != null) { jwtClaimsSetBuilder.claim(APIConstants.JwtTokenConstants.PERMITTED_REFERER, jwtTokenInfoDTO.getPermittedReferer()); } return jwtClaimsSetBuilder.build().toJSONObject().toJSONString(); }
Source:
private static List<Type> closeMethodThrownTypes(Type classType) { List<Type> thrownTypes = classType.symbol().lookupSymbols("close").stream() .filter(Symbol::isMethodSymbol) .map(Symbol.MethodSymbol.class::cast) .filter(method -> method.parameterTypes().isEmpty()) .map(Symbol.MethodSymbol::thrownTypes) .findFirst() .orElse(null); if (thrownTypes == null) { thrownTypes = directSuperTypeStream(classType).map(ThrownExceptionVisitor::closeMethodThrownTypes) .filter(Objects::nonNull) .findFirst() .orElse(null); } return thrownTypes; }

Target:
private static List<Type> closeMethodThrownTypes(Type classType) { return classType.symbol().lookupSymbols("close").stream() .filter(Symbol::isMethodSymbol) .map(Symbol.MethodSymbol.class::cast) .filter(method -> method.parameterTypes().isEmpty()) .map(Symbol.MethodSymbol::thrownTypes) .findFirst() .orElseGet(() -> directSuperTypeStream(classType).map(ThrownExceptionVisitor::closeMethodThrownTypes) .filter(Objects::nonNull) .findFirst() .orElse(null)); }
Source:
public List<QuotaUsageVO> findQuotaUsage(final Long accountId, final Long domainId, final Integer usageType, final Date startDate, final Date endDate) { final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); List<QuotaUsageVO> quotaUsageRecords = new ArrayList<QuotaUsageVO>(); try (TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB)) { SearchCriteria<QuotaUsageVO> sc = createSearchCriteria(); if (accountId != null) { sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); } if (domainId != null) { sc.addAnd("domainId", SearchCriteria.Op.EQ, domainId); } if (usageType != null) { sc.addAnd("usageType", SearchCriteria.Op.EQ, usageType); } if ((startDate != null) && (endDate != null) && startDate.before(endDate)) { sc.addAnd("startDate", SearchCriteria.Op.BETWEEN, startDate, endDate); sc.addAnd("endDate", SearchCriteria.Op.BETWEEN, startDate, endDate); } else { return new ArrayList<QuotaUsageVO>(); } quotaUsageRecords = listBy(sc); } catch (Exception e) { s_logger.error("QuotaUsageDaoImpl::findQuotaUsage() failed due to: " + e.getMessage()); throw new CloudRuntimeException("Unable to find quota usage"); } finally { TransactionLegacy.open(opendb).close(); } return quotaUsageRecords; }

Target:
public List<QuotaUsageVO> findQuotaUsage(final Long accountId, final Long domainId, final Integer usageType, final Date startDate, final Date endDate) { return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<List<QuotaUsageVO>>() { @Override public List<QuotaUsageVO> doInTransaction(final TransactionStatus status) { List<QuotaUsageVO> quv; if ((startDate != null) && (endDate != null) && startDate.before(endDate)) { QueryBuilder<QuotaUsageVO> qb = QueryBuilder.create(QuotaUsageVO.class); if (accountId != null) { qb.and(qb.entity().getAccountId(), SearchCriteria.Op.EQ, accountId); } if (domainId != null) { qb.and(qb.entity().getDomainId(), SearchCriteria.Op.EQ, domainId); } if (usageType != null) { qb.and(qb.entity().getUsageType(), SearchCriteria.Op.EQ, usageType); } qb.and(qb.entity().getStartDate(), SearchCriteria.Op.BETWEEN, startDate, endDate); qb.and(qb.entity().getEndDate(), SearchCriteria.Op.BETWEEN, startDate, endDate); quv = listBy(qb.create()); } else { quv = new ArrayList<QuotaUsageVO>(); } if (quv.isEmpty()){ QuotaUsageVO qu = new QuotaUsageVO(); qu.setAccountId(accountId); qu.setDomainId(domainId); qu.setStartDate(startDate); qu.setEndDate(endDate); qu.setQuotaUsed(new BigDecimal(0)); qu.setUsageType(-1); quv.add(qu); } return quv; } }); }
Source:
private boolean startsOrEndsWithWhitespace(String value) { boolean startsOrEndsWithWhitespace = false; int lastIndex = value.length() - 1; if (value.charAt(0) == ' ') { startsOrEndsWithWhitespace = true; } else if (Character.isWhitespace(value.charAt(lastIndex))) { startsOrEndsWithWhitespace = true; } return startsOrEndsWithWhitespace; }

Target:
private boolean startsOrEndsWithWhitespace(String value) { return (StringUtils.isNotBlank(value) && (Character.isSpaceChar(value.charAt(0)) || Character.isSpaceChar(value.charAt(value.length() -1)))); }
Source:
private Pair<List<File>, List<File>> createFilesAndDirsAtPath(File dir, int fileCount, int dirCount) throws IOException { List<File> createdFiles = new ArrayList<>(); for (int i = 0; i < fileCount; i++) { File createdFile = new File(dir, "created-file-" + i); if (!createdFile.exists()) { assertTrue("Could not create " + createdFile, createdFile.createNewFile()); } createdFile.deleteOnExit(); createdFiles.add(createdFile); } List<File> createdDirs = new ArrayList<>(); for (int i = 0; i < dirCount; i++) { File createdDir = new File(dir, "created-dir-" + i); assertTrue(createdDir + " exists and is not a directory", !createdDir.exists() || createdDir.isDirectory()); if (!createdDir.exists()) { assertTrue("Could not create " + createdDir, createdDir.mkdir()); } createdDir.deleteOnExit(); createdDirs.add(createdDir); } return new Pair<>(createdFiles, createdDirs); }

Target:
private Pair<List<File>, List<File>> createFilesAndDirsAtPath(File dir, int fileCount, int dirCount) throws IOException { List<File> createdFiles = new ArrayList<>(); for (int i = 0; i < fileCount; i++) { File createdFile = new File(dir, "created-file-" + i); if (!createdFile.exists()) { assertTrue("Could not create " + createdFile, createdFile.createNewFile()); } createdFile.deleteOnExit(); createdFiles.add(createdFile); } List<File> createdDirs = new ArrayList<>(); for (int i = 0; i < dirCount; i++) { File createdDir = new File(dir, "created-dir-" + i); assertTrue("Could not create " + createdDir + " now", createdDir.mkdir()); createdDir.deleteOnExit(); createdDirs.add(createdDir); } return new Pair<>(createdFiles, createdDirs); }
Source:
private List<SubscriptionEventTypeStats> createSubscriptionStat(final Subscription subscription) throws ServiceUnavailableException { final String subscriptionId = subscription.getId(); final ZkSubscriptionClient zkSubscriptionClient = zkSubscriptionClientFactory.createZkSubscriptionClient(subscriptionId); final ZkSubscriptionNode zkSubscriptionNode = zkSubscriptionClient.getZkSubscriptionNode(); final boolean hasSessions = zkSubscriptionNode.getSessions().length > 0; final List<EventType> eventTypes = subscription.getEventTypes().stream() .map(Try.wrap(eventTypeRepository::findByName)) .map(Try::getOrThrow) .collect(Collectors.toList()); final Set<String> topics = eventTypes.stream() .map(EventType::getTopic) .collect(Collectors.toSet()); final List<TopicPartition> topicPartitions = topicRepository.listPartitions(topics); return eventTypes.stream() .map(eventType -> { final Set<SubscriptionEventTypeStats.Partition> statPartitions = Arrays.stream(zkSubscriptionNode.getPartitions()) .sorted((p1, p2) -> p1.getKey().getPartition().compareTo(p2.getKey().getPartition())) .filter(partition -> eventType.getTopic().equals(partition.getKey().getTopic())) .flatMap(partition -> filterTopicPartitions(zkSubscriptionClient, topicPartitions, partition, hasSessions)) .collect(Collectors.toSet()); return new SubscriptionEventTypeStats(eventType.getName(), statPartitions); }) .collect(Collectors.toList()); }

Target:
private List<SubscriptionEventTypeStats> createSubscriptionStat(final Subscription subscription) throws ServiceUnavailableException { final ZkSubscriptionClient zkSubscriptionClient = zkSubscriptionClientFactory.createZkSubscriptionClient(subscription.getId()); final ZkSubscriptionNode zkSubscriptionNode = zkSubscriptionClient.getZkSubscriptionNodeLocked(); final List<EventType> eventTypes = subscription.getEventTypes().stream() .map(Try.wrap(eventTypeRepository::findByName)) .map(Try::getOrThrow) .collect(Collectors.toList()); final Set<String> topics = eventTypes.stream() .map(EventType::getTopic) .collect(Collectors.toSet()); final List<TopicPartition> topicPartitions = topicRepository.listPartitions(topics); return eventTypes.stream() .map(eventType -> { final Set<SubscriptionEventTypeStats.Partition> statPartitions = topicPartitions.stream() .filter(partition -> eventType.getTopic().equals(partition.getTopicId())) .map(Try.wrap(partition -> mergePartitions(zkSubscriptionClient, zkSubscriptionNode, partition))) .map(Try::getOrThrow) .collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingInt(p -> Integer.valueOf(p.getPartition())))) ); return new SubscriptionEventTypeStats(eventType.getName(), statPartitions); }) .collect(Collectors.toList()); }
Source:
public IFolder getFolder(IReferencePoint referencePoint, IPath referencePointRelativePath) { if (referencePoint == null) throw new IllegalArgumentException("Reference point is null"); if (referencePointRelativePath == null) throw new IllegalArgumentException("Path is null"); org.eclipse.core.resources.IProject project = getProject(referencePoint); if (project == null) throw new IllegalArgumentException( "For reference point " + referencePoint + " does'nt exist a project."); return project.getFolder(referencePointRelativePath); }

Target:
public IFolder getFolder(IReferencePoint referencePoint, IPath referencePointRelativePath) { checkArgument(referencePoint, "Reference point is null"); checkArgument(referencePointRelativePath, "ReferencePointsRelativePath is null"); IProject project = Objects.requireNonNull(getProject(referencePoint)); return project.getFolder(referencePointRelativePath); }
Source:
public <T extends ActionRequest> void validate(T request) throws FoxtrotException { Set<String> validationErrors = request.validate(); if (!CollectionUtils.isSetNullOrEmpty(validationErrors)) { throw FoxtrotExceptions.createMalformedQueryException(request, new ArrayList<>(validationErrors)); } }

Target:
public <T extends ActionRequest> void validate(T request) throws FoxtrotException { resolve(request).validateImpl(); }
Source:
public void updateInferredMethodParameterTypes( MethodInvocationNode methodInvNode, Tree receiverTree, ExecutableElement methodElt, AnnotatedTypeFactory atf) { if (receiverTree == null) { return; } final MethodTree methodDefinitionTree = (MethodTree) atf.declarationFromElement(methodElt); final ClassSymbol classSymbol; if (methodDefinitionTree != null) { classSymbol = getEnclosingClassSymbol(methodDefinitionTree); } else { classSymbol = getEnclosingClassSymbol(receiverTree); } if (classSymbol == null) { return; } String className = classSymbol.flatname.toString(); String jaifPath = helper.getJaifPath(className); AClass clazz = helper.getAClass(className, jaifPath); String methodName = JVMNames.getJVMMethodName(methodElt); AMethod method = clazz.methods.getVivify(methodName); List<Node> arguments = methodInvNode.getArguments(); updateInferredExecutableParameterTypes(methodElt, atf, jaifPath, method, arguments); }

Target:
public void updateInferredMethodParameterTypes( MethodInvocationNode methodInvNode, Tree receiverTree, ExecutableElement methodElt, AnnotatedTypeFactory atf) { if (ElementUtils.isElementFromByteCode(methodElt)) { return; } String className = getEnclosingClassName(methodElt); String jaifPath = helper.getJaifPath(className); AClass clazz = helper.getAClass(className, jaifPath); String methodName = JVMNames.getJVMMethodName(methodElt); AMethod method = clazz.methods.getVivify(methodName); List<Node> arguments = methodInvNode.getArguments(); updateInferredExecutableParameterTypes(methodElt, atf, jaifPath, method, arguments); }
Source:
public void removeProviderLoaderTest() throws Exception { String providerLoaderName = randomAlphanumeric(5); Address providerLoaderAddress = elyOps.getElytronAddress(PROVIDER_LOADER, providerLoaderName); page.navigateToApplication().selectResource(PROVIDER_LOADER_LABEL); try { ops.add(providerLoaderAddress); page.navigateToApplication().selectResource(PROVIDER_LOADER_LABEL).getResourceManager() .removeResource(providerLoaderName).confirmAndDismissReloadRequiredMessage().assertClosed(); assertFalse("Removed resource should not be present in the table any more!", page.resourceIsPresentInMainTable(providerLoaderName)); new ResourceVerifier(providerLoaderAddress, client).verifyDoesNotExist(); } finally { ops.removeIfExists(providerLoaderAddress); adminOps.reloadIfRequired(); } }

Target:
public void removeProviderLoaderTest() throws Exception { String providerLoaderName = randomAlphanumeric(5); Address providerLoaderAddress = elyOps.getElytronAddress(PROVIDER_LOADER, providerLoaderName); try { ops.add(providerLoaderAddress).assertSuccess(); page.navigateToApplication().selectResource(PROVIDER_LOADER_LABEL).getResourceManager() .removeResource(providerLoaderName).confirmAndDismissReloadRequiredMessage().assertClosed(); assertFalse("Removed resource should not be present in the table any more!", page.resourceIsPresentInMainTable(providerLoaderName)); new ResourceVerifier(providerLoaderAddress, client).verifyDoesNotExist(); } finally { ops.removeIfExists(providerLoaderAddress); adminOps.reloadIfRequired(); } }
Source:
public void deleteObservation_ShouldDeleteObservation() { mDatabase.observationRoomDAO().saveObervation(expectedObservationEntity); mDatabase.observationRoomDAO().deleteObservation(expectedObservationEntity); mDatabase.observationRoomDAO().getObservationByUUID("uuid").subscribe(new Subscriber<ObservationEntity>() { @Override public void onSubscribe(Subscription s) { } @Override public void onNext(ObservationEntity observationEntity) { Assert.assertEquals(observationEntity, null); } @Override public void onError(Throwable t) { } @Override public void onComplete() { } }); }

Target:
public void deleteObservation_ShouldDeleteObservation() { mDatabase.observationRoomDAO().saveObservation(expectedObservationEntity); mDatabase.observationRoomDAO().deleteObservation(expectedObservationEntity); mDatabase.observationRoomDAO().getObservationByUUID("uuid").subscribe(new Subscriber<ObservationEntity>() { @Override public void onSubscribe(Subscription s) { } @Override public void onNext(ObservationEntity observationEntity) { Assert.assertNull(observationEntity); } @Override public void onError(Throwable t) { } @Override public void onComplete() { } }); }
Source:
public boolean hasPermission(User user, long id) { boolean hasPermission = hasRole(user, ADMIN_ROLE_ID); if (!hasPermission && user != null && user.permissions != null) { for (Permission permission : user.permissions) { if (permission.id != null && permission.id.longValue() == id) { hasPermission = true; break; } } } if (!hasPermission && user != null && user.roles != null) { for (Role role : user.roles) { if (role.permissions != null) { for (Permission permission : role.permissions) { if (permission.id != null && permission.id.longValue() == id) { hasPermission = true; break; } } } } } return hasPermission; }

Target:
public boolean hasPermission(User user, long id) { boolean hasPermission = hasRole(user, ADMIN_ROLE_ID); if (!hasPermission && user != null) { if (user.roles != null) { for (Role role : user.roles) { if (!hasPermission && role.permissions != null) { hasPermission = hasIdPermission(role.permissions, id); if (hasPermission) { break; } } } } if (!hasPermission && user.permissions != null) { hasPermission = hasIdPermission(user.permissions, id); } } return hasPermission; }
Source:
public boolean isExpandable(Object elementOrTreePath) { Object element; TreePath path; if (elementOrTreePath instanceof TreePath) { path = (TreePath) elementOrTreePath; element = path.getLastSegment(); } else { element = elementOrTreePath; path = null; } IContentProvider cp = getContentProvider(); if (cp instanceof ITreeContentProvider) { ITreeContentProvider tcp = (ITreeContentProvider) cp; return tcp.hasChildren(element); } return false; }

Target:
public boolean isExpandable(Object elementOrTreePath) { Object element; TreePath path = null; if (elementOrTreePath instanceof TreePath) { path = (TreePath) elementOrTreePath; element = path.getLastSegment(); } else { element = elementOrTreePath; } IContentProvider cp = getContentProvider(); if (cp instanceof ITreeContentProvider) { ITreeContentProvider tcp = (ITreeContentProvider) cp; return tcp.hasChildren(element); } return false; }
Source:
private void sendSource(String host, String source) { String url = "http://" + host + "/1/sources/current"; StringBuilder content = new StringBuilder(); content.append("{\"id\":\"" + source + "\"}"); logger.debug("Switching source of host " + host + " to " + source); logger.trace(content.toString()); HttpUtil.executeUrl("POST", url, IOUtils.toInputStream(content.toString()), CONTENT_TYPE_JSON, 1000); }

Target:
private void sendSource(String host, String source) { String url = "http://" + host + "/1/sources/current"; String content = "{\"id\":\"" + source + "\"}"; logger.debug("Switching source of host to {}", host, source); logger.trace(content.toString()); HttpUtil.executeUrl("POST", url, IOUtils.toInputStream(content), CONTENT_TYPE_JSON, 1000); }
Source:
private void showNetworkError(String statusCode) { TextView errorMessage = (TextView) networkError.findViewById(R.id.page_error_message); TextView statusCodeView = (TextView) networkError.findViewById(R.id.network_status_code); TextView statusMessageView = (TextView) networkError.findViewById(R.id.network_status_message); if (!NetworkUtils.isNetworkConnectionPresent(app)) { statusCodeView.setVisibility(View.GONE); statusMessageView.setVisibility(View.GONE); errorMessage.setText(R.string.error_network_error_try_again); } else { errorMessage.setText(R.string.generic_page_error); statusCodeView.setVisibility(View.VISIBLE); statusMessageView.setVisibility(View.VISIBLE); List<String> allStatusCodes = new ArrayList<>(); allStatusCodes.addAll(Arrays.asList(app.getResources().getStringArray(R.array.status_codes))); if (statusCode != null && allStatusCodes.contains(statusCode)) { statusCodeView.setText(statusCode); List<String> allStatusMessages = new ArrayList<>(); allStatusMessages.addAll(Arrays.asList(app.getResources().getStringArray(R.array.status_messages))); statusMessageView.setText(allStatusMessages.get(allStatusCodes.indexOf(statusCode))); } else { statusMessageView.setText("Server status code unavailable"); } } hidePageContent(); ViewAnimations.fadeIn(networkError); }

Target:
private void showNetworkError(String statusCode) { TextView errorMessage = (TextView) networkError.findViewById(R.id.page_error_message); TextView statusCodeView = (TextView) networkError.findViewById(R.id.network_status_code); TextView statusMessageView = (TextView) networkError.findViewById(R.id.network_status_message); if (!NetworkUtils.isNetworkConnectionPresent(app)) { statusCodeView.setVisibility(View.GONE); statusMessageView.setVisibility(View.GONE); errorMessage.setText(R.string.error_network_error_try_again); } else { errorMessage.setText(R.string.generic_page_error); statusCodeView.setVisibility(View.VISIBLE); statusMessageView.setVisibility(View.VISIBLE); List<String> allStatusCodes = new ArrayList<>(); allStatusCodes.addAll(Arrays.asList(app.getResources().getStringArray(R.array.status_codes))); if (statusCode != null && allStatusCodes.contains(statusCode)) { statusCodeView.setText(statusCode); List<String> allStatusMessages = new ArrayList<>(); allStatusMessages.addAll(Arrays.asList(app.getResources().getStringArray(R.array.status_messages))); statusMessageView.setText(allStatusMessages.get(allStatusCodes.indexOf(statusCode))); } else { statusMessageView.setText(R.string.status_code_unavailable); } } hidePageContent(); ViewAnimations.fadeIn(networkError); }
Source:
public void testSaveAirline() { Iterable<Airline> itr = airlineRepository.save(Arrays.asList(a)); Assert.assertThat(itr, Matchers.notNullValue()); Airline airline = airlineRepository.findOne(a.getId()); Assert.assertThat(airline, Matchers.notNullValue()); Assert.assertThat(airline, Matchers.is(a)); Assert.assertThat(airline, Matchers.not(b)); airlineRepository.delete(a.getId()); }

Target:
public void testSaveAirline() { Iterable<Airline> itr = airlineRepository.save(Arrays.asList(a)); assertThat(itr).isNotNull(); Airline airline = airlineRepository.findOne(a.getId()); assertThat(airline).isNotNull(); assertThat(airline).isEqualTo(a); assertThat(airline).isNotEqualTo(b); airlineRepository.delete(a.getId()); }
Source:
public MotorIdle(Motor motor) { super("motorIdle", motor); this.motor = motor; LogKitten.d("MotorIdle created"); }

Target:
public MotorIdle(Motor motor) { this("MotorIdle", motor); }
Source:
private Set<TreeReference> runAndTest(EvaluationContext context, String text, String... matches) { XPathExpression expression; try { expression = XPathParseTool.parseXPath(text); } catch(XPathSyntaxException e) { throw new RuntimeException(e); } TreeReferenceAccumulatingAnalyzer analyzer; if (context == null) { analyzer = new TreeReferenceAccumulatingAnalyzer(); } else { analyzer = new TreeReferenceAccumulatingAnalyzer(context); } Set<TreeReference> results = analyzer.accumulate(expression); if (results == null) { return null; } Set<TreeReference> expressions = new HashSet<>(); for (String match : matches) { expressions.add(XPathReference.getPathExpr(match).getReference()); } Assert.assertEquals(text, expressions, results); return results; }

Target:
private void runAndTest(EvaluationContext context, String text, String... matches) throws AnalysisInvalidException { XPathExpression expression; try { expression = XPathParseTool.parseXPath(text); } catch(XPathSyntaxException e) { throw new RuntimeException(e); } TreeReferenceAccumulatingAnalyzer analyzer; if (context == null) { analyzer = new TreeReferenceAccumulatingAnalyzer(); } else { analyzer = new TreeReferenceAccumulatingAnalyzer(context); } Set<TreeReference> results = analyzer.accumulate(expression); if (results == null) { throw new AnalysisInvalidException(String.format("Couldn't analyze expression: %s",text)); } Set<TreeReference> expressions = new HashSet<>(); for (String match : matches) { expressions.add(XPathReference.getPathExpr(match).getReference()); } Assert.assertEquals(text, expressions, results); }
Source:
public PlanNode visitTableScan(TableScanNode node, RewriteContext<Void> context) { PartitioningHandle partitioning = metadata.getLayout(session, node.getTable()) .getTablePartitioning() .map(TablePartitioning::getPartitioningHandle) .orElse(SOURCE_DISTRIBUTION); if (partitioning.equals(fragmentPartitioningHandle)) { return node; } TableHandle newTableHandle = metadata.getAlternativeTableHandle(session, node.getTable(), fragmentPartitioningHandle); return new TableScanNode( node.getId(), newTableHandle, node.getOutputSymbols(), node.getAssignments(), Optional.empty(), node.getCurrentConstraint(), node.getEnforcedConstraint(), node.isTemporaryTable()); }

Target:
public PlanNode visitTableScan(TableScanNode node, RewriteContext<Void> context) { PartitioningHandle partitioning = metadata.getLayout(session, node.getTable()) .getTablePartitioning() .map(TablePartitioning::getPartitioningHandle) .orElse(SOURCE_DISTRIBUTION); if (partitioning.equals(fragmentPartitioningHandle)) { return node; } TableHandle newTableHandle = metadata.getAlternativeTableHandle(session, node.getTable(), fragmentPartitioningHandle); return new TableScanNode( node.getId(), newTableHandle, node.getOutputSymbols(), node.getAssignments(), node.getCurrentConstraint(), node.getEnforcedConstraint(), node.isTemporaryTable()); }
Source:
public Iterable<VirtualMachine> listNodesByIds(Iterable<String> ids) { return null; }

Target:
public Iterable<VirtualMachine> listNodesByIds(Iterable<String> ids) { Iterable<VirtualMachine> vms = ImmutableSet.of(); try (VSphereServiceInstance instance = serviceInstance.get();) { Folder nodesFolder = instance.getInstance().getRootFolder(); List<List<String>> list = new ArrayList<List<String>>(); Iterator<String> idsIterator = ids.iterator(); while (idsIterator.hasNext()) { list.add(Lists.newArrayList("VirtualMachine", idsIterator.next())); } String[][] typeInfo = ListsUtils.ListToArray(list); ManagedEntity[] managedEntities = new InventoryNavigator(nodesFolder).searchManagedEntities( typeInfo, true); vms = Iterables.transform(Arrays.asList(managedEntities), new Function<ManagedEntity, VirtualMachine>() { public VirtualMachine apply(ManagedEntity input) { return (VirtualMachine) input; } }); } catch (Throwable e) { logger.error("Can't find vms ", e); } return vms; }
Source:
private void buildFontList(String preferredFont, AssetManager assets) { fonts.clear(); fonts.put("default", Typeface.defaultFromStyle(Typeface.NORMAL)); String[] files = null; try { files = assets.list(FONT_PATH); } catch (IOException | RuntimeException e) { e.printStackTrace(); } if (files == null) { Timber.e("Couldn't load fonts from files?"); return; } for (String file : files) { String fileName = String.format("%s/%s", FONT_PATH, file); fonts.put(fileName, Typeface.createFromAsset(assets, fileName)); Timber.i("Processed Font: %s", fileName); } setCurrentFont(preferredFont); }

Target:
public void buildFontList(String preferredFont, AssetManager assets) { fonts.clear(); fonts.put("default", Typeface.defaultFromStyle(Typeface.NORMAL)); String[] files = null; try { files = assets.list(FONT_PATH); } catch (IOException | RuntimeException e) { e.printStackTrace(); } if (files == null) { Timber.w("Couldn't load font assets from %s", FONT_PATH); return; } for (String file : files) { String fileName = String.format("%s/%s", FONT_PATH, file); fonts.put(fileName, Typeface.createFromAsset(assets, fileName)); Timber.i("Processed Font: %s", fileName); } setCurrentFont(preferredFont); }
Source:
private void addWarnings(Pool pool, ModelMap model) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); Set<String> duplicates = pool.getDuplicateIndicesSequences(); Set<String> nearDuplicates = pool.getNearDuplicateIndicesSequences(); model.put("duplicateIndicesSequences", mapper.writeValueAsString(duplicates)); model.put("nearDuplicateIndicesSequences", mapper.writeValueAsString(nearDuplicates)); List<String> warnings = new ArrayList<>(); if (!duplicates.isEmpty()) { warnings.add("This pool contains duplicate indices!"); } else if (!nearDuplicates.isEmpty()) { warnings.add("This pool contains near-duplicate indices!"); } if (pool.hasViewWithoutIndex()) { warnings.add("This pool contains a dilution with no index!"); } addConsentWarning(pool, warnings); model.addAttribute("warnings", warnings); }

Target:
private void addWarnings(Pool pool, ModelMap model) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); Set<String> duplicates = pool.getDuplicateIndicesSequences(); Set<String> nearDuplicates = pool.getNearDuplicateIndicesSequences(); model.put("duplicateIndicesSequences", mapper.writeValueAsString(duplicates)); model.put("nearDuplicateIndicesSequences", mapper.writeValueAsString(nearDuplicates)); List<String> warnings = new ArrayList<>(); if (!duplicates.isEmpty()) { warnings.add("This pool contains duplicate indices!"); } else if (!nearDuplicates.isEmpty()) { warnings.add("This pool contains near-duplicate indices!"); } if (pool.hasLibrariesWithoutIndex()) { warnings.add("This pool contains multiple libraries with no index!"); } addConsentWarning(pool, warnings); model.addAttribute("warnings", warnings); }
Source:
private void triggerMatchingPipelines(T event) { try { List<Pipeline> matchingPipelines = eventHandler.getMatchingPipelines(event, pipelineCache); matchingPipelines.stream() .filter(p -> p.getErrorMessage() == null) .map(pipelinePostProcessorHandler::process) .forEach( p -> { recordMatchingPipeline(p); pipelineInitiator.startPipeline(p, PipelineInitiator.TriggerSource.EVENT); }); matchingPipelines.stream() .filter(p -> p.getErrorMessage() != null) .forEach(pipelineInitiator::recordPipelineFailure); } catch (TimeoutException e) { log.error("Failed to get pipeline configs", e); } }

Target:
private void triggerMatchingPipelines(T event) { try { List<Pipeline> matchingPipelines = eventHandler.getMatchingPipelines(event, pipelineCache); matchingPipelines.stream() .filter(p -> Strings.isNullOrEmpty(p.getErrorMessage())) .map(pipelinePostProcessorHandler::process) .forEach( p -> { recordMatchingPipeline(p); pipelineInitiator.startPipeline(p, PipelineInitiator.TriggerSource.EVENT); }); matchingPipelines.stream() .filter(p -> !Strings.isNullOrEmpty(p.getErrorMessage())) .forEach(pipelineInitiator::recordPipelineFailure); } catch (TimeoutException e) { log.error("Failed to get pipeline configs", e); } }