You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by bu...@apache.org on 2009/11/24 12:43:24 UTC
DO NOT REPLY [Bug 48270] New: Invalid stack map table tag & bad
constant pool index with Java 1.6 bytecode
https://issues.apache.org/bugzilla/show_bug.cgi?id=48270
Summary: Invalid stack map table tag & bad constant pool index
with Java 1.6 bytecode
Product: BCEL
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: Main
AssignedTo: bcel-dev@jakarta.apache.org
ReportedBy: enrico.gueli@polito.it
The following code defines a class, lets BCEL parse and rewrite it without any
modification, then it tries to load it into the JVM.
================================================================
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.JavaClass;
class TestClass {
public void foo() {
int a = 0;
/* FIRST CONDITIONAL BLOCK */
if (a == 1) {
a = 0;
}
/* SECOND CONDITIONAL BLOCK */
if (a == 1) {
a = 0;
}
};
}
class MyClassLoader extends ClassLoader {
public Class getTestClass() throws ClassNotFoundException {
JavaClass jcl;
jcl = Repository.lookupClass(TestClass.class);
byte[] data = jcl.getBytes();
return defineClass(TestClass.class.getName(), data, 0, data.length);
}
}
public class Main {
public static void main(String[] args) {
try {
MyClassLoader mcl = new MyClassLoader();
mcl.getTestClass();
} catch (Exception e) {
e.printStackTrace();
}
}
}
================================================================
If both conditional blocks are present (i.e. not commented), the following
exception appears instead:
org.apache.bcel.classfile.ClassFormatException: Invalid Stack map table tag: 6
at
org.apache.bcel.classfile.StackMapTableEntry.dump(StackMapTableEntry.java:143)
at org.apache.bcel.classfile.StackMapTable.dump(StackMapTable.java:86)
at org.apache.bcel.classfile.Code.dump(Code.java:154)
at org.apache.bcel.classfile.FieldOrMethod.dump(FieldOrMethod.java:111)
at org.apache.bcel.classfile.JavaClass.dump(JavaClass.java:317)
at org.apache.bcel.classfile.JavaClass.getBytes(JavaClass.java:268)
at MyClassLoader.getTestClass(Main.java:23)
at Main.main(Main.java:32)
If only the second one is commented, the following exception is thrown:
Exception in thread "main" java.lang.ClassFormatError: Attribute name has bad
constant pool index 4608 in class file TestClass
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
at MyClassLoader.getTestClass(Main.java:24)
at Main.main(Main.java:32)
If both conditional blocks are commented, or if the code is compiled with Java
1.5 compiler instead of 1.6, everything is OK.
This happens with BCEL revision 883394.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org
DO NOT REPLY [Bug 48270] Invalid stack map table tag & bad constant
pool index with Java 1.6 bytecode
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48270
Enrico Gueli <en...@polito.it> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
--- Comment #1 from Enrico Gueli <en...@polito.it> 2009-11-25 10:11:39 UTC ---
*** This bug has been marked as a duplicate of bug 47073 ***
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org