Program: 88644
Project: 88644
Buggy source:
/** 
 * handles try/catch/finally (try/catch is separate for simplicity)
 */
private void createTryCatchFinally(polyglot.ast.Try tryStmt){
  HashMap gotoMap=new HashMap();
  polyglot.ast.Block tryBlock=tryStmt.tryBlock();
  soot.jimple.Stmt noop1=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(noop1);
  createBlock(tryBlock);
  soot.jimple.Stmt noop2=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(noop2);
  soot.jimple.Stmt endNoop=soot.jimple.Jimple.v().newNopStmt();
  soot.jimple.Stmt tryGotoFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(tryGotoFinallyNoop);
  soot.jimple.Stmt tryFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
  soot.jimple.Stmt tryGotoFinally=soot.jimple.Jimple.v().newGotoStmt(tryFinallyNoop);
  body.getUnits().add(tryGotoFinally);
  soot.jimple.Stmt beforeEndGotoNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(beforeEndGotoNoop);
  soot.jimple.Stmt tryEndGoto=soot.jimple.Jimple.v().newGotoStmt(endNoop);
  body.getUnits().add(tryEndGoto);
  gotoMap.put(tryFinallyNoop,beforeEndGotoNoop);
  soot.jimple.Stmt catchAllBeforeNoop=soot.jimple.Jimple.v().newNopStmt();
  Iterator it=tryStmt.catchBlocks().iterator();
  while (it.hasNext()) {
    soot.jimple.Stmt noop3=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(noop3);
    polyglot.ast.Catch catchBlock=(polyglot.ast.Catch)it.next();
    soot.jimple.Stmt catchRefNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(catchRefNoop);
    createCatchFormal(catchBlock.formal());
    soot.jimple.Stmt catchStmtsNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(catchStmtsNoop);
    createBlock(catchBlock.body());
    soot.jimple.Stmt catchGotoFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(catchGotoFinallyNoop);
    soot.jimple.Stmt catchFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
    soot.jimple.Stmt catchGotoFinally=soot.jimple.Jimple.v().newGotoStmt(catchFinallyNoop);
    body.getUnits().add(catchGotoFinally);
    soot.jimple.Stmt beforeCatchEndGotoNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(beforeCatchEndGotoNoop);
    soot.jimple.Stmt catchEndGoto=soot.jimple.Jimple.v().newGotoStmt(endNoop);
    body.getUnits().add(catchEndGoto);
    gotoMap.put(catchFinallyNoop,beforeCatchEndGotoNoop);
    soot.Type sootType=Util.getSootType(catchBlock.catchType());
    addToExceptionList(noop1,noop2,noop3,soot.Scene.v().getSootClass(sootType.toString()));
    addToExceptionList(catchStmtsNoop,beforeCatchEndGotoNoop,catchAllBeforeNoop,soot.Scene.v().getSootClass("String_Node_Str"));
  }
  soot.Local formalLocal=lg.generateLocal(soot.RefType.v("String_Node_Str"));
  body.getUnits().add(catchAllBeforeNoop);
  soot.jimple.CaughtExceptionRef exceptRef=soot.jimple.Jimple.v().newCaughtExceptionRef();
  soot.jimple.Stmt stmt=soot.jimple.Jimple.v().newIdentityStmt(formalLocal,exceptRef);
  body.getUnits().add(stmt);
  soot.jimple.Stmt beforeCatchAllAssignNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(beforeCatchAllAssignNoop);
  soot.Local catchAllAssignLocal=lg.generateLocal(soot.RefType.v("String_Node_Str"));
  soot.jimple.Stmt catchAllAssign=soot.jimple.Jimple.v().newAssignStmt(catchAllAssignLocal,formalLocal);
  body.getUnits().add(catchAllAssign);
  soot.jimple.Stmt catchAllFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
  soot.jimple.Stmt catchAllGotoFinally=soot.jimple.Jimple.v().newGotoStmt(catchAllFinallyNoop);
  body.getUnits().add(catchAllGotoFinally);
  soot.jimple.Stmt catchAllBeforeThrowNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(catchAllBeforeThrowNoop);
  soot.jimple.Stmt throwStmt=soot.jimple.Jimple.v().newThrowStmt(catchAllAssignLocal);
  throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag());
  body.getUnits().add(throwStmt);
  gotoMap.put(catchAllFinallyNoop,catchAllBeforeThrowNoop);
  soot.jimple.Stmt catchAllGotoEnd=soot.jimple.Jimple.v().newGotoStmt(endNoop);
  body.getUnits().add(catchAllGotoEnd);
  addToExceptionList(beforeCatchAllAssignNoop,catchAllBeforeThrowNoop,catchAllBeforeNoop,soot.Scene.v().getSootClass("String_Node_Str"));
  Iterator finallyIt=gotoMap.keySet().iterator();
  while (finallyIt.hasNext()) {
    soot.jimple.Stmt noopStmt=(soot.jimple.Stmt)finallyIt.next();
    body.getUnits().add(noopStmt);
    createBlock(tryStmt.finallyBlock());
    soot.jimple.Stmt backToStmt=(soot.jimple.Stmt)gotoMap.get(noopStmt);
    soot.jimple.Stmt backToGoto=soot.jimple.Jimple.v().newGotoStmt(backToStmt);
    body.getUnits().add(backToGoto);
  }
  body.getUnits().add(endNoop);
  addToExceptionList(noop1,beforeEndGotoNoop,catchAllBeforeNoop,soot.Scene.v().getSootClass("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * handles try/catch/finally (try/catch is separate for simplicity)
 */
private void createTryCatchFinally(polyglot.ast.Try tryStmt){
  HashMap gotoMap=new HashMap();
  polyglot.ast.Block tryBlock=tryStmt.tryBlock();
  soot.jimple.Stmt noop1=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(noop1);
  currentTryStmt=tryStmt;
  createBlock(tryBlock);
  currentTryStmt=null;
  soot.jimple.Stmt noop2=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(noop2);
  soot.jimple.Stmt endNoop=soot.jimple.Jimple.v().newNopStmt();
  soot.jimple.Stmt tryGotoFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(tryGotoFinallyNoop);
  soot.jimple.Stmt tryFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
  soot.jimple.Stmt tryGotoFinally=soot.jimple.Jimple.v().newGotoStmt(tryFinallyNoop);
  body.getUnits().add(tryGotoFinally);
  soot.jimple.Stmt beforeEndGotoNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(beforeEndGotoNoop);
  soot.jimple.Stmt tryEndGoto=soot.jimple.Jimple.v().newGotoStmt(endNoop);
  body.getUnits().add(tryEndGoto);
  gotoMap.put(tryFinallyNoop,beforeEndGotoNoop);
  soot.jimple.Stmt catchAllBeforeNoop=soot.jimple.Jimple.v().newNopStmt();
  Iterator it=tryStmt.catchBlocks().iterator();
  while (it.hasNext()) {
    soot.jimple.Stmt noop3=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(noop3);
    polyglot.ast.Catch catchBlock=(polyglot.ast.Catch)it.next();
    soot.jimple.Stmt catchRefNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(catchRefNoop);
    createCatchFormal(catchBlock.formal());
    soot.jimple.Stmt catchStmtsNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(catchStmtsNoop);
    createBlock(catchBlock.body());
    soot.jimple.Stmt catchGotoFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(catchGotoFinallyNoop);
    soot.jimple.Stmt catchFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
    soot.jimple.Stmt catchGotoFinally=soot.jimple.Jimple.v().newGotoStmt(catchFinallyNoop);
    body.getUnits().add(catchGotoFinally);
    soot.jimple.Stmt beforeCatchEndGotoNoop=soot.jimple.Jimple.v().newNopStmt();
    body.getUnits().add(beforeCatchEndGotoNoop);
    soot.jimple.Stmt catchEndGoto=soot.jimple.Jimple.v().newGotoStmt(endNoop);
    body.getUnits().add(catchEndGoto);
    gotoMap.put(catchFinallyNoop,beforeCatchEndGotoNoop);
    soot.Type sootType=Util.getSootType(catchBlock.catchType());
    addToExceptionList(noop1,noop2,noop3,soot.Scene.v().getSootClass(sootType.toString()));
    addToExceptionList(catchStmtsNoop,beforeCatchEndGotoNoop,catchAllBeforeNoop,soot.Scene.v().getSootClass("String_Node_Str"));
  }
  soot.Local formalLocal=lg.generateLocal(soot.RefType.v("String_Node_Str"));
  body.getUnits().add(catchAllBeforeNoop);
  soot.jimple.CaughtExceptionRef exceptRef=soot.jimple.Jimple.v().newCaughtExceptionRef();
  soot.jimple.Stmt stmt=soot.jimple.Jimple.v().newIdentityStmt(formalLocal,exceptRef);
  body.getUnits().add(stmt);
  soot.jimple.Stmt beforeCatchAllAssignNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(beforeCatchAllAssignNoop);
  soot.Local catchAllAssignLocal=lg.generateLocal(soot.RefType.v("String_Node_Str"));
  soot.jimple.Stmt catchAllAssign=soot.jimple.Jimple.v().newAssignStmt(catchAllAssignLocal,formalLocal);
  body.getUnits().add(catchAllAssign);
  soot.jimple.Stmt catchAllFinallyNoop=soot.jimple.Jimple.v().newNopStmt();
  soot.jimple.Stmt catchAllGotoFinally=soot.jimple.Jimple.v().newGotoStmt(catchAllFinallyNoop);
  body.getUnits().add(catchAllGotoFinally);
  soot.jimple.Stmt catchAllBeforeThrowNoop=soot.jimple.Jimple.v().newNopStmt();
  body.getUnits().add(catchAllBeforeThrowNoop);
  soot.jimple.Stmt throwStmt=soot.jimple.Jimple.v().newThrowStmt(catchAllAssignLocal);
  throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag());
  body.getUnits().add(throwStmt);
  gotoMap.put(catchAllFinallyNoop,catchAllBeforeThrowNoop);
  soot.jimple.Stmt catchAllGotoEnd=soot.jimple.Jimple.v().newGotoStmt(endNoop);
  body.getUnits().add(catchAllGotoEnd);
  addToExceptionList(beforeCatchAllAssignNoop,catchAllBeforeThrowNoop,catchAllBeforeNoop,soot.Scene.v().getSootClass("String_Node_Str"));
  Iterator finallyIt=gotoMap.keySet().iterator();
  while (finallyIt.hasNext()) {
    soot.jimple.Stmt noopStmt=(soot.jimple.Stmt)finallyIt.next();
    body.getUnits().add(noopStmt);
    createBlock(tryStmt.finallyBlock());
    soot.jimple.Stmt backToStmt=(soot.jimple.Stmt)gotoMap.get(noopStmt);
    soot.jimple.Stmt backToGoto=soot.jimple.Jimple.v().newGotoStmt(backToStmt);
    body.getUnits().add(backToGoto);
  }
  body.getUnits().add(endNoop);
  addToExceptionList(noop1,beforeEndGotoNoop,catchAllBeforeNoop,soot.Scene.v().getSootClass("String_Node_Str"));
}