commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Price <>
Subject [digester] handling exceptions with Digester
Date Wed, 12 Mar 2003 21:04:58 GMT

I've read through the Digester docs but didn't see reference to this 
topic.  If I've missed it and someone can point out where I should be 
looking, that'd be much appreciated.

I have an object on the Digester object stack and I want to invoke a 
method on it that throws an exception.  But since that method won't get 
invoked until I invoke digester.parse(), the exception will be thrown at 
that time, I suppose.  But digester.parse() only throws IOException and 
SAXException.  Is there a way to propagate my exception up through the 
parse() invocation so I can catch it and deal with it in my client code?

This is the method my digester is invoking:

     public void setSortBy(String sortBy) throws ClassNotFoundException,
                                                 IllegalAccessException {
         java.lang.reflect.Field f = null;

             f = Class.forName("SortBy").getField(sortBy);
         catch (ClassNotFoundException cnfe) {
             throw new ClassNotFoundException();
         catch (NoSuchFieldException nsfe) {
             throw new NoSuchFieldException();

         try {
         catch (IllegalAccessException iae) {
             throw new IllegalAccessException();



View raw message