suppressedException semantics (original) (raw)

Gernot Neppert mcnepp02 at googlemail.com
Tue Aug 24 05:29:05 PDT 2010


Well I disagree that the exception in the try block is necessarily more important than the one in the finally block.

It might not be more important, but it might be the only one that you can spot by looking at the code:

try(Reader reader = new FileReader("contents.txt")) { char[] buf = new char[1000]; int read; while(0 < (read = reader.read(buf))) { // Do something } }

Wouldn't you want the above block to re-throw exceptions from the constructor or from 'read', rather than from an 'invisible' exception source?

(See also my other post suggesting that the compiler might be more helpful in pointing at 'hidden' exception sources)



More information about the coin-dev mailing list