Fix bug 44633. Tell use which class failed to load due to wrong version number.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Mar 2008 15:57:42 +0000 (15:57 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 24 Mar 2008 15:57:42 +0000 (15:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@640451 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/loader/LocalStrings.properties
java/org/apache/catalina/loader/WebappClassLoader.java

index fe15cb9..d90297d 100644 (file)
@@ -29,6 +29,7 @@ standardLoader.removeRepository=Removing repository {0}
 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} due to a bad version number in the .class file.
 webappLoader.addRepository=Adding repository {0}
 webappLoader.deploy=Deploying class repositories to work directory {0}
 webappLoader.jarDeploy=Deploy JAR {0} to {1}
index e037273..4df1b54 100644 (file)
@@ -1842,9 +1842,14 @@ public class WebappClassLoader
             }
 
             if (entry.loadedClass == null) {
-                clazz = defineClass(name, entry.binaryContent, 0,
-                        entry.binaryContent.length, 
-                        new CodeSource(entry.codeBase, entry.certificates));
+                try {
+                    clazz = defineClass(name, entry.binaryContent, 0,
+                            entry.binaryContent.length, 
+                            new CodeSource(entry.codeBase, entry.certificates));
+                } catch (UnsupportedClassVersionError ucve) {
+                    throw new UnsupportedClassVersionError(
+                            sm.getString("webappClassLoader.wrongVersion", name));
+                }
                 entry.loadedClass = clazz;
                 entry.binaryContent = null;
                 entry.source = null;