bcel-user

[Prev] Thread [Next]  |  [Prev] Date [Next]

ArrayIndexOutOfBoundsException in generic.PUTFIELD Razvanica Mon May 25 11:00:51 2009

Hello all,

Here's my problem. I am trying to make some network simulations using a tool
called JiST/SWANS. This simulator has been written for Java 1.4 and, for my
simulations, I would like to use some 1.5 features, like genericity. 

So what I am trying to do is to compile the original code with the "source
-1.5" tag instead of the "source -1.4" tag. The problem is that the
simulator uses bcel to rewrite the bytecode so that JVM could be used for
simulations. The bcel library in the release doesn't work with the "source
-1.5" tag so I replace it with bcel-5.2. I made 2 minor modifications to the
original code :
- I have added an implementation of getClassPath in a class that implements
org.apache.bcel.util.Repository. This class just returns null, just like in
org.apache.bcel.util.ClassLoaderRepository
- In a class using org.apache.bcel.Repository.lookupClass() I am now
throwing java.lang.ClassNotFoundException 

These 2 modifications shouldn't change anything as far as I understand the
application. And when I compile the new code with the "-source 1.4" tag, it
doesn,t change anything. Everything compiles and works just fine. However,
when I compile the new code with the "-source 1.5" tag the compilation goes
smoothly, but, at runtime, the rewriter throws an
ArrayIndexOutOfBoundsException.


This happens every time org.apache.bcel.generic.PUTFIELD.accept is called:
java.lang.ArrayIndexOutOfBoundsException: -1 
   at java.util.ArrayList.remove(ArrayList.java:390)
   at
org.apache.bcel.verifier.structurals.OperandStack.pop(OperandStack.java:135)
   at
org.apache.bcel.verifier.structurals.ExecutionVisitor.visitPUTFIELD(ExecutionVisitor.java:1048)
   at org.apache.bcel.generic.PUTFIELD.accept(PUTFIELD.java:78)

Does anybody have any idea what happens and if there's something I could do
to fix this?

Thank you.
-- 
View this message in context: 
http://www.nabble.com/ArrayIndexOutOfBoundsException-in-generic.PUTFIELD-tp23710707p23710707.html
Sent from the BCEL - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]