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.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1241719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kevin W. Sutter 2012-02-08 00:52:32 +00:00
parent 647ab63101
commit 91eb9d4792
2 changed files with 6 additions and 3 deletions

View File

@ -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;

View File

@ -30,6 +30,8 @@ import org.apache.openjpa.lib.util.Localizer;
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)