Author: markt Date: Mon Jun 11 20:59:49 2012 New Revision: 1349008 URL: http://svn.apache.org/viewvc?rev=1349008&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53266 Handle missing classes defined in @HandlesTypes more gracefully - the specification requires it should not stop the web application from loading
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1349007 Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1349008&r1=1349007&r2=1349008&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon Jun 11 20:59:49 2012 @@ -1554,8 +1554,16 @@ public class ContextConfig implements Li initializerClassMap.put(sci, new HashSet<Class<?>>()); - HandlesTypes ht = - sci.getClass().getAnnotation(HandlesTypes.class); + HandlesTypes ht = null; + try { + ht = sci.getClass().getAnnotation(HandlesTypes.class); + } catch (Exception e) { + if (log.isDebugEnabled()) { + log.info(sm.getString("contextConfig.sci.debug", url), e); + } else { + log.info(sm.getString("contextConfig.sci.info", url)); + } + } if (ht != null) { Class<?>[] types = ht.value(); if (types != null) { Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1349008&r1=1349007&r2=1349008&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties Mon Jun 11 20:59:49 2012 @@ -55,6 +55,8 @@ contextConfig.resourceJarFail=Failed to contextConfig.role.auth=WARNING: Security role name {0} used in an <auth-constraint> without being defined in a <security-role> contextConfig.role.link=WARNING: Security role name {0} used in a <role-link> without being defined in a <security-role> contextConfig.role.runas=WARNING: Security role name {0} used in a <run-as> without being defined in a <security-role> +contextConfig.sci.debug=Unable to process ServletContainerInitializer for [{0}]. This is most likely due to a class defined in the @HandlesTypes annotation being missing +contextConfig.sci.info=Unable to process ServletContainerInitializer for [{0}]. This is most likely due to a class defined in the @HandlesTypes annotation being missing. Enable DEBUG level logging for the full stack trace. contextConfig.servletContainerInitializerFail=Failed to process JAR found at URL [{0}] for ServletContainerInitializers for context with name [{1}] contextConfig.start=ContextConfig: Processing START contextConfig.stop=ContextConfig: Processing STOP Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1349008&r1=1349007&r2=1349008&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Jun 11 20:59:49 2012 @@ -177,6 +177,12 @@ (markt/kkolinko) </fix> <fix> + <bug>53266</bug>: If a class specified in a <code>@HandlesTypes</code> + annotation on a <code>ServletContainerInitializer</code> is missing + log a more helpful message and do not prevent the web application from + starting. (markt) + </fix> + <fix> <bug>53267</bug>: Ensure that using the GC Daemon Protection feature of the <code>JreMemoryLeakPreventionListener</code> does not trigger a full GC every hour. (markt) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org