Bug with the zip fs provider (7u72, 8u25), am able to create a corrupted zip...

Francis Galiegue fgaliegue at gmail.com
Fri Jan 16 17:15:00 UTC 2015


(sorry for the flurry of emails, I should really not press the send
button so quickly...)

System info: Ubuntu 14.10; can reproduce with both 1.7u72 and 1.8u25.

On Fri, Jan 16, 2015 at 6:10 PM, Francis Galiegue <fgaliegue at gmail.com> wrote:
> OK, I have a more simple reproducer:
>
> 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();
>         }
>     }
> }
>
> Note that it doesn't matter whether I also .flush() before I close.
>
> --
> Francis Galiegue, fgaliegue at gmail.com, https://github.com/fge
> JSON Schema in Java: http://json-schema-validator.herokuapp.com
> Parsers in pure Java: https://github.com/parboiled1/grappa (redde
> Caesaris: https://github.com/sirthias)



-- 
Francis Galiegue, fgaliegue at gmail.com, https://github.com/fge
JSON Schema in Java: http://json-schema-validator.herokuapp.com
Parsers in pure Java: https://github.com/parboiled1/grappa (redde
Caesaris: https://github.com/sirthias)


More information about the nio-dev mailing list