Hi Mark,

[EMAIL PROTECTED] schrieb:
+++ tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties Mon 
Mar 24 08:57:42 2008
@@ -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} 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}

+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Mon Mar 
24 08:57:42 2008
@@ -1842,9 +1842,14 @@
             }
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;

when I saw your commit, I asked myself "What's the original error message" because we shouldn't overwrite any other information that's helpful. So I looked it up and finally I end up proposing a modification to your patch:

webappClassLoader.wrongVersion= (unable to load class {0})

...
throw new UnsupportedClassVersionError(
    ucve.getMessage() +
    sm.getString("webappClassLoader.wrongVersion", name));

That message enhancement pattern should be more stable, in case there's anything helpful in the original message, like the version number.

We could even use ucve.getLocalizedMessage() instead of ucve.getMessage().

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to