Illegal exception table range in class

<[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi! I have an Illegal exception table range in class. While trying to add
try-finally blocks. I don't understand where is the problem, it seems to me
correct: 

List<TryCatchBlockNode> tryCatchBlocks= method.tryCatchBlocks;	InsnList
newInstructionList = new InsnList();

LabelNode startTryCatchBlockLabel = new LabelNode();
LabelNode endTryCatchBlockLabel = new LabelNode();

tryCatchBlocks.add(new TryCatchBlockNode (startTryCatchBlockLabel,
endTryCatchBlockLabel,endTryCatchBlockLabel,null));
				
newInstructionList.add(startTryCatchBlockLabel);
					
newInstructionList.add(new LdcInsnNode(MethodMID));
newInstructionList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "test/MID",
"printMID", "(Ljava/lang/String;)V"));
					
//add instructionList to the existing one 
instructions.insert(newInstructionList);		
					
Iterator j = instructions.iterator();
while(j.hasNext()){
AbstractInsnNode instruction = (AbstractInsnNode) j.next() ;
						
int opcode = instruction.getOpcode();
if(opcode>=Opcodes.IRETURN && opcode<= Opcodes.RETURN )
{
// insert smth before the method return

String byeString = "Method "+method.name+method.desc+" is exiting";

newInstructionList.clear();
LabelNode normalExecutionFinallyBlockLabel = new LabelNode();
						       
//newInstructionList.add(normalExecutionFinallyBlockLabel);
							
JumpInsnNode jumpInstruction = new  JumpInsnNode
(Opcodes.GOTO,normalExecutionFinallyBlockLabel);
						       
newInstructionList.add(jumpInstruction);
							
						
						
LabelNode exceptionExecutionFinallyBlockLabel = new LabelNode();
						       
newInstructionList.add(exceptionExecutionFinallyBlockLabel);
							
newInstructionList.add(new LdcInsnNode(byeString));
newInstructionList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "test/MID",
"printMID", "(Ljava/lang/String;)V"));
							
							
LabelNode l4 = new LabelNode();
newInstructionList.add(l4);

newInstructionList.add(new InsnNode(Opcodes.ATHROW));
						       
newInstructionList.add(normalExecutionFinallyBlockLabel);
						
newInstructionList.add(new LdcInsnNode(byeString));
newInstructionList.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "test/MID",
"printMID", "(Ljava/lang/String;)V"));

//add instructionList to the existing one 
					       
instructions.insert(instruction.getPrevious(),newInstructionList);	       

							
					}
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.