Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4814980

Manifest.write can sometimes generate invalid output (JDK 1.3.1)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.3.1
    • core-libs



      Name: nt126004 Date: 02/07/2003


      FULL PRODUCT VERSION :
      java version "1.3.1_03"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_03-b03)
      Java HotSpot(TM) Client VM (build 1.3.1_03-b03, mixed mode)


      glibc-2.3.1-6
      Linux localhost 2.4.18-19.7.x #1 Thu Dec 12 09:00:42 EST
      2002 i686 unknown
      Red Hat Linux release 7.2 (Enigma)


      A DESCRIPTION OF THE PROBLEM :
      Certain particular manifests, if written to an output stream
      using JDK 1.3, are written incorrectly - the format is
      invalid and cannot be read again.

      Seems to be fixed in JDK 1.4, but I see no filed bug about
      it, and no 1.3.1_0x update release seems to mention it.

      Only observed on this manifest - many others are written
      just fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run attached program.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      Expected (from 1.4):

      ---%<---
      Manifest-Version: 1.0
      OpenIDE-Module-Specification-Version: 2.13
      OpenIDE-Module-Layer:
      org/netbeans/modules/apisupport/ant/mf-layer.xml
      OpenIDE-Module-Localizing-Bundle:
      org/netbeans/modules/apisupport/ant/
       TemplateNames.properties
      Created-By: Apache Ant 1.5.1
      OpenIDE-Module-Module-Dependencies:
      org.apache.tools.ant.module/2 > 2.
       4, org.netbeans.modules.apisupport > 2.7,
      org.netbeans.core/1 > 1.1
      OpenIDE-Module: org.netbeans.modules.apisupport.ant
      OpenIDE-Module-Implementation-Version: 200302030958
      OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.14

      Equal: true
      ---%<---

      Actual (from 1.3): throws exception after printing

      ---%<---
      Manifest-Version: 1.0
      OpenIDE-Module-Layer:
      org/netbeans/modules/apisupport/ant/mf-layer.xml
      OpenIDE-Module-Implementation-Version: 200302030958
      Created-By: Apache Ant 1.5.1
      OpenIDE-Module-Specification-Version: 2.13
      OpenIDE-Module-Module-Dependencies:
      org.apache.tools.ant.module/2 > 2.
       4, org.netbeans.modules.apisupport > 2.7,
      org.netbeans.core/1 > 1.1

       OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.14
      OpenIDE-Module: org.netbeans.modules.apisupport.ant
      OpenIDE-Module-Localizing-Bundle:
      org/netbeans/modules/apisupport/ant/
       TemplateNames.properties

      ---%<---

      Note extra "\n " at end of
      OpenIDE-Module-Module-Dependencies attr line.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.io.IOException: invalid manifest format
      at java.util.jar.Manifest.read(Manifest.java:180)
      at java.util.jar.Manifest.<init>(Manifest.java:51)
      at ManifestWriteTest.main(ManifestWriteTest.java:12)

      The exception is expected - the format is indeed invalid.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      import java.util.jar.Manifest;
      public class ManifestWriteTest {
          public static void main(String[] args) throws Exception {
              String s = "Manifest-Version: 1.0\r\nCreated-By: Apache Ant
      1.5.1\r\nOpenIDE-Module:
      org.netbeans.modules.apisupport.ant\r\nOpenIDE-Module-Localizing-Bundle:
      org/netbeans/modules/apisupport/ant/\r\n
      TemplateNames.properties\r\nOpenIDE-Module-Layer:
      org/netbeans/modules/apisupport/ant/mf-layer.xml\r\nOpenIDE-Module-Specification-Version:
      2.13\r\nOpenIDE-Module-Implementation-Version:
      200302030958\r\nOpenIDE-Module-Module-Dependencies:
      org.apache.tools.ant.module/2 > 2.\r\n 4, org.netbeans.modules.apisupport > 2.7,
      org.netbeans.core/1 > 1.1\r\nOpenIDE-Module-IDE-Dependencies: IDE/1 > 3.14\r\n\r\n";
              byte[] b = s.getBytes("ISO8859_1");
              Manifest m = new Manifest(new ByteArrayInputStream(b));
              m.write(System.out);
              ByteArrayOutputStream o = new ByteArrayOutputStream();
              m.write(o);
              byte[] b2 = o.toByteArray();
              Manifest m2 = new Manifest(new ByteArrayInputStream(b2));
              //m2.write(System.out);
              System.out.println("Equal: " + (m.equals(m2)));
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      None known.
      (Review ID: 180879)
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: