tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From funk...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java
Date Thu, 07 Aug 2003 00:56:25 GMT
funkman     2003/08/06 17:56:25

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationDispatcher.java
  Log:
  Use PropertyUtils to aggressively get the real rootCause as previously
  committed in StandardWrapperValve and ErrorReportValve
  
  Revision  Changes    Path
  1.23      +26 -12    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ApplicationDispatcher.java	5 Aug 2003 13:22:03 -0000	1.22
  +++ ApplicationDispatcher.java	7 Aug 2003 00:56:25 -0000	1.23
  @@ -97,6 +97,7 @@
   import org.apache.catalina.core.StandardWrapper;
   import org.apache.catalina.util.InstanceSupport;
   import org.apache.catalina.util.StringManager;
  +import org.apache.commons.beanutils.PropertyUtils;
   import org.apache.commons.logging.LogFactory;
   import org.apache.commons.logging.Log;
   
  @@ -630,7 +631,7 @@
               if (queryString != null) {
                   wrequest.setAttribute(Globals.INCLUDE_QUERY_STRING_ATTR,
                                         queryString);
  -		wrequest.setQueryParams(queryString);
  +                wrequest.setQueryParams(queryString);
               }
               
               wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
  @@ -774,14 +775,27 @@
               support.fireInstanceEvent(InstanceEvent.AFTER_DISPATCH_EVENT,
                                         servlet, request, response);
               Throwable rootCause = e;
  -            while (rootCause instanceof ServletException) {
  -                Throwable t = ((ServletException) rootCause).getRootCause();
  -                if (t != null) {
  -                    rootCause = t;
  -                } else {
  -                    break;
  +            Throwable rootCauseCheck = null;
  +
  +            // Extra aggressive rootCause finding
  +            do {
  +                try {
  +                    rootCauseCheck = (Throwable)PropertyUtils.getProperty
  +                                                (rootCause, "rootCause");
  +                    if (rootCauseCheck!=null)
  +                        rootCause = rootCauseCheck;
  +
  +                } catch (ClassCastException ex) {
  +                    rootCauseCheck = null;
  +                } catch (IllegalAccessException ex) {
  +                    rootCauseCheck = null;
  +                } catch (NoSuchMethodException ex) {
  +                    rootCauseCheck = null;
  +                } catch (java.lang.reflect.InvocationTargetException ex) {
  +                    rootCauseCheck = null;
                   }
  -            }
  +            } while (rootCauseCheck != null);
  +            
               log(sm.getString("applicationDispatcher.serviceException",
                                wrapper.getName()), rootCause);
               servletException = e;
  
  
  

Mime
View raw message