Program: 187067
Project: 187067
Buggy source:
/** 
 * Insert code of block into the instruction list.
 * @param factory factory to create instructions.
 * @param block the block  to add.
 * @param il the instruction list to add the code to.
 * @param ih the last instruction before the block code.
 * @param targetList the first instruction handle per block.
 */
private void appendCode(BcelStmtFactory factory,BasicBlock block,InstructionList il,InstructionHandle ih,List targetList) throws TypeException, GraphException {
  StackCode code=block.getStackCode();
  VariableTable varTable=block.getGraph().getVariableTable();
  InstructionHandle[] targets=new InstructionHandle[block.getTargetCount()];
  for (int i=0; i < block.getTargetCount(); i++) {
    BasicBlock.Edge edge=block.getTargetEdge(i);
    if (edge != null) {
      targets[i]=(InstructionHandle)targetList.get(edge.getTargetBlock().getBlockIndex());
    }
  }
  for (Iterator it=code.getStatements().iterator(); it.hasNext(); ) {
    StackStatement stmt=(StackStatement)it.next();
    Instruction is=factory.getInstruction(stmt,varTable,targets);
    if (is == null) {
      continue;
    }
    if (is.getOpcode() != stmt.getOpcode()) {
      throw new GraphException("String_Node_Str" + is.getOpcode() + "String_Node_Str"+ stmt.getOpcode()+ "String_Node_Str");
    }
    if (is instanceof BranchInstruction) {
      ih=il.append(ih,(BranchInstruction)is);
    }
 else {
      ih=il.append(ih,is);
    }
  }
  BasicBlock.Edge next=block.getNextBlockEdge();
  if (next != null) {
    int targetNr=next.getTargetBlock().getBlockIndex();
    if (targetNr != block.getBlockIndex() + 1) {
      il.append(ih,new GOTO((InstructionHandle)targetList.get(targetNr)));
    }
  }
}

Fixed version (ground truth):
/** 
 * Insert code of block into the instruction list.
 * @param factory factory to create instructions.
 * @param block the block  to add.
 * @param il the instruction list to add the code to.
 * @param ih the last instruction before the block code.
 * @param targetList the first instruction handle per block.
 */
private void appendCode(BcelStmtFactory factory,BasicBlock block,InstructionList il,InstructionHandle ih,List targetList) throws TypeException, GraphException {
  StackCode code=block.getStackCode();
  VariableTable varTable=block.getGraph().getVariableTable();
  InstructionHandle[] targets=new InstructionHandle[block.getTargetCount()];
  for (int i=0; i < block.getTargetCount(); i++) {
    BasicBlock.Edge edge=block.getTargetEdge(i);
    if (edge != null) {
      targets[i]=(InstructionHandle)targetList.get(edge.getTargetBlock().getBlockIndex());
    }
  }
  bbStarts.put(block.getBlockIndex(),ih);
  bbEnds.put(block.getBlockIndex(),ih);
  for (Iterator it=code.getStatements().iterator(); it.hasNext(); ) {
    StackStatement stmt=(StackStatement)it.next();
    Instruction is=factory.getInstruction(stmt,varTable,targets);
    if (is == null) {
      continue;
    }
    if (is.getOpcode() != stmt.getOpcode()) {
      throw new GraphException("String_Node_Str" + is.getOpcode() + "String_Node_Str"+ stmt.getOpcode()+ "String_Node_Str");
    }
    if (is instanceof BranchInstruction) {
      ih=il.append(ih,(BranchInstruction)is);
    }
 else {
      ih=il.append(ih,is);
    }
    bbEnds.put(block.getBlockIndex(),ih);
  }
  BasicBlock.Edge next=block.getNextBlockEdge();
  if (next != null) {
    int targetNr=next.getTargetBlock().getBlockIndex();
    if (targetNr != block.getBlockIndex() + 1) {
      ih=il.append(ih,new GOTO((InstructionHandle)targetList.get(targetNr)));
      bbEnds.put(block.getBlockIndex(),ih);
    }
  }
}