tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48489] New: Tomcat CL doesn't resolve the array classes.
Date Tue, 05 Jan 2010 13:19:38 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=48489

           Summary: Tomcat CL doesn't resolve the array classes.
           Product: Tomcat 6
           Version: 6.0.0
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: kakvicky@yahoo.co.in


Attached is the sample app whose index.jsp would explain the error, call this
jsp 
http://localhost:8080/sampleapp/index.jsp

The TomcatCL does not resolve the array class e.g 
loader.loadClass("[Lsample.SampleClass;")

And here is the fix 

Index: src/share/classes/org/apache/catalina/loader/WebappClassLoader.java
===================================================================
--- src/share/classes/org/apache/catalina/loader/WebappClassLoader.java
(revision 1335)
+++ src/share/classes/org/apache/catalina/loader/WebappClassLoader.java
(working copy)
@@ -902,8 +902,22 @@
                throw new ClassNotFoundException(name);
            }
        } catch (ClassNotFoundException e) {
-            if (log.isTraceEnabled())
-                log.trace("    --> Passing on ClassNotFoundException");
+         if (log.isTraceEnabled())
+         log.trace("We need to check for array class "+name);
+            if( name.charAt(0) == '[' )
+            {
+               clazz = Class.forName(name, true, this);
+               if (log.isTraceEnabled())
+               log.debug("      Returning class " + clazz);
+               if ((log.isTraceEnabled()) && (clazz != null))
+                   log.debug("      Loaded by " + clazz.getClassLoader());
+               return clazz;
+            }
+            else
+            {
+            if (log.isTraceEnabled())
+                log.trace("    --> Passing on ClassNotFoundException");
+            }
            throw e;
        }

-- 
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


Mime
View raw message