From 97bf664ac853c83bac3f43ec85eaced1173d1f9f Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 22 Jul 1999 10:23:08 +0000 Subject: [PATCH] Adjust exception range when appending instructions. git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1109 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/bytecode/BytecodeInfo.java.in | 3 ++- jode/jode/bytecode/Instruction.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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; + } + } } /**