Quality Outreach Heads-up - JDK 20: java.net.URL parsing fix & behavior change

The OpenJDK Quality Group promotes the testing of FOSS projects with OpenJDK Early-Access builds as a way to improve the overall quality of the release. This heads-up is part of a regular communication sent to the projects involved. To learn more about the program, and how-to join, please check here.

JDK 20 - java.net.URL parsing fix & behavior change

Before JDK 20, some of the parsing/validation performed by the JDK built-in URLStreamHander implementations were delayed until URL::openConnection or URLConnection::connect was called. Starting JDK 20, some of these parsing/validations are now performed early, i.e. within URL constructors.

An exception caused by a malformed URL that would have been delayed until the connection was opened or connected may starting JDK 20, throw a MalformedURLException at URL construction time.

Call to Action

We suggest testing your codebase against this change. And for those who want to rely on the old behavior, a new system property has been introduced to revert, on the command line, to the previous behavior.

More Information

~