Minor logging corrections; flow control correction when types are already enhanced.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@571599 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-08-31 21:36:19 +00:00
parent dbc7cec446
commit 8274867a54
2 changed files with 14 additions and 11 deletions

View File

@ -55,14 +55,15 @@ public class ClassRedefiner {
/**
* For each element in <code>classes</code>, this method will redefine
* all the element's methods such that field accesses are intercepted
* in-line.
* in-line. If {@link #canRedefineClasses()} returns <code>false</code>,
* this method is a no-op.
*/
public static void redefineClasses(OpenJPAConfiguration conf,
final Map<Class,byte[]> classes) {
Log log = conf.getLog(OpenJPAConfiguration.LOG_ENHANCE);
if (classes == null || classes.size() == 0)
if (classes == null || classes.size() == 0 || !canRedefineClasses())
return;
Log log = conf.getLog(OpenJPAConfiguration.LOG_ENHANCE);
Instrumentation inst = null;
ClassFileTransformer t = null;
try {

View File

@ -104,10 +104,10 @@ public class ManagedClassSubclasser {
boolean redefine = ClassRedefiner.canRedefineClasses();
if (redefine)
log.info(_loc.get("enhance-and-subclass-no-redef-start",
log.info(_loc.get("enhance-and-subclass-and-redef-start",
classes));
else
log.info(_loc.get("enhance-and-subclass-and-redef-start",
log.info(_loc.get("enhance-and-subclass-no-redef-start",
classes));
final Map<Class, byte[]> map = new HashMap<Class, byte[]>();
@ -139,7 +139,8 @@ public class ManagedClassSubclasser {
unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(),
classes, unspecified);
enhancer.run();
int runResult = enhancer.run();
if (runResult == PCEnhancer.ENHANCE_PC) {
try {
enhancer.record();
} catch (IOException e) {
@ -147,6 +148,7 @@ public class ManagedClassSubclasser {
throw new InternalException(e);
}
}
}
if (unspecified != null && !unspecified.isEmpty())
throw new UserException(_loc.get("unspecified-unenhanced-types",