unhappy jar binary

Martin Buchholz martinrb at google.com
Sun May 3 18:20:36 PDT 2009


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 <spz at 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
> --
> spz at serpens.de (S.P.Zeidler)
>
>



More information about the bsd-port-dev mailing list