On Thu, Mar 24, 2011 at 10:49 AM, Kevin Wright <[email protected]>wrote:

>
>>>
>>> Again, name a SINGLE checked exception that everyone agrees should be
>>> checked.
>>>
>>
>> FileNotFound.
>>
>>
> a) I neither want nor need a stacktrace (+ associated construction cost) in
> such a scenario
>

You are very unlikely to see one, unless you use a runtime exception, which
you will most likely forget to handle.


>  b) There may be a long chain of callers between where the exception is
> thrown and where it might reasonably be handled, if some of those
> intervening methods are generic and could also be used for other non-file
> operations then I certainly don't want to pollute their signatures.
>

There are patterns to avoid that. Exceptions that cross layer boundaries
should be wrapped, although FileNotFoundException is probably an... er...
exception to this rule. Either way, you want to handle that one and do
something about it, and it's important enough that the compiler should make
sure you don't forget to do it.

-- 
Cédric

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to