On 13/02/2017 22:52, Paul Sandoz wrote:
Hi,
Please review.
http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8174151-url-class-path-loader/webrev/index.html
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.
This is really ugly but I think the changes are okay/safe. Initially I
thought it might be simpler to just use URL.handlers but the API allows
someone to create a URL with a different URLStreamHandler.
-Alan