You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/06/16 16:12:27 UTC

DO NOT REPLY [Bug 51386] New: @HandlingType not correctly handled at server startup leads to incorrect classes set passed to initializers

https://issues.apache.org/bugzilla/show_bug.cgi?id=51386

             Bug #: 51386
           Summary: @HandlingType not correctly handled at server startup
                    leads to incorrect classes set passed to initializers
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: etienne.massip@gmail.com
    Classification: Unclassified


The following code in
org.apache.catalina.startup.ContextConfig.checkHandlesTypes(JavaClass) looks
very buggy :

  boolean match = false;

  for (Map.Entry<Class<?>, Set<ServletContainerInitializer>> entry :
          typeInitializerMap.entrySet()) {
      if (entry.getKey().isAnnotation()) {
          AnnotationEntry[] annotationEntries =
javaClass.getAnnotationEntries();
          for (AnnotationEntry annotationEntry : annotationEntries) {
              if (entry.getKey().getName().equals(
                  getClassName(annotationEntry.getAnnotationType()))) {
                  match = true;
                  break;
              }
          }
      } else if (entry.getKey().isAssignableFrom(clazz)) {
          match = true;
      }
      if (match) {
          for (ServletContainerInitializer sci : entry.getValue()) {
              initializerClassMap.get(sci).add(clazz);
          }
      }
  }

Shouldn't "match" variable be reset to false at each iteration ?

As it is for now, my SpringServletContainerInitializer (3.1M2), handling only
WebApplicationInitializers, will finally receive a huge set of various
applicative classes, starting from the first class parsed matching any type
handled by any previously parsed ServletContainerInitializer !!!

http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51386] @HandlingType not correctly handled at server startup leads to incorrect classes set passed to initializers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51386

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Mark Thomas <ma...@apache.org> 2011-06-16 17:24:30 UTC ---
Thanks for the report. This has been fixed in 7.0.x and will be included in
7.0.17 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51386] @HandlingType not correctly handled at server startup leads to incorrect classes set passed to initializers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51386

--- Comment #2 from Mark Thomas <ma...@apache.org> 2011-06-16 15:54:26 UTC ---
Yep, that looks like a problem. I'll put together a test case and fix.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51386] @HandlingType not correctly handled at server startup leads to incorrect classes set passed to initializers

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51386

--- Comment #1 from Etienne Massip <et...@gmail.com> 2011-06-16 14:55:12 UTC ---
Finally leading to a cast exception preventing server startup.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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