MCPcopy
hub / github.com/zaproxy/zaproxy / resolvePath

Method resolvePath

zap/src/main/java/org/apache/commons/httpclient/URI.java:2979–3001  ·  view source on GitHub ↗

Resolve the base and relative path. @param basePath a character array of the basePath @param relPath a character array of the relPath @return the resolved path @throws URIException no more higher path level to be resolved

(char[] basePath, char[] relPath)

Source from the content-addressed store, hash-verified

2977 * @throws URIException no more higher path level to be resolved
2978 */
2979 protected char[] resolvePath(char[] basePath, char[] relPath)
2980 throws URIException {
2981
2982 // REMINDME: paths are never null
2983 String base = (basePath == null) ? "" : new String(basePath);
2984
2985 // _path could be empty
2986 if (relPath == null || relPath.length == 0) {
2987 return normalize(basePath);
2988 } else if (relPath[0] == '/') {
2989 return normalize(relPath);
2990 } else {
2991 int at = base.lastIndexOf('/');
2992 if (at != -1) {
2993 basePath = base.substring(0, at + 1).toCharArray();
2994 }
2995 StringBuilder buff = new StringBuilder(base.length()
2996 + relPath.length);
2997 buff.append((at != -1) ? base.substring(0, at + 1) : "/");
2998 buff.append(relPath);
2999 return normalize(buff.toString().toCharArray());
3000 }
3001 }
3002
3003
3004 /**

Callers 1

URIMethod · 0.95

Calls 4

normalizeMethod · 0.95
lengthMethod · 0.45
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected