Bug 31052

Summary: org.apache.naming.factory.BeanFactory does not propage root exceptions
Product: Tomcat 5 Reporter: gawor
Component: Catalina:ModulesAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 5.0.0   
Target Milestone: ---   
Hardware: Other   
OS: other   

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).