Program: 88526
Project: 88526
Buggy source:
/** 
 * Utility method used in the construction of   {@link UnitGraph}variants which include exceptional control flow. It determines the possible exceptions which each   {@link Unit} might throwand the set of traps which might catch those exceptions.
 * @param throwAnalysis The source of information about whichexceptions each <code>Unit</code> may throw.
 * @return A {@link Map} from <code>Unit</code>s to {@link Collection}s of  {@link ExceptionDest}s. Each <code>ExceptionDest</code> associated with a <code>Unit</code> includes a   {@link ThrowableSet} specifying exceptions that the<code>Unit</code> might throw and a  {@link Trap}specifying the handler which catches those exceptions (if the <code>Trap</code> is <code>null</code>, those exceptions escape the method without being caught).
 */
protected Map buildExceptionDests(ThrowAnalysis throwAnalysis){
class TrapRecord {
    Trap trap;
    RefType caughtType;
    boolean active;
    TrapRecord(    Trap trap){
      this.trap=trap;
      this.caughtType=RefType.v(trap.getException());
      active=false;
    }
  }
  TrapRecord[] trapTable=new TrapRecord[body.getTraps().size()];
  int trapIndex=0;
  for (Iterator trapIt=body.getTraps().iterator(); trapIt.hasNext(); trapIndex++) {
    Trap trap=(Trap)trapIt.next();
    trapTable[trapIndex]=new TrapRecord(trap);
  }
  Map unitToExceptionDests=new HashMap(unitChain.size() * 2 + 1,0.7f);
  FastHierarchy hier=Scene.v().getOrMakeFastHierarchy();
  for (Iterator unitIt=unitChain.iterator(); unitIt.hasNext(); ) {
    Unit u=(Unit)unitIt.next();
    for (int i=0; i < trapTable.length; i++) {
      if (trapTable[i].trap.getBeginUnit() == u) {
        trapTable[i].active=true;
      }
      if (trapTable[i].trap.getEndUnit() == u) {
        trapTable[i].active=false;
      }
    }
    UnitDestsMap unitDests=new UnitDestsMap();
    ThrowableSet thrownSet=throwAnalysis.mightThrow(u);
    nextThrowable:     for (Iterator i=thrownSet.types().iterator(); i.hasNext(); ) {
      RefLikeType thrown=(RefLikeType)i.next();
      if (thrown instanceof RefType) {
        RefType thrownType=(RefType)thrown;
        for (int j=0; j < trapTable.length; j++) {
          if (trapTable[j].active) {
            Trap trap=trapTable[j].trap;
            RefType caughtType=trapTable[j].caughtType;
            if (hier.canStoreType(thrownType,caughtType)) {
              unitDests.add(trap,thrownType);
              continue nextThrowable;
            }
          }
        }
        unitDests.add(null,thrownType);
      }
 else       if (thrown instanceof AnySubType) {
        AnySubType thrownType=(AnySubType)thrown;
        RefType thrownBase=thrownType.getBase();
        List alreadyCaught=new ArrayList();
        for (int j=0; j < trapTable.length; j++) {
          if (trapTable[j].active) {
            Trap trap=trapTable[j].trap;
            RefType caughtType=trapTable[j].caughtType;
            if (hier.canStoreType(thrownBase,caughtType)) {
              unitDests.add(trap,AnySubType.v(thrownBase));
              continue nextThrowable;
            }
 else             if (hier.canStoreType(caughtType,thrownBase)) {
              for (Iterator k=alreadyCaught.iterator(); k.hasNext(); ) {
                RefType alreadyType=(RefType)k.next();
                if (hier.canStoreType(caughtType,alreadyType)) {
                  continue nextThrowable;
                }
              }
              unitDests.add(trap,AnySubType.v(caughtType));
              alreadyCaught.add(caughtType);
            }
          }
        }
        unitDests.add(null,thrownType);
      }
 else {
        throw new RuntimeException("String_Node_Str" + thrown.toString() + "String_Node_Str");
      }
    }
    unitToExceptionDests.put(u,unitDests.values());
  }
  return unitToExceptionDests;
}

Fixed version (ground truth):
/** 
 * Utility method used in the construction of   {@link UnitGraph}variants which include exceptional control flow. It determines the possible exceptions which each   {@link Unit} might throwand the set of traps which might catch those exceptions.
 * @param throwAnalysis The source of information about whichexceptions each <code>Unit</code> may throw.
 * @return A {@link Map} from <code>Unit</code>s to {@link Collection}s of  {@link ExceptionDest}s. Each <code>ExceptionDest</code> associated with a <code>Unit</code> includes a   {@link ThrowableSet} specifying exceptions that the<code>Unit</code> might throw and a  {@link Trap}specifying the handler which catches those exceptions (if the <code>Trap</code> is <code>null</code>, those exceptions escape the method without being caught).
 */
protected Map buildExceptionDests(ThrowAnalysis throwAnalysis){
class TrapRecord {
    Trap trap;
    RefType caughtType;
    boolean active;
    TrapRecord(    Trap trap){
      this.trap=trap;
      this.caughtType=RefType.v(trap.getException());
      active=false;
    }
  }
  TrapRecord[] trapTable=new TrapRecord[body.getTraps().size()];
  int trapIndex=0;
  for (Iterator trapIt=body.getTraps().iterator(); trapIt.hasNext(); trapIndex++) {
    Trap trap=(Trap)trapIt.next();
    trapTable[trapIndex]=new TrapRecord(trap);
  }
  Map unitToExceptionDests=new HashMap(unitChain.size() * 2 + 1,0.7f);
  FastHierarchy hier=Scene.v().getOrMakeFastHierarchy();
  for (Iterator unitIt=unitChain.iterator(); unitIt.hasNext(); ) {
    Unit u=(Unit)unitIt.next();
    for (int i=0; i < trapTable.length; i++) {
      if (trapTable[i].trap.getBeginUnit() == u) {
        trapTable[i].active=true;
      }
      if (trapTable[i].trap.getEndUnit() == u) {
        trapTable[i].active=false;
      }
    }
    UnitDestsMap unitDests=new UnitDestsMap();
    ThrowableSet thrownSet=throwAnalysis.mightThrow(u);
    nextThrowable:     for (Iterator i=thrownSet.types().iterator(); i.hasNext(); ) {
      RefLikeType thrown=(RefLikeType)i.next();
      if (thrown instanceof RefType) {
        RefType thrownType=(RefType)thrown;
        for (int j=0; j < trapTable.length; j++) {
          if (trapTable[j].active) {
            Trap trap=trapTable[j].trap;
            RefType caughtType=trapTable[j].caughtType;
            if (hier.canStoreType(thrownType,caughtType)) {
              unitDests.add(trap,thrownType);
              continue nextThrowable;
            }
          }
        }
        unitDests.add(null,thrownType);
      }
 else       if (thrown instanceof AnySubType) {
        AnySubType thrownType=(AnySubType)thrown;
        RefType thrownBase=thrownType.getBase();
        List alreadyCaught=new ArrayList();
        nextTrap:         for (int j=0; j < trapTable.length; j++) {
          if (trapTable[j].active) {
            Trap trap=trapTable[j].trap;
            RefType caughtType=trapTable[j].caughtType;
            if (hier.canStoreType(thrownBase,caughtType)) {
              unitDests.add(trap,AnySubType.v(thrownBase));
              continue nextThrowable;
            }
 else             if (hier.canStoreType(caughtType,thrownBase)) {
              for (Iterator k=alreadyCaught.iterator(); k.hasNext(); ) {
                RefType alreadyType=(RefType)k.next();
                if (hier.canStoreType(caughtType,alreadyType)) {
                  continue nextTrap;
                }
              }
              unitDests.add(trap,AnySubType.v(caughtType));
              alreadyCaught.add(caughtType);
            }
          }
        }
        unitDests.add(null,thrownType);
      }
 else {
        throw new RuntimeException("String_Node_Str" + thrown.toString() + "String_Node_Str");
      }
    }
    unitToExceptionDests.put(u,unitDests.values());
  }
  return unitToExceptionDests;
}