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

jar leaves temporary file when exception occur in creating jar

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
      jar
    • Resolved In Build:
      b160

      Backports

        Description

        To reproduce the issue:

        mkdir a; touch test a/test
        jdk-9/bin/jar cf test.jar -C a test test

        Creating test.jar will fail (which is expected), but a temporary file be left behind.

        $ mkdir a; touch test a/test
        $ ls -l /tmp/test.jar*
        ls: cannot access /tmp/test.jar*: No such file or directory

        $ jdk-9/bin/jar cf test.jar -C a test test
        java.util.zip.ZipException: duplicate entry: test
        at java.base/java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:231)
        at java.base/java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
        at jdk.jartool/sun.tools.jar.Main.addFile(Main.java:1179)
        at jdk.jartool/sun.tools.jar.Main.create(Main.java:849)
        at jdk.jartool/sun.tools.jar.Main.run(Main.java:308)
        at jdk.jartool/sun.tools.jar.Main.main(Main.java:1651)

        $ ls /tmp/test.jar*
        /tmp/test.jar16981332899083569432.jar

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sherman Xueming Shen
                Reporter:
                amlu Amy Lu (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: