Utility method used to parse a given scheme specific part. If parameter encode=true, then the result will be encoded, otherwise the result will be validated to ensure encoding is valid. Typically the multi-parameter constructors will call this method with encode=true, and the single parameter constr
(String ssp, boolean encode)
| 522 | * @throws URISyntaxException if the ssp is invalid. |
| 523 | */ |
| 524 | protected void parseSchemeSpecificPart(String ssp, boolean encode) throws URISyntaxException { |
| 525 | if (ssp == null) { |
| 526 | throw new URISyntaxException(ssp, "Invalid scheme specific part"); |
| 527 | } |
| 528 | if (scheme != null && ssp.charAt(0) != PATH_SEPARATOR) { |
| 529 | this.opaque = true; |
| 530 | this.schemeSpecificPart = ssp; |
| 531 | return; |
| 532 | } |
| 533 | int index; |
| 534 | String s = ssp; |
| 535 | |
| 536 | if ((index = s.lastIndexOf(QUERY_MARKER)) != -1) { |
| 537 | setQuery(s.substring(index + 1), encode); |
| 538 | s = s.substring(0, index); |
| 539 | } else if (getQuerySeparator() == SOCKET_QUERY_SEPARATOR && (index = s.indexOf(SOCKET_QUERY_SEPARATOR)) != -1) { |
| 540 | setQuery(s.substring(index + 1).replace(SOCKET_QUERY_SEPARATOR, QUERY_SEPARATOR), encode); |
| 541 | s = s.substring(0, index); |
| 542 | } |
| 543 | |
| 544 | index = (s.startsWith(AUTHORITY_MARKER)) ? 2 : 0; |
| 545 | index = s.indexOf(PATH_SEPARATOR, index); |
| 546 | if (index != -1) { |
| 547 | setPath(s.substring(index), encode); |
| 548 | s = s.substring(0, index); |
| 549 | } |
| 550 | setAuthority(s, encode); |
| 551 | } |
| 552 | |
| 553 | /** |
| 554 | * Internal utility method to throw a syntax error if a value can not be |
no test coverage detected