Bug 31052 - org.apache.naming.factory.BeanFactory does not propage root exceptions
org.apache.naming.factory.BeanFactory does not propage root exceptions
Status: RESOLVED FIXED
Product: Tomcat 5
Classification: Unclassified
Component: Catalina:Modules
5.0.0
Other other
: P3 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2004-09-03 17:50 UTC by gawor
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gawor 2004-09-03 17:50:56 UTC
Only the error messages are propagated in the NamingException:

            } catch (java.beans.IntrospectionException ie) {
                throw new NamingException(ie.getMessage());
            }

Since some exceptions do not have a message associated with it, it is very hard 
sometimes to tell what went wrong from the NamingException. So it would be nice 
if the actual exception was chained with the NamingException. The change is 
small:

            } catch (java.lang.IllegalAccessException iae) {
                NamingException ex = new new NamingException(iae.getMessage());
                ex.setRootCause(iae);
                throw ex;
            }

Also, there is a call to e.printStackTrace() which probably shouldn't be there.
Comment 1 Yoav Shapira 2004-09-03 18:08:43 UTC
Now that we require JDK 1.4 where setRootCause is available, this fix is 
possible, so I've done it in TOMCAT_5_0 and HEAD.  Thanks.
Comment 2 gawor 2004-09-03 18:15:33 UTC
Thanks! Btw, the setRootCause() method on NamingException was actually 
available in 1.3.x (if not before that even).