Program: 40609
Project: 40609
Buggy source:
/** 
 * Generate constraints which assign exception values into an exception pointer
 * @param node governing node
 * @param peis list of PEI instructions
 * @param exceptionVar PointerKey representing a pointer to an exception value
 * @param catchClasses the types "caught" by the exceptionVar
 */
protected void addExceptionDefConstraints(IR ir,CGNode node,List<ProgramCounter> peis,PointerKey exceptionVar,Set<TypeReference> catchClasses){
  for (Iterator<ProgramCounter> it=peis.iterator(); it.hasNext(); ) {
    ProgramCounter peiLoc=it.next();
    SSAInstruction pei=ir.getPEI(peiLoc);
    if (pei instanceof SSAAbstractInvokeInstruction) {
      SSAAbstractInvokeInstruction s=(SSAAbstractInvokeInstruction)pei;
      PointerKey e=heapModel.getPointerKeyForLocal(node,s.getException());
      addNode(exceptionVar);
      addNode(e);
      addEdge(exceptionVar,e,AssignLabel.v());
    }
 else     if (pei instanceof SSAAbstractThrowInstruction) {
      SSAAbstractThrowInstruction s=(SSAAbstractThrowInstruction)pei;
      PointerKey e=heapModel.getPointerKeyForLocal(node,s.getException());
      addNode(exceptionVar);
      addNode(e);
      addEdge(exceptionVar,e,AssignLabel.v());
    }
    Collection<TypeReference> types=pei.getExceptionTypes();
    if (types != null) {
      for (Iterator<TypeReference> it2=types.iterator(); it2.hasNext(); ) {
        TypeReference type=it2.next();
        if (type != null) {
          InstanceKey ik=heapModel.getInstanceKeyForPEI(node,peiLoc,type);
          if (Assertions.verifyAssertions) {
            if (!(ik instanceof ConcreteTypeKey)) {
              Assertions._assert(ik instanceof ConcreteTypeKey,"String_Node_Str" + ik);
            }
          }
          ConcreteTypeKey ck=(ConcreteTypeKey)ik;
          IClass klass=ck.getType();
          if (PropagationCallGraphBuilder.catches(catchClasses,klass,cha)) {
            addNode(exceptionVar);
            addNode(ik);
            addEdge(exceptionVar,ik,NewLabel.v());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Generate constraints which assign exception values into an exception pointer
 * @param node governing node
 * @param peis list of PEI instructions
 * @param exceptionVar PointerKey representing a pointer to an exception value
 * @param catchClasses the types "caught" by the exceptionVar
 */
protected void addExceptionDefConstraints(IR ir,CGNode node,List<ProgramCounter> peis,PointerKey exceptionVar,Set<TypeReference> catchClasses){
  for (Iterator<ProgramCounter> it=peis.iterator(); it.hasNext(); ) {
    ProgramCounter peiLoc=it.next();
    SSAInstruction pei=ir.getPEI(peiLoc);
    if (pei instanceof SSAAbstractInvokeInstruction) {
      SSAAbstractInvokeInstruction s=(SSAAbstractInvokeInstruction)pei;
      PointerKey e=heapModel.getPointerKeyForLocal(node,s.getException());
      addNode(exceptionVar);
      addNode(e);
      addEdge(exceptionVar,e,AssignLabel.noFilter());
    }
 else     if (pei instanceof SSAAbstractThrowInstruction) {
      SSAAbstractThrowInstruction s=(SSAAbstractThrowInstruction)pei;
      PointerKey e=heapModel.getPointerKeyForLocal(node,s.getException());
      addNode(exceptionVar);
      addNode(e);
      addEdge(exceptionVar,e,AssignLabel.noFilter());
    }
    Collection<TypeReference> types=pei.getExceptionTypes();
    if (types != null) {
      for (Iterator<TypeReference> it2=types.iterator(); it2.hasNext(); ) {
        TypeReference type=it2.next();
        if (type != null) {
          InstanceKey ik=heapModel.getInstanceKeyForPEI(node,peiLoc,type);
          if (Assertions.verifyAssertions) {
            if (!(ik instanceof ConcreteTypeKey)) {
              Assertions._assert(ik instanceof ConcreteTypeKey,"String_Node_Str" + ik);
            }
          }
          ConcreteTypeKey ck=(ConcreteTypeKey)ik;
          IClass klass=ck.getType();
          if (PropagationCallGraphBuilder.catches(catchClasses,klass,cha)) {
            addNode(exceptionVar);
            addNode(ik);
            addEdge(exceptionVar,ik,NewLabel.v());
          }
        }
      }
    }
  }
}