This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new 9942ceb6cd Fix BZ 68721 - avoid duplicate class definition
9942ceb6cd is described below
commit 9942ceb6cd9ba2baf07cf89fcd0cb465f3ed9bd0
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 2249b00e10..3f8f49b31a 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -2339,6 +2339,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 746eb7b907..255b0afeaf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -128,6 +128,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]