Set the raw-escaped path. @param escapedPath the path character sequence @throws URIException encoding error or not proper for initial instance @see #encode
(char[] escapedPath)
| 2860 | * @see #encode |
| 2861 | */ |
| 2862 | public void setRawPath(char[] escapedPath) throws URIException { |
| 2863 | if (escapedPath == null || escapedPath.length == 0) { |
| 2864 | _path = _opaque = escapedPath; |
| 2865 | setURI(); |
| 2866 | return; |
| 2867 | } |
| 2868 | // remove the fragment identifier |
| 2869 | escapedPath = removeFragmentIdentifier(escapedPath); |
| 2870 | if (_is_net_path || _is_abs_path) { |
| 2871 | if (escapedPath[0] != '/') { |
| 2872 | throw new URIException(URIException.PARSING, |
| 2873 | "not absolute path"); |
| 2874 | } |
| 2875 | if (!validate(escapedPath, abs_path)) { |
| 2876 | throw new URIException(URIException.ESCAPING, |
| 2877 | "escaped absolute path not valid"); |
| 2878 | } |
| 2879 | _path = escapedPath; |
| 2880 | } else if (_is_rel_path) { |
| 2881 | int at = indexFirstOf(escapedPath, '/'); |
| 2882 | if (at == 0) { |
| 2883 | throw new URIException(URIException.PARSING, "incorrect path"); |
| 2884 | } |
| 2885 | if (at > 0 && !validate(escapedPath, 0, at - 1, rel_segment) |
| 2886 | && !validate(escapedPath, at, -1, abs_path) |
| 2887 | || at < 0 && !validate(escapedPath, 0, -1, rel_segment)) { |
| 2888 | |
| 2889 | throw new URIException(URIException.ESCAPING, |
| 2890 | "escaped relative path not valid"); |
| 2891 | } |
| 2892 | _path = escapedPath; |
| 2893 | } else if (_is_opaque_part) { |
| 2894 | if (!uric_no_slash.get(escapedPath[0]) |
| 2895 | && !validate(escapedPath, 1, -1, uric)) { |
| 2896 | throw new URIException(URIException.ESCAPING, |
| 2897 | "escaped opaque part not valid"); |
| 2898 | } |
| 2899 | _opaque = escapedPath; |
| 2900 | } else { |
| 2901 | throw new URIException(URIException.PARSING, "incorrect path"); |
| 2902 | } |
| 2903 | setURI(); |
| 2904 | } |
| 2905 | |
| 2906 | |
| 2907 | /** |
no test coverage detected