james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Introducing a SAX-like ErrorHandler
Date Thu, 24 Dec 2009 16:11:08 GMT
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

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

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

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?


View raw message