TEST_BUG: Tests in java/util/zip/ZipFile leave file open

Alan Bateman Alan.Bateman at oracle.com
Thu Jun 17 19:53:43 UTC 2010


Xueming Shen wrote:
> Thanks for the review.
>
> InfoZip fails gracefully (increase the "failed" number) when test 
> fails, and if there is an unexpected
> IO failure/exception the test fails anyway. So I did not add the 
> try/finally/close pattern. But, it
> does not hurt to do that, so I added suggested anyway.
>
> Same thing goes to the zos, the only bad thing could happen is the 
> unexpected IO failure/exception,
> in which the test case fails anyway with an exception. Yes, I updated 
> the webrev to use the suggested
> try/finally.
>
> Copyright date has been updated accordingly as well.
>
> -Sherman
Thanks. The updated webrev looks fine. One minor comment is that the 
try/finally blocks could be a bit neater, eg:

ZipFile zf = new ZipFile(f);
try {
   ...
} finally {
    zf.close();
}

That would avoid initializing zf to null and then checking if is null. 
Up to you if you want to change them.

-Alan.





More information about the core-libs-dev mailing list