Validates that {@link URI} expressed as {@link String} is of proper
format and could be converted to an instance of the {@link URI}.
8229
public static boolean isURI(String source){
		Pattern pattern = Pattern.compile("^[a-zA-Z0-9\\-_]+:");
		return pattern.matcher(source).find();
	}
1167904
private static String validString(Object data) throws IOException {
        // Null is ok
        if (data == null) {
            return "";
        }
        if (!(data instanceof String)) {
            throw new IOException("Invalid non-String value found!");
        }
        return (String) data;
    }
929477
public static URI stringAsURI(String s) throws IOException {
    URI u = null;
    // try to make a URI
    try {
      u = new URI(s);
    } catch (URISyntaxException e){
      LOG.error("Syntax error in URI " + s
          + ". Please check hdfs configuration.", e);
    }

    // if URI is null or scheme is undefined, then assume it's file://
    if(u == null || u.getScheme() == null){
      LOG.warn("Path " + s + " should be specified as a URI "
          + "in configuration files. Please update hdfs configuration.");
      u = fileAsURI(new File(s));
    }
    return u;
  }
597632
private static boolean validateValue(String value) {
    if (value.length() > VALUE_MAX_SIZE || value.charAt(value.length() - 1) == ' ' /* '\u0020' */) {
      return false;
    }
    for (int i = 0; i < value.length(); i++) {
      char c = value.charAt(i);
      if (c == ',' || c == '=' || c < ' ' /* '\u0020' */ || c > '~' /* '\u007E' */) {
        return false;
      }
    }
    return true;
  }
796251
public static void validateStringValue(String value) throws ParameterException {
		Validate.notNull(value);
		Validate.notEmpty(value);
	}
1270318
public boolean isValid(String value) {
        if (value == null) {
            return false;
        }
        for (Pattern pattern : patterns) {
            if (pattern.matcher(value).matches()) {
                return true;
            }
        }
        return false;
    }
655847
protected boolean match(final URI uri) {

        final String methodName = "match";
        final String uriStr = prepareUri(uri);

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, methodName, this, uriStr, ignoreCase, wildcard);
        }

        if (this.matcher == null) {
            if (ignoreCase) {
                if (pattern.equalsIgnoreCase(uriStr)) {
                    return true;
                }
                if (wildcard && uriStr.toLowerCase().startsWith(pattern)) {
                    return true;
                }
            } else {
                if (pattern.equals(uriStr)) {
                    return true;
                }
                if (wildcard && uriStr.startsWith(pattern)) {
                    return true;
                }
            }
        } else {
            return this.matcher.matcher(uriStr).matches();
        }

        return false;
    }
874215
protected boolean isValidURL(String inputString) {

        boolean isValid = false;
        try {
            if (inputString != null) {
                URL tempURL = new URL(inputString);
                isValid = (tempURL.getProtocol() != null);
            }
        } catch (MalformedURLException mue) {
            // ignore because it is not harmful
        }
        return isValid;
    }
765434
public final static boolean isValidURL(String url) {
        if (url == null) {
            return false;
        } else {
            return Patterns.WEB_URL.matcher(url).matches();
        }
    }
176798
protected String scanScheme(String uri)
  {
    int i = 0;
    if (uri == null)
      return null;

    int length = uri.length();
    if (length == 0)
      return null;

    int ch = uri.charAt(0);
    if (ch >= 'a' && ch <= 'z' ||
        ch >= 'A' && ch <= 'Z') {
      for (i = 1; i < length; i++) {
        ch = uri.charAt(i);

        if (ch == ':')
          return uri.substring(0, i).toLowerCase(Locale.ENGLISH);

        if (! (ch >= 'a' && ch <= 'z' ||
               ch >= 'A' && ch <= 'Z' ||
               ch >= '0' && ch <= '0' ||
               ch == '+' || ch == '-' || ch == '.'))
          break;
      }
    }

    return null;
  }
1341476
public URI toUri(final String stringUri) {
    try {
      final java.net.URI netUri = new java.net.URI(stringUri);
      return this.toEmfUri(netUri);
    } catch (Throwable _e) {
      throw Exceptions.sneakyThrow(_e);
    }
  }
310571
public static boolean validateResource(String uriString) {
        try {
            URI uri = UriBasedVehicleInterfaceMixin.createUri(massageUri(uriString));
            return UriBasedVehicleInterfaceMixin.validateResource(uri) &&
                uri.getPort() < 65536;
        } catch(DataSourceException e) {
            return false;
        }
    }
202227
protected static boolean hasScheme(StringBuffer uri) {
        int len = uri.length();
        for (int i = 0; i < len; i++) {
            char c = uri.charAt(i);
            if (c == ':') {
                return i > 0;
            } else if (!isSchemeChar(c)) {
                return false;
            }
        }
        return false;
    }
338024
private function validateString(string $uri): void
    {
        if (!\is_string($uri)) {
            throw new InvalidArgumentException(sprintf('String required, %s given', \gettype($uri)));
        }
    }
328091
function validate (uri, collection, cb) {
  if ('function' != typeof cb) {
    throw new TypeError('cb must be a function');
  }

  if ('string' != typeof collection) {
    throw new TypeError('collection must be a string');
  }

  if ('string' != typeof uri) {
    throw new TypeError('uri must be a string');
  }
}
472306
static Map<String, String> parse(URI uri) {

        Map<String, String> result = new HashMap<String, String>();

        String queryString = uri.getQuery();
        if (queryString == null && uri.getSchemeSpecificPart() != null && uri.getSchemeSpecificPart().contains("?")) {
            queryString = uri.getSchemeSpecificPart().substring(uri.getSchemeSpecificPart().indexOf('?') + 1);
        }

        if (queryString == null) {
            return result;
        }

        StringTokenizer st = new StringTokenizer(queryString, "&;");
        while (st.hasMoreTokens()) {
            String queryParam = st.nextToken();
            int equalsIndex = queryParam.indexOf('=');
            if (equalsIndex != -1) {
                String key = queryParam.substring(0, equalsIndex);
                String value = queryParam.substring(equalsIndex + 1);

                result.put(key.toLowerCase(), value);
            }
        }

        return result;
    }
335892
def is_uri?(s)

      return false if s.index("\n")

      ((URI.parse(s); true) rescue false)
    end