Refine search
/** * Same as {@link #regenerateTokenFromLegacy(Secret)} but only applied if there is an existing legacy token. * <p> * Otherwise, no effect. */ public synchronized void regenerateTokenFromLegacyIfRequired(@Nonnull Secret newLegacyApiToken) { if(tokenList.stream().noneMatch(HashedToken::isLegacy)){ deleteAllLegacyAndGenerateNewOne(newLegacyApiToken, true); } }
/** * Checks whether all of generic type arguments are immutable. * If at least one argument is mutable, we assume that the whole list of type arguments * is mutable. * @param typeArgsClassNames type arguments class names. * @return true if all of generic type arguments are immutable. */ private boolean areImmutableTypeArguments(List<String> typeArgsClassNames) { return typeArgsClassNames.stream().noneMatch( typeName -> { return !immutableClassShortNames.contains(typeName) && !immutableClassCanonicalNames.contains(typeName); }); }
@Override public Request authenticate(Route route, Response response) { // skip if we already tried or were not asked for Kerberos if (response.request().headers(AUTHORIZATION).stream().anyMatch(SpnegoHandler::isNegotiate) || response.headers(WWW_AUTHENTICATE).stream().noneMatch(SpnegoHandler::isNegotiate)) { return null; } return authenticate(response.request()); }
public static BadRequestException create(List<String> errorMessages) { checkArgument(!errorMessages.isEmpty(), "At least one error message is required"); checkArgument(errorMessages.stream().noneMatch(message -> message == null || message.isEmpty()), "Message cannot be empty"); return new BadRequestException(errorMessages); }
static void addMaxHeap(final List<String> commandLine, final String maxHeap) { if (StringUtils.isNotBlank(maxHeap)) { commandLine.add("-Xmx" + maxHeap); String collectorKey = "-XX:+UseConcMarkSweepGC"; if (!commandLine.contains(collectorKey)) { commandLine.add(collectorKey); } String occupancyFractionKey = "-XX:CMSInitiatingOccupancyFraction="; if (commandLine.stream().noneMatch(s -> s.contains(occupancyFractionKey))) { commandLine.add(occupancyFractionKey + CMS_INITIAL_OCCUPANCY_FRACTION); } } }
private static void verifyUsingG1Gc() { try { List<String> garbageCollectors = ManagementFactory.getGarbageCollectorMXBeans().stream() .map(GarbageCollectorMXBean::getName) .collect(toImmutableList()); if (garbageCollectors.stream().noneMatch(name -> name.toUpperCase(Locale.US).startsWith("G1 "))) { warnRequirement("Current garbage collectors are %s. Presto recommends the G1 garbage collector.", garbageCollectors); } } catch (RuntimeException e) { // This should never happen since we have verified the OS and JVM above failRequirement("Cannot read garbage collector information: %s", e); } }
/** * Install or remove an {@link ExecutorChannelInterceptor} that invokes a * completion task once the message is handled. * @param channel the channel to configure * @param preservePublishOrder whether preserve order is on or off based on * which an interceptor is either added or removed. */ static void configureOutboundChannel(MessageChannel channel, boolean preservePublishOrder) { if (preservePublishOrder) { Assert.isInstanceOf(ExecutorSubscribableChannel.class, channel, "An ExecutorSubscribableChannel is required for `preservePublishOrder`"); ExecutorSubscribableChannel execChannel = (ExecutorSubscribableChannel) channel; if (execChannel.getInterceptors().stream().noneMatch(i -> i instanceof CallbackInterceptor)) { execChannel.addInterceptor(0, new CallbackInterceptor()); } } else if (channel instanceof ExecutorSubscribableChannel) { ExecutorSubscribableChannel execChannel = (ExecutorSubscribableChannel) channel; execChannel.getInterceptors().stream().filter(i -> i instanceof CallbackInterceptor) .findFirst() .map(execChannel::removeInterceptor); } }
public static ApkSignature getApkSignature(JadxWrapper wrapper) { // Only show the ApkSignature node if an AndroidManifest.xml is present. // Without a manifest the Google ApkVerifier refuses to work. if (wrapper.getResources().stream().noneMatch(r -> "AndroidManifest.xml".equals(r.getName()))) { return null; } File openFile = wrapper.getOpenFile(); return new ApkSignature(openFile); }
private static List<BuiltInQProfile> toQualityProfiles(List<BuiltInQProfile.Builder> builders) { if (builders.stream().noneMatch(BuiltInQProfile.Builder::isDeclaredDefault)) { Optional<BuiltInQProfile.Builder> sonarWayProfile = builders.stream().filter(builder -> builder.getName().equals(DEFAULT_PROFILE_NAME)).findFirst(); if (sonarWayProfile.isPresent()) { sonarWayProfile.get().setComputedDefault(true); } else { builders.iterator().next().setComputedDefault(true); } } return builders.stream() .map(BuiltInQProfile.Builder::build) .collect(MoreCollectors.toList(builders.size())); } }
private boolean isInliningCandidate(Expression expression, ProjectNode node) { // TryExpressions should not be pushed down. However they are now being handled as lambda // passed to a FunctionCall now and should not affect predicate push down. So we want to make // sure the conjuncts are not TryExpressions. verify(AstUtils.preOrder(expression).noneMatch(TryExpression.class::isInstance)); // candidate symbols for inlining are // 1. references to simple constants // 2. references to complex expressions that appear only once // which come from the node, as opposed to an enclosing scope. Set<Symbol> childOutputSet = ImmutableSet.copyOf(node.getOutputSymbols()); Map<Symbol, Long> dependencies = SymbolsExtractor.extractAll(expression).stream() .filter(childOutputSet::contains) .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); return dependencies.entrySet().stream() .allMatch(entry -> entry.getValue() == 1 || node.getAssignments().get(entry.getKey()) instanceof Literal); }
private void executeStatements(final String queries) { final List<PreparedStatement<?>> preparedStatements = ksqlEngine.parseStatements(queries); if (failOnNoQueries) { final boolean noQueries = preparedStatements.stream() .map(PreparedStatement::getStatement) .noneMatch(stmt -> stmt instanceof QueryContainer); if (noQueries) { throw new KsqlException("The SQL file did not contain any queries"); } } preparedStatements.forEach(this::executeStatement); }
private ActualProperties deriveProperties(PlanNode result, List<ActualProperties> inputProperties) { // TODO: move this logic to PlanSanityChecker once PropertyDerivations.deriveProperties fully supports local exchanges ActualProperties outputProperties = PropertyDerivations.deriveProperties(result, inputProperties, metadata, session, types, parser); verify(result instanceof SemiJoinNode || inputProperties.stream().noneMatch(ActualProperties::isNullsAndAnyReplicated) || outputProperties.isNullsAndAnyReplicated(), "SemiJoinNode is the only node that can strip null replication"); return outputProperties; }