tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r730735 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
Date Fri, 02 Jan 2009 14:24:36 GMT
Author: markt
Date: Fri Jan  2 06:24:35 2009
New Revision: 730735

URL: http://svn.apache.org/viewvc?rev=730735&view=rev
Log:
Fix https://issues.apache.org/bugzilla/attachment.cgi?id=23066
Sync issue leads to NPE in rare circumstances
Patch provided by Konstantin Kolinko

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=730735&r1=730734&r2=730735&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Fri Jan  2 06:24:35
2009
@@ -1794,7 +1794,11 @@
             return clazz;
 
         synchronized (this) {
-            if (entry.binaryContent == null && entry.loadedClass == null)
+            clazz = entry.loadedClass;
+            if (clazz != null)
+                return clazz;
+
+            if (entry.binaryContent == null)
                 throw new ClassNotFoundException(name);
 
             // Looking up the package
@@ -1843,26 +1847,22 @@
     
             }
 
-            if (entry.loadedClass == null) {
-                try {
-                    clazz = defineClass(name, entry.binaryContent, 0,
-                            entry.binaryContent.length, 
-                            new CodeSource(entry.codeBase, entry.certificates));
-                } catch (UnsupportedClassVersionError ucve) {
-                    throw new UnsupportedClassVersionError(
-                            ucve.getLocalizedMessage() + " " +
-                            sm.getString("webappClassLoader.wrongVersion",
-                                    name));
-                }
-                entry.loadedClass = clazz;
-                entry.binaryContent = null;
-                entry.source = null;
-                entry.codeBase = null;
-                entry.manifest = null;
-                entry.certificates = null;
-            } else {
-                clazz = entry.loadedClass;
-            }
+            try {
+                clazz = defineClass(name, entry.binaryContent, 0,
+                        entry.binaryContent.length, 
+                        new CodeSource(entry.codeBase, entry.certificates));
+            } catch (UnsupportedClassVersionError ucve) {
+                throw new UnsupportedClassVersionError(
+                        ucve.getLocalizedMessage() + " " +
+                        sm.getString("webappClassLoader.wrongVersion",
+                                name));
+            }
+            entry.loadedClass = clazz;
+            entry.binaryContent = null;
+            entry.source = null;
+            entry.codeBase = null;
+            entry.manifest = null;
+            entry.certificates = null;
         }
         
         return clazz;



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


Mime
View raw message