/** * Tokenize the given String into a String array via a StringTokenizer. * Trims tokens and omits empty tokens. * <p>The given delimiters string is supposed to consist of any number of * delimiter characters. Each of those characters can be used to separate * tokens. A delimiter is always a single character; for multi-character * delimiters, consider using <code>delimitedListToStringArray</code> * <p/> * <p>Copied from the Spring Framework while retaining all license, copyright and author information. * * @param str the String to tokenize * @param delimiters the delimiter characters, assembled as String * (each of those characters is individually considered as delimiter). * @return an array of the tokens * @see java.util.StringTokenizer * @see java.lang.String#trim() */ public static String[] tokenizeToStringArray(String str, String delimiters) { return tokenizeToStringArray(str, delimiters, true, true); }
protected boolean isIpv4Candidate(String host) { String[] quads = StringUtils.tokenizeToStringArray(host, "."); if (quads == null || quads.length != 4) { return false; } for (String quad : quads) { if (!quad.equals("*")) { try { Integer.parseInt(quad); } catch (NumberFormatException nfe) { return false; } } } return true; }
public void setAuthorizedHosts(String authorizedHosts) { if (!StringUtils.hasText(authorizedHosts)) { throw new IllegalArgumentException("authorizedHosts argument cannot be null or empty."); } String[] hosts = StringUtils.tokenizeToStringArray(authorizedHosts, ", \t"); for (String host : hosts) { //replace any periods with \\. to ensure the regex works: String periodsReplaced = host.replace(".", "\\."); //check for IPv4: String wildcardsReplaced = periodsReplaced.replace("*", IPV4_QUAD_REGEX); if (IPV4_PATTERN.matcher(wildcardsReplaced).matches()) { authorizedIps.put(host, wildcardsReplaced); } else { } } }
String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator); String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
/** * Specifies a comma-delimited list of JNDI names to lookup, each one corresponding to a jndi-bound * {@link Realm Realm}. The Realms will be made available to the SecurityManager in the order * they are defined. * * @param commaDelimited a comma-delimited list of JNDI names, each representing the JNDI name used to * look up a corresponding jndi-bound Realm. * @throws IllegalStateException if the specified argument is null or the empty string. */ public void setJndiNames(String commaDelimited) throws IllegalStateException { String arg = StringUtils.clean(commaDelimited); if (arg == null) { String msg = "One or more comma-delimited jndi names must be specified for the " + getClass().getName() + " to locate Realms."; throw new IllegalStateException(msg); } String[] names = StringUtils.tokenizeToStringArray(arg, ","); setJndiNames(Arrays.asList(names)); }
String[] pattDirs = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator); String[] pathDirs = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
/** * Specifies a comma-delimited list of JNDI names to lookup, each one corresponding to a jndi-bound * {@link Realm Realm}. The Realms will be made available to the SecurityManager in the order * they are defined. * * @param commaDelimited a comma-delimited list of JNDI names, each representing the JNDI name used to * look up a corresponding jndi-bound Realm. * @throws IllegalStateException if the specified argument is null or the empty string. */ public void setJndiNames(String commaDelimited) throws IllegalStateException { String arg = StringUtils.clean(commaDelimited); if (arg == null) { String msg = "One or more comma-delimited jndi names must be specified for the " + getClass().getName() + " to locate Realms."; throw new IllegalStateException(msg); } String[] names = StringUtils.tokenizeToStringArray(arg, ","); setJndiNames(Arrays.asList(names)); }
String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator); String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
String[] pattDirs = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator); String[] pathDirs = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
/** * Tokenize the given String into a String array via a StringTokenizer. * Trims tokens and omits empty tokens. * <p>The given delimiters string is supposed to consist of any number of * delimiter characters. Each of those characters can be used to separate * tokens. A delimiter is always a single character; for multi-character * delimiters, consider using <code>delimitedListToStringArray</code> * * <p>Copied from the Spring Framework while retaining all license, copyright and author information. * * @param str the String to tokenize * @param delimiters the delimiter characters, assembled as String * (each of those characters is individually considered as delimiter). * @return an array of the tokens * @see java.util.StringTokenizer * @see java.lang.String#trim() */ public static String[] tokenizeToStringArray(String str, String delimiters) { return tokenizeToStringArray(str, delimiters, true, true); }
/** * Tokenize the given String into a String array via a StringTokenizer. * Trims tokens and omits empty tokens. * <p>The given delimiters string is supposed to consist of any number of * delimiter characters. Each of those characters can be used to separate * tokens. A delimiter is always a single character; for multi-character * delimiters, consider using <code>delimitedListToStringArray</code> * <p/> * <p>Copied from the Spring Framework while retaining all license, copyright and author information. * * @param str the String to tokenize * @param delimiters the delimiter characters, assembled as String * (each of those characters is individually considered as delimiter). * @return an array of the tokens * @see java.util.StringTokenizer * @see java.lang.String#trim() */ public static String[] tokenizeToStringArray(String str, String delimiters) { return tokenizeToStringArray(str, delimiters, true, true); }
String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator); String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
/** * Specifies a comma-delimited list of JNDI names to lookup, each one corresponding to a jndi-bound * {@link Realm Realm}. The Realms will be made available to the SecurityManager in the order * they are defined. * * @param commaDelimited a comma-delimited list of JNDI names, each representing the JNDI name used to * look up a corresponding jndi-bound Realm. * @throws IllegalStateException if the specified argument is null or the empty string. */ public void setJndiNames(String commaDelimited) throws IllegalStateException { String arg = StringUtils.clean(commaDelimited); if (arg == null) { String msg = "One or more comma-delimited jndi names must be specified for the " + getClass().getName() + " to locate Realms."; throw new IllegalStateException(msg); } String[] names = StringUtils.tokenizeToStringArray(arg, ","); setJndiNames(Arrays.asList(names)); }
String[] pattDirs = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator); String[] pathDirs = StringUtils.tokenizeToStringArray(path, this.pathSeparator);