This fixes an issue with running gjar using HotSpot/OpenJDK. If no manifest version is given in the supplied manifest file, the OpenJDK libraries will output an empty manifest, regardless of the provided content. This adds the same behaviour to gjar as shown by the OpenJDK jar application, providing a default manifest version of 1.0 and a Created-By tag.
ChangeLog: 2008-05-26 Andrew John Hughes <[EMAIL PROTECTED]> * tools/gnu/classpath/tools/jar/Creator.java: (writeCommandLineEntries(Main,OutputStream)): Add default value for manifest version and include Created-By property. -- Andrew :) Support Free Java! Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath http://openjdk.java.net PGP Key: 94EFD9D8 (http://subkeys.pgp.net) Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
Index: tools/gnu/classpath/tools/jar/Creator.java =================================================================== RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/jar/Creator.java,v retrieving revision 1.7 diff -u -u -r1.7 Creator.java --- tools/gnu/classpath/tools/jar/Creator.java 15 Dec 2006 19:45:38 -0000 1.7 +++ tools/gnu/classpath/tools/jar/Creator.java 26 May 2008 18:25:42 -0000 @@ -50,6 +50,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; +import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.jar.Manifest; @@ -222,9 +223,15 @@ throws IOException { manifest = createManifest(parameters); + /* If no version is specified, provide the same manifest version default + * as Sun's jar tool */ + Attributes attr = manifest.getMainAttributes(); + if (attr.getValue(Attributes.Name.MANIFEST_VERSION) == null) + attr.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0"); + attr.putValue("Created-By", System.getProperty("java.version") + + " (" + System.getProperty("java.vendor") + ")"); outputStream = new JarOutputStream(os, manifest); - // FIXME: in Classpath this sets the method too late for the - // manifest file. + // FIXME: this sets the method too late for the manifest file. outputStream.setMethod(parameters.storageMode); writeCommandLineEntries(parameters); }