Does close ever throw an IOException?
After providing some answers here, and reading some comments, it would seem that, in practice IOException is never thrown on close for file I/O. Are there any cases in which calling close on a Stream/Reader/Writer actually throws an IOException? If an exception is actually thrown, how should it be dealt with? For files, you may not see IOException thrown often on close(), but you'll definitely see it for non-File I/O like closing sockets to the network. Here's an example of a Java bug where closing a UDP socket eventually caused an IOException to be thrown. TofuBeer I have found two cases: