Checks the validity of the path's scheme and path.

@param path The path to check.
@return The URI as a Path.

@throws IllegalArgumentException Thrown, if the URI misses scheme or path.
552947
private static Path validatePath(Path path) {
		final URI uri = path.toUri();
		final String scheme = uri.getScheme();
		final String pathPart = uri.getPath();

		// some validity checks
		if (scheme == null) {
			throw new IllegalArgumentException("The scheme (hdfs://, file://, etc) is null. " +
					"Please specify the file system scheme explicitly in the URI.");
		}
		if (pathPart == null) {
			throw new IllegalArgumentException("The path to store the checkpoint data in is null. " +
					"Please specify a directory path for the checkpoint data.");
		}
		if (pathPart.length() == 0 || pathPart.equals("/")) {
			throw new IllegalArgumentException("Cannot use the root directory for checkpoints.");
		}

		return path;
	}
962245
public static URI setPath(final URI orig, final String path) {
        try {
            return new URI(orig.getScheme(), orig.getUserInfo(), orig.getHost(), orig.getPort(), path, orig.getQuery(), orig.getFragment());
        } catch (final URISyntaxException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
1156201
public boolean isHubPath(String path) throws IOException {
        if ("/".equals(path))
            return true;
        for (String root : getNonHubRoots()) {
            if (root.startsWith("*")) {
                if (path.endsWith(root.substring(1)))
                    return false;
            }
            else if (path.equals(root) || path.startsWith(root + "/")) {
                return false;
            }
        }
        return true;
    }
31994
public static void checkUriScheme(String scheme) {
    String uri = String.format("%s://null", scheme);
    try {
      new URI(uri);
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException(e);
    }
  }
340063
public static URI getUri(UriInfo uriInfo,
                             HttpServletRequest req,
                             String path) {
        String suffix = "";
        if (req.getRequestURI().endsWith(".json")) {
            suffix = ".json";
        } else if (req.getRequestURI().endsWith(".xml")) {
            suffix = ".xml";
        }
        return URI.create(uriInfo.getBaseUri() + "/" + path + suffix);
    }
402636
@Override
    public Node get(final String path) throws IllegalArgumentException {
        // Precondition checks
        Validate.notNullOrEmpty(path, "No path was specified");

        // Make a Path
        final ArchivePath realPath = new BasicPath(path);

        // Delegate
        return get(realPath);
    }
562832
public UriBuilder path(String path) throws URISyntaxException {
        path = path.trim();
        if (getPath().endsWith("/")) {
            return new UriBuilder(setPath(String.format("%s%s", getPath(), path)));
        } else {
            return new UriBuilder(setPath(String.format("%s/%s", getPath(), path)));
        }
    }
832159
protected boolean validClassFilePath(String path)
	{
		if(path==null)
		{
			return false;
		}
		File file=new File(path);
		return file.exists()&&file.isFile();
	}
868217
@Override
	public boolean matchPath(String path) {

		boolean match = false;
		if (StringUtils.isNotEmpty(path)) {
			match = path.startsWith(prefix);
		}
		return match;
	}
594347
private static Path qualified(Path rootPath, Path path) {
        URI rootUri = rootPath.toUri();
        return path.makeQualified(rootUri, new Path(rootUri.getPath()));
    }
81307
public UrlBuilder withPath(String path) {
        if (path == null || path.isEmpty()) {
            this.path = null;
        } else {
            with(path, UrlTokenizerState.PATH);
        }
        return this;
    }
816515
public static String pathOnly(String path)
   {
      String curPath = path;
      curPath = curPath.substring(curPath.indexOf("/"));
      curPath = curPath.substring(0, curPath.lastIndexOf("/"));
      if ("".equals(curPath))
      {
         curPath = "/";
      }
      return curPath;
   }
1070536
public AbstractBooleanAssert<?> jsonPathAsBoolean(String path) {
        return Assertions.assertThat(actual.read(path, Boolean.class));
    }
653965
public AbstractCharSequenceAssert<?, String> jsonPathAsString(String path) {
        return Assertions.assertThat(actual.read(path, String.class));
    }
1277651
protected boolean checkExists(String path) {
        try {
            return client.checkExists().forPath(path) != null;
        } catch (Exception e) {
            throw new NiubiException(e);
        }
    }
115895
public boolean addPath(String path) throws MalformedURLException {
        File file = new File(path);
        return addPath( file );
    }
374024
public static File checkFolderPath(final String path, final boolean create) {
		final File file = new File(path);
		if (!file.exists()) {
			if (create) {
				file.mkdir();
			}
			return null;
		}
		return file;
	}