Polishing

This commit is contained in:
Juergen Hoeller
2016-04-12 23:33:58 +02:00
parent 33dcef3583
commit b1c70729c2
4 changed files with 49 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,10 +27,11 @@ import org.springframework.util.Assert;
/**
* Simple adapter that implements the {@code java.lang.instrument.ClassFileTransformer}
* interface based on a JPA ClassTransformer which a JPA PersistenceProvider asks the
* PersistenceUnitInfo to install in the current runtime.
* interface based on a JPA {@code ClassTransformer} which a JPA PersistenceProvider
* asks the {@code PersistenceUnitInfo} to install in the current runtime.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @since 2.0
* @see javax.persistence.spi.PersistenceUnitInfo#addTransformer(javax.persistence.spi.ClassTransformer)
*/
@@ -63,14 +64,16 @@ class ClassFileTransformerAdapter implements ClassFileTransformer {
return transformed;
}
catch (ClassCircularityError ex) {
logger.error("Error weaving class [" + className + "] with " +
"transformer of class [" + this.classTransformer.getClass().getName() + "]", ex);
throw new IllegalStateException("Could not weave class [" + className + "]", 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);
}
catch (Throwable ex) {
if (logger.isWarnEnabled()) {
logger.warn("Error weaving class [" + className + "] with " +
"transformer of class [" + this.classTransformer.getClass().getName() + "]", ex);
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);