Returns true if the path requires normalization. A path needs normalization if it has segments
of: ".", "..", or consecutive "/".
@param path path to check
@return true if the path requires normalization
763648
public static boolean needsNormalization(String path) {
    int last = path.length() - 1;
    int curr = 0;

    // Skip initial slashes
    while (curr <= last) {
      if (path.charAt(curr) != '/') {
        break;
      }
      curr++;
    }
    if (curr > 1) {
      return true;
    }

    while (curr <= last) {
      // segment is "." or "./"
      if ((path.charAt(curr) == '.') && ((curr == last) || (path.charAt(curr + 1) == '/'))) {
        return true;
      }
      // segment is ".." or "../"
      if ((path.charAt(curr) == '.') && (path.charAt(curr + 1) == '.') && ((curr + 1 == last) || (
          path.charAt(curr + 2) == '/'))) {
        return true;
      }
      while (curr <= last) {
        // Find next '/'
        if (path.charAt(curr++) != '/') {
          continue;
        }
        // Previous 'curr' was a '/'. Check for redundant slashes.
        if (path.charAt(curr) != '/') {
          break;
        }
        // multiple slashes
        return true;
      }
    }
    return false;
  }
1088012
public static String normalizePath(String path, String separator) {
    return path.endsWith(separator) ? path : path + separator;
  }
560438
private boolean isWar(String path) {
        String currentDir = Paths.get(".").toAbsolutePath().normalize().toString();
        String classesDirPath = Paths.get(path).toAbsolutePath().normalize().toString();
        return classesDirPath.startsWith(currentDir);
    }
685142
private boolean isInvalidEncodedPath(String path) {
		if (path.contains("%")) {
			try {
				// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8
				// chars
				String decodedPath = URLDecoder.decode(path, "UTF-8");
				if (isInvalidPath(decodedPath)) {
					return true;
				}
				decodedPath = processPath(decodedPath);
				if (isInvalidPath(decodedPath)) {
					return true;
				}
			}
			catch (IllegalArgumentException | UnsupportedEncodingException ex) {
				// Should never happen...
			}
		}
		return false;
	}
911723
public synchronized boolean contains(RelativePath path) {
        try {
            checkIndex();
            return getZipIndexEntry(path) != null;
        }
        catch (IOException e) {
            return false;
        }
    }
200450
public static boolean matchPath(String path, String pattern) {
		List<String> pathElements = PATH_SPLITTER.splitToList(path);
		List<String> patternElements = PATH_SPLITTER.splitToList(pattern);
		return matchTokens(pathElements.toArray(new String[0]), patternElements.toArray(new String[0]));
	}
1028640
public static String normalizePath(final String path, final boolean isFileOrJarURL) {
        final boolean hasPercent = path.indexOf('%') >= 0;
        if (!hasPercent && path.indexOf('\\') < 0 && !path.endsWith("/")) {
            return path;
        } else {
            final int len = path.length();
            final StringBuilder buf = new StringBuilder();
            // Only "file:" and "jar:" URLs are %-decoded (issue 255)
            if (hasPercent && isFileOrJarURL) {
                // Perform '%'-decoding of path segment
                int prevEndMatchIdx = 0;
                final Matcher matcher = percentMatcher.matcher(path);
                while (matcher.find()) {
                    final int startMatchIdx = matcher.start();
                    final int endMatchIdx = matcher.end();
                    translateSeparator(path, prevEndMatchIdx, startMatchIdx, /* stripFinalSeparator = */ false,
                            buf);
                    unescapePercentEncoding(path, startMatchIdx, endMatchIdx, buf);
                    prevEndMatchIdx = endMatchIdx;
                }
                translateSeparator(path, prevEndMatchIdx, len, /* stripFinalSeparator = */ true, buf);
            } else {
                // Fast path -- no '%', or "http(s)://" or "jrt:" URL, or non-"file:" or non-"jar:" URL
                translateSeparator(path, 0, len, /* stripFinalSeparator = */ true, buf);
                return buf.toString();
            }
            return buf.toString();
        }
    }
671392
public boolean exactMatchExists(String path) {
        String _path = normalize(path);

        Iterator i = vHostTable.keySet().iterator();

        while (i.hasNext()) {
            try {
                String pattern = (String) i.next();
                // System.out.println("Pattern = "+pattern);
                if (_path.equals(pattern))
                    return true;
            } catch (Exception e) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, "Caught an exception in getMapping():", e);
                }
                return false;
            }
        }

        return false;
    }
352132
private String normalizePath(String path) {
		// 标准化路径
		path = FileUtil.normalize(path);
		path = StrUtil.removePrefix(path, StrUtil.SLASH);

		Assert.isFalse(FileUtil.isAbsolutePath(path), "Path [{}] must be a relative path !", path);
		return path;
	}
469103
protected String checkRoot(String path){
		if(path==null||path.length()==0||path.equals("/")){
			return "";
			
		}else if(path.endsWith("/")){
			return path.substring(0,path.length()-1);
		}else if(path.startsWith("/")){
			return path.substring(1,path.length());
		}else{
			return  path;
		}
	}
232567
private String normalizeFilePath(final String path) {
        String normalizedPath = path.replace('\\', '/');

        if (!normalizedPath.startsWith("/")) {
            normalizedPath = "/" + normalizedPath;
        }

        return normalizedPath;
    }
1367207
public static String normalizePath(String path) {
		if (Platforms.FILE_PATH_SEPARATOR_CHAR == Platforms.WINDOWS_FILE_PATH_SEPARATOR_CHAR
				&& StringUtils.indexOf(path, Platforms.LINUX_FILE_PATH_SEPARATOR_CHAR) != -1) {
			return StringUtils.replaceChars(path, Platforms.LINUX_FILE_PATH_SEPARATOR_CHAR,
					Platforms.WINDOWS_FILE_PATH_SEPARATOR_CHAR);
		}
		return path;

	}
1246406
public static boolean validatePath(String path) {
        if(path == null) {
            Log.w(TAG, "Uploading path not set");
            return false;
        }

        try {
            uriFromString(path);
            return true;
        } catch(DataSinkException e) {
            return false;
        }
    }
1218113
public static boolean isAbsolutePath(String path) {
		if (StrUtil.isEmpty(path)) {
			return false;
		}

		if (StrUtil.C_SLASH == path.charAt(0) || path.matches("^[a-zA-Z]:[/\\\\].*")) {
			// 给定的路径已经是绝对路径了
			return true;
		}
		return false;
	}
636516
public static boolean excludePath(String path) {
        String[] excludePatterns = SiteProperties.getExcludePatterns();
        if (ArrayUtils.isNotEmpty(excludePatterns)) {
            return RegexUtils.matchesAny(path, excludePatterns);
        } else {
            return false;
        }
    }
1311819
public boolean isExcluded(String path) {

        path = normalizePath(path);
        List<String> pathList = new ArrayList<String>(m_allPaths);
        // m_allPaths is already sorted, we need the reverse ordering so children come before their parents
        // (we want to find the deepest parent folder of 'path' that is marked as include/exclude)
        Collections.reverse(pathList);
        for (String pathInList : pathList) {
            if (CmsStringUtil.isPrefixPath(pathInList, path)) {
                return m_excludes.contains(pathInList);
            }
        }
        return false;
    }
1311699
public static String normalizePath(String path) {
		String retval = path;
		retval = retval.replaceAll(PathUtils.REGEX_MULTIPLE_SLASH,
				PathUtils.REGEX_SLASH);
		retval = retval.replaceAll(PathUtils.REGEX_BACKSLASH,
				PathUtils.REGEX_SLASH);
		return retval;
	}