diff --git a/jode/jode/bytecode/BytecodeInfo.java.in b/jode/jode/bytecode/BytecodeInfo.java.in index f57eb99..10d9639 100644 --- a/jode/jode/bytecode/BytecodeInfo.java.in +++ b/jode/jode/bytecode/BytecodeInfo.java.in @@ -148,7 +148,8 @@ public class BytecodeInfo extends BinaryInfo implements Opcodes { // +((Instruction)o).getDescription() // +" after "+instr.prevByAddr // .getDescription()); - instr.prevByAddr.appendInstruction((Instruction) o); + instr.prevByAddr.appendInstruction((Instruction) o, + BytecodeInfo.this); toRemove = null; } diff --git a/jode/jode/bytecode/Instruction.java b/jode/jode/bytecode/Instruction.java index c446e86..1508962 100644 --- a/jode/jode/bytecode/Instruction.java +++ b/jode/jode/bytecode/Instruction.java @@ -509,13 +509,22 @@ public final class Instruction implements Opcodes{ } } - void appendInstruction(Instruction newInstr) { + void appendInstruction(Instruction newInstr, BytecodeInfo codeinfo) { newInstr.addr = nextByAddr.addr; newInstr.nextByAddr = nextByAddr; nextByAddr.prevByAddr = newInstr; newInstr.prevByAddr = this; nextByAddr = newInstr; + + /* adjust exception handlers end */ + Handler[] handlers = codeinfo.getExceptionHandlers(); + if (handlers != null) { + for (int i=0; i< handlers.length; i++) { + if (handlers[i].end == this) + handlers[i].end = newInstr; + } + } } /**