Program: 85366
Project: 85366
Buggy source:
@Override protected void internalTransform(Body b,String phaseName,Map<String,String> options){
  if (b.getTraps().size() == 0)   return;
  ExceptionalUnitGraph eug=new ExceptionalUnitGraph(b,DalvikThrowAnalysis.v(),Options.v().omit_excepting_unit_edges());
  Map<Trap,List<Trap>> replaceTrapBy=new HashMap<Trap,List<Trap>>();
  boolean updateTrap=false;
  for (  Trap tr : b.getTraps()) {
    List<Trap> newTraps=new ArrayList<Trap>();
    Unit firstTrapStmt=tr.getBeginUnit();
    boolean goesToHandler=false;
    updateTrap=false;
    for (Unit u=tr.getBeginUnit(); u != tr.getEndUnit(); u=b.getUnits().getSuccOf(u)) {
      if (goesToHandler) {
        goesToHandler=false;
      }
 else {
        firstTrapStmt=u;
      }
      for (      Unit d : eug.getExceptionalSuccsOf(u)) {
        if (d == tr.getHandlerUnit()) {
          goesToHandler=true;
          break;
        }
      }
      if (!goesToHandler) {
        updateTrap=true;
        if (firstTrapStmt == u)         continue;
        Trap t=Jimple.v().newTrap(tr.getException(),firstTrapStmt,u,tr.getHandlerUnit());
        newTraps.add(t);
      }
 else {
        if (b.getUnits().getSuccOf(u) == tr.getEndUnit() && updateTrap) {
          Trap t=Jimple.v().newTrap(tr.getException(),firstTrapStmt,tr.getEndUnit(),tr.getHandlerUnit());
          newTraps.add(t);
        }
      }
    }
    if (updateTrap) {
      replaceTrapBy.put(tr,newTraps);
    }
  }
  for (  Trap k : replaceTrapBy.keySet()) {
    b.getTraps().insertAfter(replaceTrapBy.get(k),k);
    b.getTraps().remove(k);
  }
}

Fixed version (ground truth):
@Override protected void internalTransform(Body b,String phaseName,Map<String,String> options){
  if (b.getTraps().size() == 0)   return;
  ExceptionalUnitGraph eug=new ExceptionalUnitGraph(b,DalvikThrowAnalysis.v(),Options.v().omit_excepting_unit_edges());
  Set<Unit> unitsWithMonitor=getUnitsWithMonitor(eug);
  Map<Trap,List<Trap>> replaceTrapBy=new HashMap<Trap,List<Trap>>(b.getTraps().size());
  boolean updateTrap=false;
  for (  Trap tr : b.getTraps()) {
    List<Trap> newTraps=new ArrayList<Trap>();
    Unit firstTrapStmt=tr.getBeginUnit();
    boolean goesToHandler=false;
    updateTrap=false;
    for (Unit u=tr.getBeginUnit(); u != tr.getEndUnit(); u=b.getUnits().getSuccOf(u)) {
      if (goesToHandler) {
        goesToHandler=false;
      }
 else {
        firstTrapStmt=u;
      }
      if (tr.getException().getName().equals("String_Node_Str") && unitsWithMonitor.contains(u))       goesToHandler=true;
      if (!goesToHandler)       for (      Unit d : eug.getExceptionalSuccsOf(u)) {
        if (d == tr.getHandlerUnit()) {
          goesToHandler=true;
          break;
        }
      }
      if (!goesToHandler) {
        updateTrap=true;
        if (firstTrapStmt == u)         continue;
        Trap t=Jimple.v().newTrap(tr.getException(),firstTrapStmt,u,tr.getHandlerUnit());
        newTraps.add(t);
      }
 else {
        if (b.getUnits().getSuccOf(u) == tr.getEndUnit() && updateTrap) {
          Trap t=Jimple.v().newTrap(tr.getException(),firstTrapStmt,tr.getEndUnit(),tr.getHandlerUnit());
          newTraps.add(t);
        }
      }
    }
    if (updateTrap) {
      replaceTrapBy.put(tr,newTraps);
    }
  }
  for (  Trap k : replaceTrapBy.keySet()) {
    b.getTraps().insertAfter(replaceTrapBy.get(k),k);
    b.getTraps().remove(k);
  }
}