Program: 135896
Project: 135896
Buggy source:
/** 
 * The inner recursive method used by get UsesOfSymbol.  It appends all the appropriate OpApplNodes  to <code>found</code>. Note: modified by LL on 14 Sep 2010 so a subexpression name like  Foo!1!(a) will be returned as a use of Foo.  This is introduces another case to be handled when trying to extract the symbol's occurrence from the  OpApplNode containing the symbol.  This is the one case in which the symbol is not really the operator of the OpApplNode.
 * @param symbol
 * @param node
 * @param found
 * @return
 */
private static void innerGetUsesOfSymbol(SymbolNode symbol,SemanticNode node,Vector<SemanticNode> found){
  SymbolNode[] defs=null;
  if (node instanceof OpApplNode) {
    OpApplNode oan=(OpApplNode)node;
    if (sourceEquals(oan.getOperator(),symbol) || ((oan.subExpressionOf != null) && sourceEquals(oan.subExpressionOf,symbol))) {
      found.add(node);
    }
  }
 else   if ((node instanceof OpArgNode) && sourceEquals(((OpArgNode)node).getOp(),symbol)) {
    found.add(node);
  }
 else {
    if (node instanceof LeafProofNode) {
      defs=((LeafProofNode)node).getDefs();
    }
 else     if (node instanceof UseOrHideNode) {
      defs=((UseOrHideNode)node).defs;
    }
    if (defs != null) {
      UniqueString defStr=UniqueString.uniqueStringOf("String_Node_Str");
      int defIdx=-1;
      SyntaxTreeNode stn=((SyntaxTreeNode)node.stn);
      if (stn.getKind() == SyntaxTreeConstants.N_ProofStep) {
        if (stn.getHeirs().length > 1) {
          stn=stn.getHeirs()[1];
        }
 else {
          System.out.println("String_Node_Str");
        }
      }
      for (int i=0; i < stn.getHeirs().length; i++) {
        SyntaxTreeNode nd=stn.getHeirs()[i];
        if (nd.image == defStr) {
          defIdx=i;
          break;
        }
      }
      if (defIdx != -1) {
        for (int i=0; i < defs.length; i++) {
          if (sourceEquals(defs[i],symbol)) {
            if (defIdx + 2 * i + 1 < stn.getHeirs().length) {
              found.add(new NewSymbNode(null,null,stn.getHeirs()[defIdx + 2 * i + 1]));
            }
 else {
              System.out.println("String_Node_Str");
            }
          }
        }
      }
 else {
        System.out.println("String_Node_Str");
      }
    }
  }
  SemanticNode[] children=node.getChildren();
  if (children == null) {
    return;
  }
  for (int i=0; i < children.length; i++) {
    final SemanticNode sn=children[i];
    if (sn != null) {
      if (node.getLocation().source().equals(sn.getLocation().source())) {
        innerGetUsesOfSymbol(symbol,sn,found);
      }
    }
  }
  return;
}

Fixed version (ground truth):
/** 
 * The inner recursive method used by get UsesOfSymbol.  It appends all the appropriate OpApplNodes  to <code>found</code>. Note: modified by LL on 14 Sep 2010 so a subexpression name like  Foo!1!(a) will be returned as a use of Foo.  This is introduces another case to be handled when trying to extract the symbol's occurrence from the  OpApplNode containing the symbol.  This is the one case in which the symbol is not really the operator of the OpApplNode.
 * @param symbol
 * @param node
 * @param found
 * @return
 */
private static void innerGetUsesOfSymbol(SymbolNode symbol,SemanticNode node,Vector<SemanticNode> found){
  SymbolNode[] defs=null;
  if (node instanceof OpApplNode) {
    OpApplNode oan=(OpApplNode)node;
    if (sourceEquals(oan.getOperator(),symbol) || ((oan.subExpressionOf != null) && sourceEquals(oan.subExpressionOf,symbol))) {
      found.add(node);
    }
  }
 else   if ((node instanceof OpArgNode) && sourceEquals(((OpArgNode)node).getOp(),symbol)) {
    found.add(node);
  }
 else {
    if (node instanceof LeafProofNode) {
      defs=((LeafProofNode)node).getDefs();
    }
 else     if (node instanceof UseOrHideNode) {
      defs=((UseOrHideNode)node).defs;
    }
    if (defs != null && defs.length != 0) {
      UniqueString defStr=UniqueString.uniqueStringOf("String_Node_Str");
      int defIdx=-1;
      SyntaxTreeNode stn=((SyntaxTreeNode)node.stn);
      if (stn.getKind() == SyntaxTreeConstants.N_ProofStep) {
        if (stn.getHeirs().length > 1) {
          stn=stn.getHeirs()[1];
        }
 else {
          System.out.println("String_Node_Str");
        }
      }
      for (int i=0; i < stn.getHeirs().length; i++) {
        SyntaxTreeNode nd=stn.getHeirs()[i];
        if (nd.image == defStr) {
          defIdx=i;
          break;
        }
      }
      if (defIdx != -1) {
        for (int i=0; i < defs.length; i++) {
          if (sourceEquals(defs[i],symbol)) {
            if (defIdx + 2 * i + 1 < stn.getHeirs().length) {
              found.add(new NewSymbNode(null,null,stn.getHeirs()[defIdx + 2 * i + 1]));
            }
 else {
              System.out.println("String_Node_Str");
            }
          }
        }
      }
 else {
        System.out.println("String_Node_Str");
      }
    }
  }
  SemanticNode[] children=node.getChildren();
  if (children == null) {
    return;
  }
  for (int i=0; i < children.length; i++) {
    final SemanticNode sn=children[i];
    if (sn != null) {
      if (node.getLocation().source().equals(sn.getLocation().source())) {
        innerGetUsesOfSymbol(symbol,sn,found);
      }
    }
  }
  return;
}