This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 3d564d0ae2 Fix BZ 68721 - avoid duplicate class definition
3d564d0ae2 is described below
commit 3d564d0ae2b6344c6c7f476c0a9076538a382dd2
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Mar 7 13:51:20 2024 -0500
Fix BZ 68721 - avoid duplicate class definition
Triggered if the transformation of a class also triggers loading of the
same class.
---
java/org/apache/catalina/loader/WebappClassLoaderBase.java | 11 +++++++++++
webapps/docs/changelog.xml | 10 ++++++++++
2 files changed, 21 insertions(+)
diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 66295dce8f..a2277c2067 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -2346,6 +2346,17 @@ public abstract class WebappClassLoaderBase extends
URLClassLoader
} catch (UnsupportedClassVersionError ucve) {
throw new UnsupportedClassVersionError(
ucve.getLocalizedMessage() + " " +
sm.getString("webappClassLoader.wrongVersion", name));
+ } catch (LinkageError e) {
+ // May be caused by the transformation also triggering loading
of the class - BZ 68721
+ try {
+ // Try and load the already defined class
+ clazz = findLoadedClass0(name);
+ } catch (Throwable t) {
+ // Not BZ 68721
+ ExceptionUtils.handleThrowable(t);
+ // Re-throw the original exception
+ throw e;
+ }
}
entry.loadedClass = clazz;
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3476cffa2e..b613c6f3f7 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -119,6 +119,16 @@
FORM authentication, ensure that neither the URI, the query string nor
the protocol are corrupted when restoring the request body. (markt)
</fix>
+ <fix>
+ <bug>68721</bug>: Workaround a possible cause of duplicate class
+ definitions when using <code>ClassFileTransformer</code>s and the
+ transformation of a class also triggers the loading of the same class.
+ (markt)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
<fix>
Improve the HTTP/2 stream prioritisation process. If a stream uses all
of the connection windows and still has content to write, it will now
be
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]