Has anyone ever seen an exception thrown when calling close method on any closable object?
I guess you could try to force this by unplugging the disk your file is on. But on any Closable
? I think it would be easy to get something that uses a socket to throw an exception upon closing.
Not in terms of file-io, but in terms of sockets the close will raise IOException
when the other side has aborted the connection. For example, when you fire a HTTP request on a (large) webpage and then immediately navigate away by clicking another link on the webpage (while it isn't finished loading), then the server side will get an IOException
(or a subclass like ClientAbortException in Tomcat servers and clones) when the outputstream of the HTTP response is to be flushed/closed.