tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r781592 - in /tomcat/container/tc5.5.x: catalina/src/share/org/apache/catalina/loader/LocalStrings.properties catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java webapps/docs/changelog.xml
Date Wed, 03 Jun 2009 21:37:13 GMT
Author: markt
Date: Wed Jun  3 21:37:13 2009
New Revision: 781592

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

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/LocalStrings.properties
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/LocalStrings.properties?rev=781592&r1=781591&r2=781592&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/LocalStrings.properties
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/LocalStrings.properties
Wed Jun  3 21:37:13 2009
@@ -29,6 +29,7 @@
 standardLoader.starting=Starting this Loader
 standardLoader.stopping=Stopping this Loader
 webappClassLoader.stopped=Illegal access: this web application instance has been stopped
already.  Could not load {0}.  The eventual following stack trace is caused by an error thrown
for debugging purposes as well as to attempt to terminate the thread which caused the illegal
access, and has no functional impact.
+webappClassLoader.wrongVersion=(unable to load class {0})
 webappLoader.addRepository=Adding repository {0}
 webappLoader.deploy=Deploying class repositories to work directory {0}
 webappLoader.jarDeploy=Deploy JAR {0} to {1}

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java?rev=781592&r1=781591&r2=781592&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
(original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
Wed Jun  3 21:37:13 2009
@@ -1826,7 +1826,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
@@ -1872,19 +1876,22 @@
     
             }
 
-            if (entry.loadedClass == null) {
+            try {
                 clazz = defineClass(name, entry.binaryContent, 0,
                         entry.binaryContent.length, 
                         new CodeSource(entry.codeBase, entry.certificates));
-                entry.loadedClass = clazz;
-                entry.binaryContent = null;
-                entry.source = null;
-                entry.codeBase = null;
-                entry.manifest = null;
-                entry.certificates = null;
-            } else {
-                clazz = entry.loadedClass;
-            }
+            } 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;

Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=781592&r1=781591&r2=781592&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Jun  3 21:37:13 2009
@@ -43,6 +43,10 @@
   <subsection name="Catalina">
     <changelog>
       <fix>
+        <bug>37458</bug>: Fix sync error that may lead to NPE in rare
+        circumstances. Patch by Konstantin Kolinko. (markt)
+      </fix>
+      <fix>
         <bug>37498</bug>: Fall back to container log if application log is
         unavailable during context destruction. (markt)
       </fix>



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


Mime
View raw message