RFR: 8293590: Some syntax checks performed by URL.openConnection() could be performed earlier, at URL construction [v4]

Daniel Fuchs dfuchs at openjdk.org
Tue Oct 11 13:57:44 UTC 2022


> Many built-in URL Handlers perform additional syntax checking on the URL when `URLStreamHandler::openConnection` / connect is called. In some cases, some of these checks could be also performed earlier, when `URLStreamHandler::parseURL` is called.
> 
> This fix proposes to slightly modify the behavior of JDK built-in URL handlers to perform these checks early, and throw `MalformedURLException` earlier, at URL construction time, when that is possible, instead of delaying until `URL::openConnection` or `URLConnection::connect` are called.
> 
> Because java.net.URL constructors are already specified to throw `MalformedURLException` in such cases, no API documentation changes are necessary. 
> 
> A new JDK specific system property `-Djdk.net.url.delayParsing` or `-Djdk.net.url.delayParsing=true` can be specified on the command line to revert to the previous behavior. By default, the property is not set, and the new behavior is in place. The property can be specified on the java command line if unexpected regressions are observed.
> 
> The new property will be documented in release notes, and may be removed in a future release.
> 
> CSR: https://bugs.openjdk.org/browse/JDK-8294592

Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:

 - Merge branch 'master' into url-early-parsing-8293590
 - Merge branch 'master' into url-early-parsing-8293590
 - Merge branch 'master' into url-early-parsing-8293590
 - 8293590

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/10534/files
  - new: https://git.openjdk.org/jdk/pull/10534/files/d01b898d..21b624df

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10534&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10534&range=02-03

  Stats: 5629 lines in 151 files changed: 4243 ins; 815 del; 571 mod
  Patch: https://git.openjdk.org/jdk/pull/10534.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10534/head:pull/10534

PR: https://git.openjdk.org/jdk/pull/10534


More information about the net-dev mailing list