This is actually quite a common thing to do. Take
JDBC code, for instance. Good JDBC code (unfortunately, this should not be confused with "the majority of JDBC code") closes its Statements and/or database connections in a finally { } block so as to avoid resource leaks.
But, if there was a JDBC exception thrown inside the try { } block, it is well possible that the close() statement would throw an exception as well. This exception would obscure the first one, which is a pity because the first exception is likely to be more helpful in pinpointing the problem.
This code will prevent the close() statement from obscuring any previously thrown exception. It is quite unfortunate that this is so cumbersome to do, and I must say that code like this is pretty rare.
- Peter