private static boolean isWildCard(String value) { // not contaiins '.' ? return StringUtils.containsAny(value, new char[] { '*', '?', '+', '|', '(', ')', '{', '}', '[', ']', '\\', '$', '^' }); }
@Override public String mapKey2Field(String key, KeyInformation information) { Preconditions.checkArgument(!StringUtils.containsAny(key,new char[]{' '}),"Invalid key name provided: %s",key); return key; }
private static boolean containsCharToEscape(Serializable s) { return StringUtils.containsAny(s.toString(), CHAR_TO_ESCAPE); }
static void checkKeyValidity(String key) { Preconditions.checkArgument(!StringUtils.containsAny(key, new char[]{ IndexProvider.REPLACEMENT_CHAR }), "Invalid key name containing reserved character %c provided: %s", IndexProvider.REPLACEMENT_CHAR, key); }
return false; return containsAny(str, searchChars.toCharArray());
public ConfigElement(ConfigNamespace namespace, String name, String description) { Preconditions.checkArgument(StringUtils.isNotBlank(name),"Name cannot be empty: %s",name); Preconditions.checkArgument(!StringUtils.containsAny(name, ILLEGAL_CHARS),"Name contains illegal character: %s (%s)",name,ILLEGAL_CHARS); Preconditions.checkArgument(namespace!=null || this instanceof ConfigNamespace,"Need to specify namespace for ConfigOption"); Preconditions.checkArgument(StringUtils.isNotBlank(description)); this.namespace = namespace; this.name = name; this.description = description; if (namespace!=null) namespace.registerChild(this); }
public ConfigElement(ConfigNamespace namespace, String name, String description) { Preconditions.checkArgument(StringUtils.isNotBlank(name),"Name cannot be empty: %s",name); Preconditions.checkArgument(!StringUtils.containsAny(name, ILLEGAL_CHARS),"Name contains illegal character: %s (%s)",name,ILLEGAL_CHARS); Preconditions.checkArgument(namespace!=null || this instanceof ConfigNamespace,"Need to specify namespace for ConfigOption"); Preconditions.checkArgument(StringUtils.isNotBlank(description)); this.namespace = namespace; this.name = name; this.description = description; if (namespace!=null) namespace.registerChild(this); }
if ( StringUtils.containsAny(quoteless, CSV_SEARCH_CHARS) ) {
public static boolean hasBadText( String value ) { Matcher matcher = PATTERN.matcher( value ); if ( matcher.find() ) { return true; } return StringUtils.containsAny( value, BAD_CHARACTERS_TO_ESCAPE ); }
public static String getOrGenerateUniqueInstanceId(Configuration config) { String uid; if (!config.has(UNIQUE_INSTANCE_ID)) { uid = computeUniqueInstanceId(config); log.info("Generated {}={}", UNIQUE_INSTANCE_ID.getName(), uid); } else { uid = config.get(UNIQUE_INSTANCE_ID); } Preconditions.checkArgument(!StringUtils.containsAny(uid,ConfigElement.ILLEGAL_CHARS),"Invalid unique identifier: %s",uid); return uid; }
public static String getOrGenerateUniqueInstanceId(Configuration config) { String uid; if (!config.has(UNIQUE_INSTANCE_ID)) { uid = computeUniqueInstanceId(config); log.info("Generated {}={}", UNIQUE_INSTANCE_ID.getName(), uid); } else { uid = config.get(UNIQUE_INSTANCE_ID); } Preconditions.checkArgument(!StringUtils.containsAny(uid,ConfigElement.ILLEGAL_CHARS),"Invalid unique identifier: %s",uid); return uid; }
@Override public String mapKey2Field(String key, KeyInformation keyInfo) { Preconditions.checkArgument(!StringUtils.containsAny(key, new char[]{' '}),"Invalid key name provided: %s",key); if (!dynFields) return key; if (ParameterType.MAPPED_NAME.hasParameter(keyInfo.getParameters())) return key;
private boolean validated() { if ( StringUtils.containsAny( wName.getText(), "%\"\\/:[]*|\t\r\n" ) ) { MessageBox messageBox = new MessageBox( shell, SWT.ERROR ); messageBox.setMessage( BaseMessages.getString( PKG, "RunConfiguration.InvalidChars.Message" ) ); messageBox.setText( BaseMessages.getString( PKG, "RunConfiguration.InvalidChars.Title" ) ); messageBox.open(); return false; } return true; }
public static String getPath(ConfigElement element, boolean includeRoot, String... umbrellaElements) { Preconditions.checkNotNull(element); if (umbrellaElements==null) umbrellaElements = new String[0]; StringBuilder path = new StringBuilder(element.getName()); int umbrellaPos = umbrellaElements.length-1; while (!element.isRoot() && !element.getNamespace().isRoot()) { ConfigNamespace parent = element.getNamespace(); if (parent.isUmbrella()) { Preconditions.checkArgument(umbrellaPos>=0,"Missing umbrella element path for element: %s",element); String umbrellaName = umbrellaElements[umbrellaPos]; Preconditions.checkArgument(!StringUtils.containsAny(umbrellaName,ILLEGAL_CHARS),"Invalid umbrella name provided: %s. Contains illegal chars",umbrellaName); path.insert(0, umbrellaName + SEPARATOR); umbrellaPos--; } path.insert(0, parent.getName() + SEPARATOR); element = parent; } if (includeRoot) { // Assumes that roots are not umbrellas // If roots could be umbrellas, we might have to change the interpretation of umbrellaElements path.insert(0, (element.isRoot() ? element.getName() : element.getNamespace().getName()) + SEPARATOR); } //Don't make this check so that we can still access more general config items Preconditions.checkArgument(umbrellaPos<0,"Found unused umbrella element: %s",umbrellaPos<0?null:umbrellaElements[umbrellaPos]); return path.toString(); }
public static String getPath(ConfigElement element, boolean includeRoot, String... umbrellaElements) { Preconditions.checkNotNull(element); if (umbrellaElements==null) umbrellaElements = new String[0]; String path = element.getName(); int umbrellaPos = umbrellaElements.length-1; while (!element.isRoot() && !element.getNamespace().isRoot()) { ConfigNamespace parent = element.getNamespace(); if (parent.isUmbrella()) { Preconditions.checkArgument(umbrellaPos>=0,"Missing umbrella element path for element: %s",element); String umbrellaName = umbrellaElements[umbrellaPos]; Preconditions.checkArgument(!StringUtils.containsAny(umbrellaName,ILLEGAL_CHARS),"Invalid umbrella name provided: %s. Contains illegal chars",umbrellaName); path = umbrellaName + SEPARATOR + path; umbrellaPos--; } path = parent.getName() + SEPARATOR + path; element = parent; } if (includeRoot) { // Assumes that roots are not umbrellas // If roots could be umbrellas, we might have to change the interpretation of umbrellaElements path = (element.isRoot() ? element.getName() : element.getNamespace().getName()) + SEPARATOR + path; } //Don't make this check so that we can still access more general config items Preconditions.checkArgument(umbrellaPos<0,"Found unused umbrella element: %s",umbrellaPos<0?null:umbrellaElements[umbrellaPos]); return path; }
private boolean shouldUseQuotes(final LookupElement lookupElement) { return StringUtils.containsAny(lookupElement.getLookupString(), RESERVED_YAML_CHARS); }
while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); if (!StringUtils.containsAny(fromArray[1] + ".", token)) { throw new QueryHandlerException("bad query format with invalid alias:" + token);
public static String check( final String value, final String errorMessage ) { if ( StringUtils.containsAny( value, ILLEGAL_CHARACTERS ) ) { throw new IllegalArgumentException( errorMessage ); } return value; } }
public ConfigElement(ConfigNamespace namespace, String name, String description) { Preconditions.checkArgument(StringUtils.isNotBlank(name),"Name cannot be empty: %s",name); Preconditions.checkArgument(!StringUtils.containsAny(name, ILLEGAL_CHARS),"Name contains illegal character: %s (%s)",name,ILLEGAL_CHARS); Preconditions.checkArgument(namespace!=null || this instanceof ConfigNamespace,"Need to specify namespace for ConfigOption"); Preconditions.checkArgument(StringUtils.isNotBlank(description)); this.namespace = namespace; this.name = name; this.description = description; if (namespace!=null) namespace.registerChild(this); }
@Override public void visitToken(Token token) { for (Trivia trivia : token.getTrivia()) { if (trivia.isComment() && trivia.getToken().getLine() < token.getLine()) { String comment = trivia.getToken().getOriginalValue(); if (!comment.startsWith(getSingleLineCommentSyntaxPrefix()) && !StringUtils.containsAny(comment, "\r\n")) { getContext().createLineViolation(this, "This single line comment should use the single line comment syntax \"{0}\"", trivia.getToken(), getSingleLineCommentSyntaxPrefix()); } } } }