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

(zipfs) ZipFileSystem creates corrupted zip if entry output stream gets closed more than once

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b48
    • Verification:
      Verified

      Backports

        Description

        public final class Jsr203ZipBug
        {
            public static void main(final String... args)
                throws IOException
            {
                final Path zipPath
                    = Paths.get(System.getProperty("java.io.tmpdir"), "t.zip");
                Files.deleteIfExists(zipPath);

                final URI uri = URI.create("jar:" + zipPath.toUri());

                final Map<String, ?> env = Collections.singletonMap("create", "true");

                try (
                    final FileSystem zipfs = FileSystems.newFileSystem(uri, env);
                    final OutputStream out
                        = Files.newOutputStream(zipfs.getPath("/foo"));
                ) {
                    out.write("hello".getBytes());
                    out.close();
                }
            }
        }

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: