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

'\r' is not supported as "newline" in java.util.jar.Manifest.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • None
    • core-libs
    • b17
    • Verified

        Jar Manifest Specifiction:

        newline : CR LF | LF | CR (not followed by LF)

        Test case:
        -------------------------------------------------------------
            byte[] mbytes =
                    ("Manifest-Version: 1.0\r\n" +
                     "Created-By: 1.9.0-internal (Oracle Corporation)\r\n" +
                     "key1: value1\n" +
                     "key2: value2\r" +
                     "key3: value3\r\n" +
                     "key4: value4\n E\r\n" +
                     "key5: value5\r\n E\r\n" +
                     "key6: value6\r E\r\n" +
                     "key7: value7\r \r\n" +
                     "key8: value8 \r \r\n"
                    ).getBytes();
           
                Manifest m = new Manifest(new ByteArrayInputStream(mbytes));
                Attributes attr = m.getMainAttributes();

                System.out.println(" attr: ");
                attr.forEach((k, v) -> System.out.println("[" + k + "] : [" + v + "]"));
                System.out.println(" ----------------------");
        ----------------------------------------------------------------

              sherman Xueming Shen
              sherman Xueming Shen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: