tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1730012 - /tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
Date Fri, 12 Feb 2016 12:28:29 GMT
Author: markt
Date: Fri Feb 12 12:28:29 2016
New Revision: 1730012

URL: http://svn.apache.org/viewvc?rev=1730012&view=rev
Log:
Clean-up.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java?rev=1730012&r1=1730011&r2=1730012&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterChain.java Fri Feb 12 12:28:29
2016
@@ -173,9 +173,8 @@ final class ApplicationFilterChain imple
         // Call the next filter if there is one
         if (pos < n) {
             ApplicationFilterConfig filterConfig = filters[pos++];
-            Filter filter = null;
             try {
-                filter = filterConfig.getFilter();
+                Filter filter = filterConfig.getFilter();
 
                 if (request.isAsyncSupported() && "false".equalsIgnoreCase(
                         filterConfig.getFilterDef().getAsyncSupported())) {
@@ -215,42 +214,33 @@ final class ApplicationFilterChain imple
             }
             // Use potentially wrapped request from this point
             if ((request instanceof HttpServletRequest) &&
-                (response instanceof HttpServletResponse)) {
-
-                if( Globals.IS_SECURITY_ENABLED ) {
-                    final ServletRequest req = request;
-                    final ServletResponse res = response;
-                    Principal principal =
-                        ((HttpServletRequest) req).getUserPrincipal();
-                    Object[] args = new Object[]{req, res};
-                    SecurityUtil.doAsPrivilege("service",
-                                               servlet,
-                                               classTypeUsedInService,
-                                               args,
-                                               principal);
-                } else {
-                    servlet.service(request, response);
-                }
+                    (response instanceof HttpServletResponse) &&
+                    Globals.IS_SECURITY_ENABLED ) {
+                final ServletRequest req = request;
+                final ServletResponse res = response;
+                Principal principal =
+                    ((HttpServletRequest) req).getUserPrincipal();
+                Object[] args = new Object[]{req, res};
+                SecurityUtil.doAsPrivilege("service",
+                                           servlet,
+                                           classTypeUsedInService,
+                                           args,
+                                           principal);
             } else {
                 servlet.service(request, response);
             }
-        } catch (IOException e) {
-            throw e;
-        } catch (ServletException e) {
-            throw e;
-        } catch (RuntimeException e) {
+        } catch (IOException | ServletException | RuntimeException e) {
             throw e;
         } catch (Throwable e) {
+            e = ExceptionUtils.unwrapInvocationTargetException(e);
             ExceptionUtils.handleThrowable(e);
-            throw new ServletException
-              (sm.getString("filterChain.servlet"), e);
+            throw new ServletException(sm.getString("filterChain.servlet"), e);
         } finally {
             if (ApplicationDispatcher.WRAP_SAME_OBJECT) {
                 lastServicedRequest.set(null);
                 lastServicedResponse.set(null);
             }
         }
-
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message