james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Introducing a SAX-like ErrorHandler
Date Thu, 24 Dec 2009 17:48:22 GMT
Stefano Bagnara wrote:
> Hi all,
> for my current job I need to do some sort of MIME validation. Of
> course I'm going to use mime4j, but mime4j as-is doesn't do what I
> need.
> The fact is that most time mime4j logs what I need to know, but I
> don't want it to be logged, instead I want it to be "returned" so that
> I can prepare a report of problems found. In a "perfect world" I would
> also have the position (row/column, and maybe the "pos") where the
> problem has been found.
> In SAX world this is handled passing to the parser an "ErrorHandler"
> that is a simple "listener" that will receive warning/error/fatalError
> event with a SAXParseException parameter. The SAXParseException
> includes a message and a Locator object (that gives access to
> row/column).
> Introducing such an "ErrorHandler" would also let us move some of the
> "strict" behaviours to the error handler. A strict error handler could
> raise the exception at every warning/error, while the default error
> handler would simply do a
> logWarnEnabled+log.warn/logErrorEnabled+log.error . This ErrorHandler
> could also remove the need of the common logging dependency in many
> classes.
> Is there interest in improving mime4j so to support a similar
> behaviour or it is better that I simply work extending mime4j to
> support my behaviour and simply propose minor patches for mime4j in
> order to allow my extensions to be written?
> Stefano

Hi Stefano,

I like the idea. As long as it does not result in a noticeable 
performance degradation (for instance, row/column counting remains 
optional) I am all for it. I am also very much in favor of getting rid 
of dependency on Commons Logging. Low level libraries like Mime4j ought 
not impose a particular logging framework onto its consumers.


View raw message