atom feed4 messages in net.java.openjdk.bsd-port-devRe: unhappy jar binary
FromSent OnAttachments
S.P.ZeidlerMay 2, 2009 1:58 pm 
Martin BuchholzMay 3, 2009 6:19 pm 
S.P.ZeidlerMay 4, 2009 12:19 am 
Kurt MillerMay 12, 2009 6:16 am 
Subject:Re: unhappy jar binary
From:Martin Buchholz (mart@google.com)
Date:May 3, 2009 6:19:57 pm
List:net.java.openjdk.bsd-port-dev

It's hard for me to tell, but if this is a general bug in the JDK, you should report it to core-libs-dev, where the "jar" maintainers hang out, preferably with a nice test case.

Martin

On Sat, May 2, 2009 at 13:59, S.P.Zeidler <sp@serpens.de> wrote:

Hi,

compiling bsd-port with openjdk7 results in a jar binary that does eg: % /usr/local/bsd-port/build/bsd-amd64/j2sdk-image/bin/jar xf rt-closed.jar @foo java.lang.NullPointerException        at java.lang.String.startsWith(String.java:1433)                at java.lang.String.startsWith(String.java:1462)                at sun.tools.jar.Main.extractFile(Main.java:879)                at sun.tools.jar.Main.extract(Main.java:860)                at sun.tools.jar.Main.run(Main.java:245)                at sun.tools.jar.Main.main(Main.java:1133)

This is due to the new extract method not setting cwd, which makes the bsd-port extractFile patently unhappy. If one adds: --- snip --- --- a/src/share/classes/sun/tools/jar/Main.java Tue Mar 10 09:04:32 2009 -0700 +++ b/src/share/classes/sun/tools/jar/Main.java Sat May 02 17:50:29 2009 +0000 @@ -845,6 +845,17 @@      * Extracts specified entries from JAR file, via ZipFile.      */     void extract(String fname, String files[]) throws IOException { +        // Current working directory + +        cwd = System.getProperty("user.dir"); +        if (cwd == null) { +            fatalError(getMsg("error.no.cwd")); +        } +        cwd = (new File(cwd)).getCanonicalPath(); +        if (!cwd.endsWith(File.separator)) { +            cwd += File.separator; +        } +         ZipFile zf = new ZipFile(fname);         Set<ZipEntry> dirs = newDirSet();         Enumeration<? extends ZipEntry> zes = zf.entries();

--- snip --- all is well (tm).

best regards,        spz