Multi-Release JAR file patch as applied to build 108 of Java 9 breaks almost every project out there (Apache Ant, Gradle, partly Apache Maven)
uschindler at apache.org
Sat Mar 5 22:43:18 UTC 2016
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig at apache.org]
> Sent: Saturday, March 05, 2016 7:56 PM
> To: dev at ant.apache.org; Uwe Schindler <uschindler at apache.org>
> Cc: 'Alan Bateman' <Alan.Bateman at oracle.com>; core-libs-
> dev at openjdk.java.net; rory.odonnell at oracle.com; dev at ant.apache.org;
> 'Steve Drach' <steve.drach at oracle.com>
> Subject: Re: Multi-Release JAR file patch as applied to build 108 of Java 9
> breaks almost every project out there (Apache Ant, Gradle, partly Apache
> On 2016-03-05, Uwe Schindler wrote:
> > This is why I put the Ant developers in CC. The correct way would be
> > to look at the *decoded* path (not just getPath() because this is also
> > one of the "famous" traps in the URL class - one reason why it should
> > be avoided in favor of URI). URL.toURI().getPath() is most safe to fix
> > the issue in Apache Ant
> Part of the reason for this certainly is that the code has been written
> before the URI class even existed.
> > (Stefan Bodewig: Should I open an issue in Ant?).
> Yes, please do. Thanks Uwe.
I opened: https://bz.apache.org/bugzilla/show_bug.cgi?id=59130
> > Maybe Ant developers can fix this code in later versions to handle
> > URLs more correct.
Unfortunately this is not the only issue caused by this. After I tried to build Lucene with the patch applied, the next candidate for the issue broke:
Apache Ivy. It was no longer able to load the ivy-settings.xml file from its JAR file.
The reason here is another one: It constructs the JAR file URL on its own (it looks like this), but does not add the #release fragment. And because of this, JarURLConnection does not find the file...:
[...] multiple parent causes [...]
Caused by: java.io.FileNotFoundException: JAR entry org/apache/ivy/core/settings/ivysett/ivysettings-public.xml not found in C:\Users\Uwe Schindler\.ant\lib\ivy-2.3.0.jar
... 35 more
So it looks like the Multi-release JAR file patch also breaks the other way round: Code constructing JAR URLs according to the standard no longer work. In my opinion, the JAR URLs should not change at all and the code should transparently choose the right release version. Maybe add a fragment only to explicitly state a specific version (so one would be able to load the Java 7 version). But this could also be done using the META-INF/... path. The default handling should be that "old" and (I think they are standardized) JAR URLs still works as they should - not requiring the fragment!
More information about the core-libs-dev