Minor logging correction; flow control correction. 'svn merge -c 571599 ../../trunk'

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@571608 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-08-31 21:46:59 +00:00
parent f1c4c68d90
commit 8265bac2b2
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 * For each element in <code>classes</code>, this method will redefine
* all the element's methods such that field accesses are intercepted * 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, public static void redefineClasses(OpenJPAConfiguration conf,
final Map<Class,byte[]> classes) { final Map<Class,byte[]> classes) {
Log log = conf.getLog(OpenJPAConfiguration.LOG_ENHANCE); if (classes == null || classes.size() == 0 || !canRedefineClasses())
if (classes == null || classes.size() == 0)
return; return;
Log log = conf.getLog(OpenJPAConfiguration.LOG_ENHANCE);
Instrumentation inst = null; Instrumentation inst = null;
ClassFileTransformer t = null; ClassFileTransformer t = null;
try { try {

View File

@ -104,10 +104,10 @@ public class ManagedClassSubclasser {
boolean redefine = ClassRedefiner.canRedefineClasses(); boolean redefine = ClassRedefiner.canRedefineClasses();
if (redefine) if (redefine)
log.info(_loc.get("enhance-and-subclass-no-redef-start", log.info(_loc.get("enhance-and-subclass-and-redef-start",
classes)); classes));
else else
log.info(_loc.get("enhance-and-subclass-and-redef-start", log.info(_loc.get("enhance-and-subclass-no-redef-start",
classes)); classes));
final Map<Class, byte[]> map = new HashMap<Class, byte[]>(); final Map<Class, byte[]> map = new HashMap<Class, byte[]>();
@ -139,12 +139,14 @@ public class ManagedClassSubclasser {
unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(), unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(),
classes, unspecified); classes, unspecified);
enhancer.run(); int runResult = enhancer.run();
try { if (runResult == PCEnhancer.ENHANCE_PC) {
enhancer.record(); try {
} catch (IOException e) { enhancer.record();
// our impl of BytecodeWriter doesn't throw IOException } catch (IOException e) {
throw new InternalException(e); // our impl of BytecodeWriter doesn't throw IOException
throw new InternalException(e);
}
} }
} }