RFR 8174151: URLClassLoader no longer uses custom URLStreamHandler for jar URLs
Alan.Bateman at oracle.com
Tue Feb 14 12:20:27 UTC 2017
On 13/02/2017 22:52, Paul Sandoz wrote:
> 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.
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.
More information about the core-libs-dev