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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b17
    • Verification:
      Verified

      Backports

        Description

        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(" ----------------------");
        ----------------------------------------------------------------

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: