RFR JDK-8037394: ZipFileSystem leaks file descriptor when file is not a valid zip file

Alan Bateman Alan.Bateman at oracle.com
Thu Jan 22 19:30:58 UTC 2015


On 22/01/2015 19:14, Xueming Shen wrote:
> Hi, please help review the changeset for
>
> issue: https://bugs.openjdk.java.net/browse/JDK-8037394
> webrev: http://cr.openjdk.java.net/~sherman/8037394
>
> I'am not including a test case since it basically tests to run out of the
> fd of that process...but I did reproduce the problem and verify the fix.
>
> I also changed the implementation to throw a normal ZipException instead
> of the "ZipError" (which is an internal vm error). It appears 
> inappropriate
> for the FileSystems.newFileSystem() to throw a vm error exception in case
> a dedicated fs provider fails to handler the target file. The ZipError 
> is a
> leftover/copyover from the j.u.zip implementation.
Yes, ZipException is better here.

The changes looks okay. A small improvement would be to catch the 
exception from ch.close and add it to x as a suppressed exception.

-Alan


More information about the nio-dev mailing list