On 8/1/07, Robert Burrell Donkin <[EMAIL PROTECTED]> wrote:
> JDBCMailRepository contains several examples of exception handing similar to:
>
>         } catch (Exception me) {
>             throw new MessagingException("Exception while retrieving
> mail: " + me.getMessage());
>        }
>
> the downside with this approach is that information about the original
> exception (including the stack trace) are lost. (i'm getting a null
> pointer thrown but without a stack trace it's hard to know where the
> problem lies.)
>
> any reason why changing these to:
>
> } catch (Exception me) {
>    getLogger().debug("XXX", me);
>    throw new MessagingException("Exception while retrieving mail: " +
> me.getMessage(), me);
> }
>
> would be a bad idea?

I think that's the right idea.  IIRC, this exception handling approach
was simply written before exceptions had a standardized way to wrap
another.  I think want to say JDK 1.4 introduced it, and then not sure
when that made it into Javamail...

Anyway yeah, I think that's a perfectly acceptable change IMHO.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to