This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new cfa2efe74d Fix BZ 68721 - avoid duplicate class definition cfa2efe74d is described below commit cfa2efe74d48e65931aaeb8481fe5d59b480f7c3 Author: Mark Thomas <ma...@apache.org> 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 76a37184a3..6e9e403a4b 100644 --- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java +++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java @@ -2354,6 +2354,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 6aede7159f..05fd2726d6 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -135,6 +135,16 @@ <code>Context</code> to control the bahavior, defaulting to <code>false</code>. (remm) </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: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org