Author: markt Date: Sun May 22 19:26:20 2016 New Revision: 1745087 URL: http://svn.apache.org/viewvc?rev=1745087&view=rev Log: Code clean-up - use multi-catch
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java tomcat/trunk/java/org/apache/catalina/util/Introspection.java Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1745087&r1=1745086&r2=1745087&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Sun May 22 19:26:20 2016 @@ -785,16 +785,11 @@ public class ApplicationContext implemen @SuppressWarnings("unchecked") T filter = (T) context.getInstanceManager().newInstance(c.getName()); return filter; - } catch (IllegalAccessException e) { - throw new ServletException(e); } catch (InvocationTargetException e) { ExceptionUtils.handleThrowable(e.getCause()); throw new ServletException(e); - } catch (NamingException e) { - throw new ServletException(e); - } catch (InstantiationException e) { - throw new ServletException(e); - } catch (ClassNotFoundException e) { + } catch (IllegalAccessException | NamingException | InstantiationException | + ClassNotFoundException e) { throw new ServletException(e); } } @@ -882,16 +877,11 @@ public class ApplicationContext implemen T servlet = (T) context.getInstanceManager().newInstance(c.getName()); context.dynamicServletCreated(servlet); return servlet; - } catch (IllegalAccessException e) { - throw new ServletException(e); } catch (InvocationTargetException e) { ExceptionUtils.handleThrowable(e.getCause()); throw new ServletException(e); - } catch (NamingException e) { - throw new ServletException(e); - } catch (InstantiationException e) { - throw new ServletException(e); - } catch (ClassNotFoundException e) { + } catch (IllegalAccessException | NamingException | InstantiationException | + ClassNotFoundException e) { throw new ServletException(e); } } @@ -1026,24 +1016,13 @@ public class ApplicationContext implemen EventListener listener = (EventListener) obj; addListener(listener); } - } catch (IllegalAccessException e) { - throw new IllegalArgumentException(sm.getString( - "applicationContext.addListener.iae.cnfe", className), - e); } catch (InvocationTargetException e) { ExceptionUtils.handleThrowable(e.getCause()); throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.cnfe", className), e); - } catch (NamingException e) { - throw new IllegalArgumentException(sm.getString( - "applicationContext.addListener.iae.cnfe", className), - e); - } catch (InstantiationException e) { - throw new IllegalArgumentException(sm.getString( - "applicationContext.addListener.iae.cnfe", className), - e); - } catch (ClassNotFoundException e) { + } catch (IllegalAccessException | NamingException | InstantiationException | + ClassNotFoundException e) { throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.cnfe", className), e); @@ -1112,14 +1091,10 @@ public class ApplicationContext implemen throw new IllegalArgumentException(sm.getString( "applicationContext.addListener.iae.wrongType", listener.getClass().getName())); - } catch (IllegalAccessException e) { - throw new ServletException(e); } catch (InvocationTargetException e) { ExceptionUtils.handleThrowable(e.getCause()); throw new ServletException(e); - } catch (NamingException e) { - throw new ServletException(e); - } catch (InstantiationException e) { + } catch (IllegalAccessException | NamingException | InstantiationException e) { throw new ServletException(e); } } Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1745087&r1=1745086&r2=1745087&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Sun May 22 19:26:20 2016 @@ -17,7 +17,6 @@ package org.apache.catalina.core; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -286,20 +285,8 @@ public class AsyncContextImpl implements try { listener = (T) getInstanceManager().newInstance(clazz.getName(), clazz.getClassLoader()); - } catch (InstantiationException e) { - ServletException se = new ServletException(e); - throw se; - } catch (IllegalAccessException e) { - ServletException se = new ServletException(e); - throw se; - } catch (InvocationTargetException e) { - ExceptionUtils.handleThrowable(e.getCause()); - ServletException se = new ServletException(e); - throw se; - } catch (NamingException e) { - ServletException se = new ServletException(e); - throw se; - } catch (ClassNotFoundException e) { + } catch (InstantiationException | IllegalAccessException | NamingException | + ClassNotFoundException e) { ServletException se = new ServletException(e); throw se; } catch (Exception e) { Modified: tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?rev=1745087&r1=1745086&r2=1745087&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java Sun May 22 19:26:20 2016 @@ -227,16 +227,8 @@ public class JreMemoryLeakPreventionList log.debug(sm.getString( "jreLeakListener.gcDaemonFail"), e); } - } catch (SecurityException e) { - log.error(sm.getString("jreLeakListener.gcDaemonFail"), - e); - } catch (NoSuchMethodException e) { - log.error(sm.getString("jreLeakListener.gcDaemonFail"), - e); - } catch (IllegalArgumentException e) { - log.error(sm.getString("jreLeakListener.gcDaemonFail"), - e); - } catch (IllegalAccessException e) { + } catch (SecurityException | NoSuchMethodException | IllegalArgumentException | + IllegalAccessException e) { log.error(sm.getString("jreLeakListener.gcDaemonFail"), e); } catch (InvocationTargetException e) { Modified: tomcat/trunk/java/org/apache/catalina/util/Introspection.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/Introspection.java?rev=1745087&r1=1745086&r2=1745087&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/util/Introspection.java (original) +++ tomcat/trunk/java/org/apache/catalina/util/Introspection.java Sun May 22 19:26:20 2016 @@ -151,11 +151,7 @@ public class Introspection { Class<?> clazz = null; try { clazz = cl.loadClass(className); - } catch (ClassNotFoundException e) { - log.debug(sm.getString("introspection.classLoadFailed", className), e); - } catch (NoClassDefFoundError e) { - log.debug(sm.getString("introspection.classLoadFailed", className), e); - } catch (ClassFormatError e) { + } catch (ClassNotFoundException | NoClassDefFoundError | ClassFormatError e) { log.debug(sm.getString("introspection.classLoadFailed", className), e); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org