openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r1241719 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance: AsmAdaptor.java PCClassFileTransformer.java
Date Wed, 08 Feb 2012 00:52:33 GMT
Author: kwsutter
Date: Wed Feb  8 00:52:32 2012
New Revision: 1241719

URL: http://svn.apache.org/viewvc?rev=1241719&view=rev
Log:
OPENJPA-2122.  The conditional to check for the proper Java 7 major version (51) was incorrect.
 I also updated how we invoked the ASM hook so that the Trace message in the finally block
would output the correct number of bytes.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/AsmAdaptor.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/AsmAdaptor.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/AsmAdaptor.java?rev=1241719&r1=1241718&r2=1241719&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/AsmAdaptor.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/AsmAdaptor.java
Wed Feb  8 00:52:32 2012
@@ -74,7 +74,7 @@ public final class AsmAdaptor {
     }
 
     public static byte[] toByteArray(BCClass bc, byte[] returnBytes) throws IOException {
-        if (returnBytes.length >= 8 && (returnBytes[6] << 8 + returnBytes[7])
>= Java7_MajorVersion) {
+        if (bc.getMajorVersion() >= Java7_MajorVersion) {
             returnBytes = toJava7ByteArray(bc, returnBytes);
         }
         return returnBytes;

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java?rev=1241719&r1=1241718&r2=1241719&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCClassFileTransformer.java
Wed Feb  8 00:52:32 2012
@@ -30,6 +30,8 @@ import org.apache.openjpa.lib.util.Local
 import org.apache.openjpa.lib.util.Options;
 import org.apache.openjpa.meta.MetaDataRepository;
 import org.apache.openjpa.util.GeneralException;
+
+import serp.bytecode.BCClass;
 import serp.bytecode.Project;
 import serp.bytecode.lowlevel.ConstantPoolTable;
 
@@ -150,8 +152,9 @@ public class PCClassFileTransformer
 
             if (enhancer.run() == PCEnhancer.ENHANCE_NONE)
                 return null;
-            returnBytes = enhancer.getPCBytecode().toByteArray();
-            return AsmAdaptor.toByteArray(enhancer.getPCBytecode(), returnBytes);
+            BCClass pcb = enhancer.getPCBytecode();
+            returnBytes = AsmAdaptor.toByteArray(pcb, pcb.toByteArray());
+            return returnBytes;
         } catch (Throwable t) {
             _log.warn(_loc.get("cft-exception-thrown", className), t);
             if (t instanceof RuntimeException)



Mime
View raw message