bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug cp-tools/39177] trunk revision 144128 - jar: internal error: java.l


From: rguenth at gcc dot gnu dot org
Subject: [Bug cp-tools/39177] trunk revision 144128 - jar: internal error: java.lang.NullPointerException
Date: 8 Oct 2009 11:29:20 -0000


------- Comment #4 from rguenth at gcc dot gnu dot org  2009-10-08 11:29 -------
Err, libjava/classpath/tools/gnu/classpath/tools/jar/Creator.java is just
complete bullshit.  Citing:

  protected Manifest createManifest(Main parameters)
    throws IOException
  {
    if (! parameters.wantManifest)
      return null;
    if (parameters.manifestFile != null)
      {
        // User specified a manifest file.
        InputStream contents = new FileInputStream(parameters.manifestFile);
        return new Manifest(contents);
      }
    return new Manifest();
  }

  protected void writeCommandLineEntries(Main parameters, OutputStream os)
    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();

WTF do you expect to happen when createManifest returns NULL?  Well, a crash.

Simpler testcase:

> gjar-4.4 -cfM -
jar: internal error:
java.lang.NullPointerException
   at gnu.classpath.tools.jar.Creator.writeCommandLineEntries(Creator.java:219)
   at gnu.classpath.tools.jar.Creator.run(Creator.java:244)
   at gnu.classpath.tools.jar.Main.run(Main.java:276)
   at gnu.classpath.tools.jar.Main.main(Main.java:284)


Diff between what is in gcc 4.3 and what is in gcc 4.4:

@@ -222,9 +214,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") + ")");


oh, really?  Gosh.

So, who owns that brown paperbag?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-10-08 08:33:30         |2009-10-08 11:29:20
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39177





reply via email to

[Prev in Thread] Current Thread [Next in Thread]