Author: markt Date: Tue Jul 5 18:34:39 2016 New Revision: 1751519 URL: http://svn.apache.org/viewvc?rev=1751519&view=rev Log: Align 9.0.x and 8.5.x.
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationContext.java tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ContainerBase.java tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/NamingContextListener.java tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardContext.java Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationContext.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1751519&r1=1751518&r2=1751519&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationContext.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationContext.java Tue Jul 5 18:34:39 2016 @@ -786,16 +786,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); } } @@ -883,16 +878,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); } } @@ -1027,24 +1017,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); @@ -1113,14 +1092,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/tc8.5.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1751519&r1=1751518&r2=1751519&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Tue Jul 5 18:34:39 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; @@ -263,20 +262,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/tc8.5.x/trunk/java/org/apache/catalina/core/ContainerBase.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1751519&r1=1751518&r2=1751519&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ContainerBase.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ContainerBase.java Tue Jul 5 18:34:39 2016 @@ -124,8 +124,6 @@ import org.apache.tomcat.util.res.String * Subclasses that fire additional events should document them in the * class comments of the implementation class. * - * TODO: Review synchronisation around background processing. See bug 47024. - * * @author Craig R. McClanahan */ public abstract class ContainerBase extends LifecycleMBeanBase Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?rev=1751519&r1=1751518&r2=1751519&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java Tue Jul 5 18:34:39 2016 @@ -296,16 +296,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/tc8.5.x/trunk/java/org/apache/catalina/core/NamingContextListener.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/NamingContextListener.java?rev=1751519&r1=1751518&r2=1751519&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/NamingContextListener.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/NamingContextListener.java Tue Jul 5 18:34:39 2016 @@ -85,10 +85,6 @@ public class NamingContextListener // ----------------------------------------------------- Instance Variables - - protected Log logger = log; - - /** * Name of the associated naming context. */ @@ -217,7 +213,6 @@ public class NamingContextListener if (container instanceof Context) { namingResources = ((Context) container).getNamingResources(); - logger = log; token = ((Context) container).getNamingToken(); } else if (container instanceof Server) { namingResources = ((Server) container).getGlobalNamingResources(); @@ -251,7 +246,7 @@ public class NamingContextListener try { createNamingContext(); } catch (NamingException e) { - logger.error + log.error (sm.getString("naming.namingContextCreationFailed", e)); } @@ -265,7 +260,7 @@ public class NamingContextListener ContextBindings.bindClassLoader(container, token, ((Context) container).getLoader().getClassLoader()); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -276,7 +271,7 @@ public class NamingContextListener ContextBindings.bindClassLoader(container, token, this.getClass().getClassLoader()); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } if (container instanceof StandardServer) { ((StandardServer) container).setGlobalNamingContext @@ -703,7 +698,7 @@ public class NamingContextListener // Ignore because UserTransaction was obviously // added via ResourceLink } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -713,7 +708,7 @@ public class NamingContextListener compCtx.bind("Resources", ((Context) container).getResources()); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -786,7 +781,7 @@ public class NamingContextListener createSubcontexts(envCtx, ejb.getName()); envCtx.bind(ejb.getName(), ref); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -857,25 +852,25 @@ public class NamingContextListener } else { value = constructEnvEntry(env.getType(), env.getValue()); if (value == null) { - logger.error(sm.getString( + log.error(sm.getString( "naming.invalidEnvEntryType", env.getName())); } } } catch (NumberFormatException e) { - logger.error(sm.getString("naming.invalidEnvEntryValue", env.getName())); + log.error(sm.getString("naming.invalidEnvEntryValue", env.getName())); } catch (IllegalArgumentException e) { - logger.error(sm.getString("naming.invalidEnvEntryValue", env.getName())); + log.error(sm.getString("naming.invalidEnvEntryValue", env.getName())); } // Binding the object to the appropriate name if (value != null) { try { - if (logger.isDebugEnabled()) - logger.debug(" Adding environment entry " + env.getName()); + if (log.isDebugEnabled()) + log.debug(" Adding environment entry " + env.getName()); createSubcontexts(envCtx, env.getName()); envCtx.bind(env.getName(), value); } catch (NamingException e) { - logger.error(sm.getString("naming.invalidEnvEntryValue", e)); + log.error(sm.getString("naming.invalidEnvEntryValue", e)); } } @@ -948,10 +943,10 @@ public class NamingContextListener wsdlURL = ((Context) container). getServletContext(). getResource("/" + service.getWsdlfile()); - logger.debug(" Changing service ref wsdl file for /" + log.debug(" Changing service ref wsdl file for /" + service.getWsdlfile()); } catch (MalformedURLException e) { - logger.error(sm.getString("naming.wsdlFailed", e)); + log.error(sm.getString("naming.wsdlFailed", e)); } } if (wsdlURL == null) @@ -982,10 +977,10 @@ public class NamingContextListener jaxrpcURL = ((Context) container). getServletContext(). getResource("/" + service.getJaxrpcmappingfile()); - logger.debug(" Changing service ref jaxrpc file for /" + log.debug(" Changing service ref jaxrpc file for /" + service.getJaxrpcmappingfile()); } catch (MalformedURLException e) { - logger.error(sm.getString("naming.wsdlFailed", e)); + log.error(sm.getString("naming.wsdlFailed", e)); } } if (jaxrpcURL == null) @@ -1038,14 +1033,14 @@ public class NamingContextListener } try { - if (logger.isDebugEnabled()) { - logger.debug(" Adding service ref " + if (log.isDebugEnabled()) { + log.debug(" Adding service ref " + service.getName() + " " + ref); } createSubcontexts(envCtx, service.getName()); envCtx.bind(service.getName(), ref); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -1072,14 +1067,14 @@ public class NamingContextListener ref.add(refAddr); } try { - if (logger.isDebugEnabled()) { - logger.debug(" Adding resource ref " + if (log.isDebugEnabled()) { + log.debug(" Adding resource ref " + resource.getName() + " " + ref); } createSubcontexts(envCtx, resource.getName()); envCtx.bind(resource.getName(), ref); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } if ("javax.sql.DataSource".equals(ref.getClassName()) && @@ -1090,7 +1085,7 @@ public class NamingContextListener Registry.getRegistry(null, null).registerComponent(actualResource, on, null); objectNames.put(resource.getName(), on); } catch (Exception e) { - logger.warn(sm.getString("naming.jmxRegistrationFailed", e)); + log.warn(sm.getString("naming.jmxRegistrationFailed", e)); } } @@ -1115,12 +1110,12 @@ public class NamingContextListener ref.add(refAddr); } try { - if (logger.isDebugEnabled()) + if (log.isDebugEnabled()) log.debug(" Adding resource env ref " + resourceEnvRef.getName()); createSubcontexts(envCtx, resourceEnvRef.getName()); envCtx.bind(resourceEnvRef.getName(), ref); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -1149,12 +1144,12 @@ public class NamingContextListener "UserTransaction".equals(resourceLink.getName()) ? compCtx : envCtx; try { - if (logger.isDebugEnabled()) + if (log.isDebugEnabled()) log.debug(" Adding resource link " + resourceLink.getName()); createSubcontexts(envCtx, resourceLink.getName()); ctx.bind(resourceLink.getName(), ref); } catch (NamingException e) { - logger.error(sm.getString("naming.bindFailed", e)); + log.error(sm.getString("naming.bindFailed", e)); } } @@ -1170,7 +1165,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } } @@ -1186,7 +1181,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } } @@ -1202,7 +1197,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } } @@ -1218,7 +1213,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } } @@ -1234,7 +1229,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } ObjectName on = objectNames.get(name); @@ -1255,7 +1250,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } } @@ -1271,7 +1266,7 @@ public class NamingContextListener try { envCtx.unbind(name); } catch (NamingException e) { - logger.error(sm.getString("naming.unbindFailed", e)); + log.error(sm.getString("naming.unbindFailed", e)); } } Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardContext.java URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1751519&r1=1751518&r2=1751519&view=diff ============================================================================== --- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardContext.java (original) +++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardContext.java Tue Jul 5 18:34:39 2016 @@ -5407,7 +5407,7 @@ public class StandardContext extends Con log.debug("Processing standard container shutdown"); // JNDI resources are unbound in CONFIGURE_STOP_EVENT so stop - // naming resoucres before they are unbound since NamingResoucres + // naming resources before they are unbound since NamingResoucres // does a JNDI lookup to retrieve the resource. This needs to be // after the application has finished with the resource if (namingResources != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org