1 | while (index < end) {↵ | | 1 | while (index < end) {↵
|
2 | testChar = p_uriSpec.charAt(index);↵ | | 2 | testChar = p_uriSpec.charAt(index);↵
|
3 | ↵ | | 3 | ↵
|
| | | 4 | if (testChar == '?' || testChar == '#') {↵
|
| | | 5 | break;↵
|
| | | 6 | }↵
|
| | | 7 | ↵
|
4 | // check for valid escape sequence↵ | | 8 | // check for valid escape sequence↵
|
5 | if (testChar == '%') {↵ | | 9 | if (testChar == '%') {↵
|
6 | if (index+2 >= end ||↵ | | 10 | if (index+2 >= end ||↵
|
7 | !isHex(p_uriSpec.charAt(index+1)) ||↵ | | 11 | !isHex(p_uriSpec.charAt(index+1)) ||↵
|
8 | !isHex(p_uriSpec.charAt(index+2))) {↵ | | 12 | !isHex(p_uriSpec.charAt(index+2))) {↵
|
9 | throw new MalformedURIException(↵ | | 13 | throw new MalformedURIException(↵
|
10 | "Path contains invalid escape sequence!");↵ | | 14 | "Opaque part contains invalid escape sequence!");↵
|
11 | }↵ | | 15 | }↵
|
12 | index += 2;↵ | | 16 | index += 2;↵
|
13 | }↵ | | 17 | }↵
|
14 | // Path segments cannot contain '[' or ']' since pchar↵ | | 18 | // If the scheme specific part is opaque, it can contain '['↵
|
15 | // production was not changed by RFC 2732.↵ | | 19 | // and ']'. uric_no_slash wasn't modified by RFC 2732, which↵
|
16 | else if (!isPathCharacter(testChar)) {↵ | | 20 | ↵
|
17 | if (testChar == '?' || testChar ==↵ | | 21 | // I've interpreted as an error in the spec, since the ↵
|
18 | '#') {↵ | | 22 | // production should be equivalent to (uric - '/'), and uric↵
|
19 | break;↵ | | 23 | ↵
|
20 | }↵ | | 24 | // contains '[' and ']'. - mrglavas↵
|
| | | 25 | else if (!isURICharacter(testChar)) {↵
|
21 | throw new MalformedURIException(↵ | | 26 | throw new MalformedURIException(↵
|
22 | "Path contains invalid character: " + testChar);↵ | | 27 | "Opaque part contains invalid character: " + testChar);↵
|
23 | }↵ | | 28 | }↵
|
24 | ++index;↵ | | 29 | ++index;↵
|
25 | } | | 30 | }
|