/** * <p>Case insensitive check if a String starts with a specified prefix.</p> * * <p><code>null</code>s are handled without exceptions. Two <code>null</code> * references are considered to be equal. The comparison is case insensitive.</p> * * <pre> * StringUtils.startsWithIgnoreCase(null, null) = true * StringUtils.startsWithIgnoreCase(null, "abc") = false * StringUtils.startsWithIgnoreCase("abcdef", null) = false * StringUtils.startsWithIgnoreCase("abcdef", "abc") = true * StringUtils.startsWithIgnoreCase("ABCDEF", "abc") = true * </pre> * * @see java.lang.String#startsWith(String) * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @return <code>true</code> if the String starts with the prefix, case insensitive, or * both <code>null</code> * @since 2.4 */ public static boolean startsWithIgnoreCase(String str, String prefix) { return startsWith(str, prefix, true); }
/** * <p>Check if a String starts with a specified prefix.</p> * * <p><code>null</code>s are handled without exceptions. Two <code>null</code> * references are considered to be equal. The comparison is case sensitive.</p> * * <pre> * StringUtils.startsWith(null, null) = true * StringUtils.startsWith(null, "abc") = false * StringUtils.startsWith("abcdef", null) = false * StringUtils.startsWith("abcdef", "abc") = true * StringUtils.startsWith("ABCDEF", "abc") = false * </pre> * * @see java.lang.String#startsWith(String) * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @return <code>true</code> if the String starts with the prefix, case sensitive, or * both <code>null</code> * @since 2.4 */ public static boolean startsWith(String str, String prefix) { return startsWith(str, prefix, false); }
public static boolean isSystemBlacklisted(String databaseName, String tableName) { return "mysql".equals(databaseName) && ("ha_health_check".equals(tableName) || StringUtils.startsWith(tableName, "rds_heartbeat")); }
if (StringUtils.startsWith(string, searchString)) { return true;
private NewController(Context context, String path) { if (StringUtils.isBlank(path)) { throw new IllegalArgumentException("WS controller path must not be empty"); } if (StringUtils.startsWith(path, "/") || StringUtils.endsWith(path, "/")) { throw new IllegalArgumentException("WS controller path must not start or end with slash: " + path); } this.context = context; this.path = path; }
public List<String> getKeysStartingWith(String prefix) { return getProperties().keySet().stream() .filter(key -> StringUtils.startsWith(key, prefix)) .collect(Collectors.toList()); }
static boolean isRuleProperty(String propertyKey) { return StringUtils.startsWith(propertyKey, RULE_PREFIX) && StringUtils.endsWith(propertyKey, NAME_SUFFIX) && !propertyKey.contains(".param."); } }
@VisibleForTesting static Properties extractCommonsDbcpProperties(Properties properties) { Properties result = new Properties(); result.setProperty("accessToUnderlyingConnectionAllowed", "true"); for (Map.Entry<Object, Object> entry : properties.entrySet()) { String key = (String) entry.getKey(); if (StringUtils.startsWith(key, SONAR_JDBC)) { String resolvedKey = toDbcpPropertyKey(key); String existingValue = (String) result.setProperty(resolvedKey, (String) entry.getValue()); checkState(existingValue == null || existingValue.equals(entry.getValue()), "Duplicate property declaration for resolved jdbc key '%s': conflicting values are '%s' and '%s'", resolvedKey, existingValue, entry.getValue()); result.setProperty(toDbcpPropertyKey(key), (String) entry.getValue()); } } return result; }
private void considerOldScmUrl() { settings.get(ScannerProperties.LINKS_SOURCES_DEV).ifPresent(url -> { if (StringUtils.startsWith(url, "scm:")) { String[] split = url.split(":"); if (split.length > 1) { setProviderIfSupported(split[1]); } } }); }
@Override public void start() { if (embeddedDatabase == null) { String jdbcUrl = config.get(JDBC_URL.getKey()).get(); if (startsWith(jdbcUrl, URL_PREFIX)) { embeddedDatabase = createEmbeddedDatabase(); embeddedDatabase.start(); } } }
for (String include : includes) { if (StringUtils.isNotBlank(include) && !StringUtils.startsWith(include, "#")) { includesBuilder.append(INCLUDES_KEY_NAME).append("+=").append(include).append("\n");
/** * Is a given expression asking for function documentation? * @param expression The expression. */ private boolean isDoc(String expression) { return StringUtils.startsWith(expression, "?"); }
/** * Is a given expression a built-in magic? * @param expression The expression. */ private boolean isMagic(String expression) { return StringUtils.startsWith(expression, "%"); }
@Override public boolean accepts(@NotNull YAMLScalar yamlScalar, ProcessingContext processingContext) { return StringUtils.startsWith(yamlScalar.getTextValue(), value); } }
private String resolveControllerHomeDir() { String userHomeFromEnv = System.getenv("NGRINDER_HOME"); String userHomeFromProperty = System.getProperty("ngrinder.home"); String userHome = StringUtils.defaultIfEmpty(userHomeFromProperty, userHomeFromEnv); if (StringUtils.isEmpty(userHome)) { userHome = System.getProperty("user.home") + File.separator + NGRINDER_CONTROLLER_DEFAULT_FOLDER; } else if (StringUtils.startsWith(userHome, "~" + File.separator)) { userHome = System.getProperty("user.home") + File.separator + userHome.substring(2); } else if (StringUtils.startsWith(userHome, "." + File.separator)) { userHome = System.getProperty("user.dir") + File.separator + userHome.substring(2); } return FilenameUtils.normalize(userHome); }
&& StringUtils.startsWith( realserver, "file://" ) ) { realserver = StringUtils.remove( realserver, "file://" );
if (StringUtils.isEmpty(userHome)) { userHome = System.getProperty("user.home") + File.separator + NGRINDER_DEFAULT_FOLDER; } else if (StringUtils.startsWith(userHome, "~" + File.separator)) { userHome = System.getProperty("user.home") + File.separator + userHome.substring(2); } else if (StringUtils.startsWith(userHome, "." + File.separator)) { userHome = System.getProperty("user.dir") + File.separator + userHome.substring(2);
@Test public void setup() { try { EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); Assert.fail("Should have gone to catch block!"); } catch (MetamodelLoaderException mlex) { Assert.assertTrue(StringUtils.startsWith(mlex.getMessage(), "Class:class com.impetus.kundera.metadata.mappedsuperclass.InvalidPersonEntityis annotated with @MappedSuperClass and @Entity not allowed")); } }
/** * From documentation for Javadoc-tool: * Documentation comments should be recognized only when placed * immediately before class, interface, constructor, method, or field declarations. */ private static boolean isJavadoc(String comment) { return StringUtils.startsWith(comment, "/**"); }
private boolean useNewUi(final String token, final StaplerRequest req) { return isNewUi() && (StringUtils.startsWith(token, "dotCI") || //job pages (NumberUtils.isNumber(token) && (StringUtils.isEmpty(req.getRestOfPath()) || StringUtils.contains(req.getRestOfPath(), "dotCI")))); // buildpages }