RFR 8174151: URLClassLoader no longer uses custom URLStreamHandler for jar URLs

Paul Sandoz paul.sandoz at oracle.com
Mon Feb 13 22:52:56 UTC 2017


Please review.


This is a nasty edge case when a URLStreamHandler is registered (via the system property) to process jar: URLs.

The support for multi-release JAR files changed the implementation of ClassLoader.findResource such that the to be returned jar: URLs would not be operated on, and therefore the jar: URLStreamHandler would not be queried [*]. If the returned jar: URL is operated on by the caller then the jar: URLStreamHandler would (of course) be queried.

This is arguably an implementation detail but it does change long term established behaviour in a very delicate area.

While i find it unpalatable to do so this patch restores the previous behaviour, if a custom jar: URLStreamHandler is registered. The compromise is such a custom jar: URLStreamHandler needs to explicitly support multi-release JAR files.


[*] Note that there are already such optimisations for file: URLs.

More information about the core-libs-dev mailing list