james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serge Knystautas <ser...@lokitech.com>
Subject Re: MailetException vs MessagingException
Date Mon, 20 Oct 2003 18:06:03 GMT
Noel J. Bergman wrote:
>>I found that many of them are throwing MessagingException-s
>>instead of MailetException-s (including my own code ;-).
> 
> You know ... I could have sworn I had raised this exact question earlier in
> the year.  I've no clue as to why there are both.
> 
> How could we make better use MailetException, just as SendFailedException is
> a specialized type of MessagingException?  Right now it is just a synonym
> for MessagingException.

MailetException and SendFailedException are not synonyms with 
MessagingExceptions.  They are forms, just like humans and monkeys are 
both hominids.

> Can you see any reason why the container would want to catch a
> MailetException and not catch a MessagingException?  Can you see any reason
> why the container would want to handle them differently?  Do we want to
> Matchers and Mailets to throw MailetException so that we can distinguish
> between one that they threw, and one that was leaked?

Good question.  A tiger will do the same to a human and a monkey, so do 
we really need to create this differentation?

Generally I think of MessagingException as a problem with the message 
itself... the repository was corrupted, the headers are unreadable, 
something IO based.  And MailetException is an application mistake like 
how you would wrap a null pointer exception or indexoutofbounds 
exception.  Or just how something is misconfigured.

(I think I remember) Mailet.init() used to only throw MailetException. 
I believe this is changed because you couldn't construct 
javax.mail.Address (or InternetAddress) without handling 
AddressException, which also extends MessagingException.  This is 
something you'd often want in both mailet and matcher's init.

But really... as the tiger, do we really need to differentiate?  Maybe 
just remove (deprecate) MailetException altogether?

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message