2 ms·
Of course, but the second one DOES execute whether the exception occurs or not. So the first call is redundant. If no exception occurs (which is most of the ti
by V-2 12y ago
Of course, but the second one DOES execute whether the exception occurs or not. So the first call is redundant.
If no exception occurs (which is most of the time, probably), the code will call stream.close(); stream = null; and after that it will pass that null stream to Utils.safeClose, which can't do anything to it at this point, as the stream is closed by now and we've dropped the reference to it anyway (by setting it to null in meantime) :)
The code reads as if its author was under false impression that finally only executes if catch executes. But that's not true, and it would make no logical sense (why would the language distinguish between "catch" and "finally" at all in such case?)