RFR: 8211917: (zipfs) Creating or updating a JAR file system should put the MANIFEST.MF at the start

Lance Andersen lance.andersen at oracle.com
Mon Feb 3 23:42:02 UTC 2020


Hi Jaikiran,

Thank you for tackling this feature request.


I will finish going through the proposed patch  and will sponsor once we have completed the overall review.



> On Feb 1, 2020, at 2:38 AM, Jaikiran Pai <jai.forums2013 at gmail.com> wrote:
> 
> Can I please get a review and a sponsor for a patch for
> https://bugs.openjdk.java.net/browse/JDK-8211917?
> 
> The webrev containing the patch is available at
> https://cr.openjdk.java.net/~jpai/webrev/8211917/1/webrev/
> 
> The commit in the patch updates the jdk.nio.zipfs.ZipFileSystem to write
> out the manifest (if any) as the first entry in the LOC. That then
> allows the java.util.jar.JarInputStream to find the manifest and return
> it through JarInputStream.getManifest().
> 
> In an initial attempt at this patch, I had tried to just reorder the CEN
> to add the manifest entry first instead of forcing the manifest entry
> first in the LOC. But that didn't work and the JarInputStream still
> couldn't find the manifest. So I used this approach to force the
> manifest as the first entry in the LOC (and the existing code
> effectively also ensures that it's also the first entry in the CEN).

Zip/JarInputStream rely on the LOC which is why just updating the CEN would not get you across the goal line.
> 
> The patch also includes a test case to reproduce this issue and verify
> the change. In the test case I intentionally used the verbose version of
> the FileSystem.newFileSystem() API, instead of the newer simpler ones.
> This is to allow cleaner/easier backporting of this patch to Java
> version 8 if and when that happens. Functionally, which API variant of
> the FileSystem.newFileSystem() API is used shouldn't matter in the
> context of this test case. However, if someone feels that I should
> switch to the newer available API, then please do let me know and I'll
> update the patch.
> 
> -Jaikiran
> 
> 

Best
Lance

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>





More information about the core-libs-dev mailing list