Under what circumstances would java.util.zip.ZipFile.close() throw an IOException? Its method signature indicates that it can be thrown, but from the source code there doesn’t seem to be any place where this could happen, unless it’s in native code. What corrective action, if any, could be taken at the point where that exception is caught?
Under what circumstances would java.util.zip.ZipFile.close() throw an IOException? Its method signature indicates that it
Share
From the API docs on
ZipFile.close():And
InputStream.close()throws anIOException, soZipFile.close()has to throw it too. According to the API docs forInputStream.close(), it throws anIOException“if an I/O error occurs”. That’s not very descriptive but it’s casting a wide net. InputStreams can represent streams coming from the filesystem, network, memory, etc. InputStreams can involve buffers that need to be flushed, sockets that need to be closed, resources that need to be freed, locks that need to be freed, etc. IOExceptions can happen for a variety of reasons.