unhappy jar binary

S.P.Zeidler spz at serpens.de
Sat May 2 13:59:02 PDT 2009


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