(String uri, boolean forceServer)
| 300 | private class Helper { |
| 301 | |
| 302 | private void parseURI(String uri, boolean forceServer) |
| 303 | throws URISyntaxException { |
| 304 | String temp = uri; |
| 305 | // assign uri string to the input value per spec |
| 306 | string = uri; |
| 307 | int index, index1, index2, index3; |
| 308 | // parse into Fragment, Scheme, and SchemeSpecificPart |
| 309 | // then parse SchemeSpecificPart if necessary |
| 310 | |
| 311 | // Fragment |
| 312 | index = temp.indexOf('#'); |
| 313 | if (index != -1) { |
| 314 | // remove the fragment from the end |
| 315 | fragment = temp.substring(index + 1); |
| 316 | validateFragment(uri, fragment, index + 1); |
| 317 | temp = temp.substring(0, index); |
| 318 | } |
| 319 | |
| 320 | // Scheme and SchemeSpecificPart |
| 321 | index = index1 = temp.indexOf(':'); |
| 322 | index2 = temp.indexOf('/'); |
| 323 | index3 = temp.indexOf('?'); |
| 324 | |
| 325 | // if a '/' or '?' occurs before the first ':' the uri has no |
| 326 | // specified scheme, and is therefore not absolute |
| 327 | if (index != -1 && (index2 >= index || index2 == -1) |
| 328 | && (index3 >= index || index3 == -1)) { |
| 329 | // the characters up to the first ':' comprise the scheme |
| 330 | absolute = true; |
| 331 | scheme = temp.substring(0, index); |
| 332 | if (scheme.length() == 0) { |
| 333 | throw new URISyntaxException(uri, Messages.getString("luni.83"), //$NON-NLS-1$ |
| 334 | index); |
| 335 | } |
| 336 | validateScheme(uri, scheme, 0); |
| 337 | schemespecificpart = temp.substring(index + 1); |
| 338 | if (schemespecificpart.length() == 0) { |
| 339 | throw new URISyntaxException(uri, Messages.getString("luni.84"), //$NON-NLS-1$ |
| 340 | index + 1); |
| 341 | } |
| 342 | } else { |
| 343 | absolute = false; |
| 344 | schemespecificpart = temp; |
| 345 | } |
| 346 | |
| 347 | if (scheme == null || schemespecificpart.length() > 0 |
| 348 | && schemespecificpart.charAt(0) == '/') { |
| 349 | opaque = false; |
| 350 | // the URI is hierarchical |
| 351 | |
| 352 | // Query |
| 353 | temp = schemespecificpart; |
| 354 | index = temp.indexOf('?'); |
| 355 | if (index != -1) { |
| 356 | query = temp.substring(index + 1); |
| 357 | temp = temp.substring(0, index); |
| 358 | validateQuery(uri, query, index2 + 1 + index); |
| 359 | } |
no test coverage detected