You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Simon Kitching <sk...@apache.org> on 2006/04/19 10:34:51 UTC

Re: [digester] Conversion Exception not passed through ErrorHandler?

On Tue, 2006-04-18 at 23:03 +0200, Dennis Kempin wrote:
> Hello,
> 
> I am using digester to parse a configuration file that needs that
> contains class names, which shall be parsed to java.lang.Class
> instances. This works fine for existing classes, but when such a class
> cannot be found a ConversionException is raised by the Beanutils.
> Of course this is correct behavior, but this Exception throws me out of
> Digester.parse method, which makes it impossible to continue parsing. I
> already used Digester.setErrorHandler to pass a logging ErrorHandler to
> digester, but at this Exception it is not invoked.
> 
> Am I using digester in a wrong way, or does it seem to be a bug?

This is the expected behaviour.

org.xml.sax.ErrorHandler is an xml-parsing-specific class, and is only
invoked directly from the parser when the parser detects an error. Other
errors get reported via an exception from the parse method as you have
noted.

It's an interesting idea to have errors detected by digester itself
reported via the ErrorHandler. However I'm not sure if that's actually
possible; even if it is, such a change would not be backwards-compatible
with existing Digester behaviour.

So sorry, but AFAIK it is impossible to keep on parsing when data in the
input causes a ConversionException. Well, it might be possible to write
your own subclasses of CallMethodRule etc. which trap exceptions and
just skip the method invocation.

I'm not quite sure what the point of continuing is when such an error
has occurred...

Regards,

Simon




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org