Merge branch '7.0.x'

This commit is contained in:
Juergen Hoeller
2026-08-31 11:02:55 +02:00
2 changed files with 31 additions and 33 deletions
@@ -57,42 +57,40 @@ class ClassFileTransformerAdapter implements ClassFileTransformer {
ClassLoader loader, String className, Class<?> classBeingRedefined,
ProtectionDomain protectionDomain, byte[] classfileBuffer) {
synchronized (this) {
if (this.currentlyTransforming.get() == Boolean.TRUE) {
// Defensively back out when called from within the transform delegate below:
// in particular, for the over-eager transformer implementation in Hibernate.
return null;
}
if (this.currentlyTransforming.get() == Boolean.TRUE) {
// Defensively back out when called from within the transform delegate below:
// in particular, for the over-eager transformer implementation in Hibernate.
return null;
}
this.currentlyTransforming.set(Boolean.TRUE);
try {
byte[] transformed = this.classTransformer.transform(
loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
if (transformed != null && logger.isDebugEnabled()) {
logger.debug("Transformer of class [" + this.classTransformer.getClass().getName() +
"] transformed class [" + className + "]; bytes in=" +
classfileBuffer.length + "; bytes out=" + transformed.length);
}
return transformed;
this.currentlyTransforming.set(Boolean.TRUE);
try {
byte[] transformed = this.classTransformer.transform(
loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
if (transformed != null && logger.isDebugEnabled()) {
logger.debug("Transformer of class [" + this.classTransformer.getClass().getName() +
"] transformed class [" + className + "]; bytes in=" +
classfileBuffer.length + "; bytes out=" + transformed.length);
}
catch (ClassCircularityError ex) {
if (logger.isErrorEnabled()) {
logger.error("Circularity error while weaving class [" + className + "] with " +
"transformer of class [" + this.classTransformer.getClass().getName() + "]", ex);
}
throw new IllegalStateException("Failed to weave class [" + className + "]", ex);
return transformed;
}
catch (ClassCircularityError ex) {
if (logger.isErrorEnabled()) {
logger.error("Circularity error while weaving class [" + className + "] with " +
"transformer of class [" + this.classTransformer.getClass().getName() + "]", ex);
}
catch (Throwable ex) {
if (logger.isWarnEnabled()) {
logger.warn("Error weaving class [" + className + "] with transformer of class [" +
this.classTransformer.getClass().getName() + "]", ex);
}
// The exception will be ignored by the class loader, anyway...
throw new IllegalStateException("Could not weave class [" + className + "]", ex);
}
finally {
this.currentlyTransforming.remove();
throw new IllegalStateException("Failed to weave class [" + className + "]", ex);
}
catch (Throwable ex) {
if (logger.isWarnEnabled()) {
logger.warn("Error weaving class [" + className + "] with transformer of class [" +
this.classTransformer.getClass().getName() + "]", ex);
}
// The exception will be ignored by the class loader, anyway...
throw new IllegalStateException("Could not weave class [" + className + "]", ex);
}
finally {
this.currentlyTransforming.remove();
}
}