JDK-8225507 - ZipFileSystem swallows IOExceptions

Jaikiran Pai jai.forums2013 at gmail.com
Thu Jan 30 14:15:11 UTC 2020


In context of https://bugs.openjdk.java.net/browse/JDK-8225507

As noted by the reporter in that issue, it appears that there are couple
of places in jdk.nio.zipfs.ZipFileSystem#sync (private method) where
IOException(s) are caught and swallowed (like here[1]) without being
propagated back. The comment on those lines seems to state that it's
intentional, but looking at the history of that code, it appears to have
been there since the beginning. So, is it still valid to catch the whole
IOException in those blocks and ignore them? Shouldn't those invalid
entries cause the exception to be propagated back? This sync method
happens to be called (only) in the close() method, so propagating this
exception would cause the close() to fail (with genuine issue), which
shouldn't be a problem, isn't it?

[1]
https://hg.openjdk.java.net/jdk/jdk/file/0f53754d8577/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java#l1752

-Jaikiran




More information about the nio-dev mailing list