Program: 135974
Project: 135974
Buggy source:
/** 
 * Creates a SANY marker for levelNode if it is a   {@link TheoremNode} or a {@link UseOrHideNode}. If it has a proof, this method recursively calls it self on all children. The SANY location attribute for these markers is a string representation of the location of the node if it is a   {@link UseOrHideNode} and the string representation of the location of the node{@link TheoremNode#getTheorem()} if it is a {@link TheoremNode}. The methods   {@link #locToString(Location)} and {@link #stringToLoc(String)} convert from{@link Location} to Strings and back.See  {@link ProverHelper#SANY_MARKER} for a description ofthese markers.
 * @param theoremNode
 * @throws CoreException 
 */
public static void createSANYMarkersForTree(LevelNode levelNode,IResource module) throws CoreException {
  if (levelNode == null) {
    return;
  }
  if (levelNode instanceof UseOrHideNode || levelNode instanceof TheoremNode) {
    IMarker marker=module.createMarker(SANY_MARKER);
    Location locForAttr;
    if (levelNode instanceof UseOrHideNode) {
      locForAttr=levelNode.getLocation();
    }
 else {
      locForAttr=((TheoremNode)levelNode).getTheorem().getLocation();
    }
    marker.setAttribute(SANY_LOC_ATR,locToString(locForAttr));
    IRegion locRegion=AdapterFactory.locationToRegion(locForAttr);
    marker.setAttribute(IMarker.CHAR_START,locRegion.getOffset());
    marker.setAttribute(IMarker.CHAR_END,locRegion.getOffset() + locRegion.getLength() - 1);
  }
  if (levelNode instanceof TheoremNode) {
    TheoremNode theoremNode=(TheoremNode)levelNode;
    ProofNode proof=theoremNode.getProof();
    if (proof != null) {
      if (proof instanceof NonLeafProofNode) {
        NonLeafProofNode nonLeafProof=(NonLeafProofNode)proof;
        LevelNode[] steps=nonLeafProof.getSteps();
        for (int i=0; i < steps.length; i++) {
          createSANYMarkersForTree(steps[i],module);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a SANY marker for levelNode if it is a   {@link TheoremNode} or a {@link UseOrHideNode}. If it has a proof, this method recursively calls it self on all children. The SANY location attribute for these markers is a string representation of the location of the node if it is a   {@link UseOrHideNode} and the string representation of the location of the node{@link TheoremNode#getTheorem()} if it is a {@link TheoremNode}. The methods   {@link #locToString(Location)} and {@link #stringToLoc(String)} convert from{@link Location} to Strings and back.See  {@link ProverHelper#SANY_MARKER} for a description ofthese markers.
 * @param theoremNode
 * @throws CoreException 
 */
public static void createSANYMarkersForTree(LevelNode levelNode,IResource module) throws CoreException {
  if (levelNode == null) {
    return;
  }
  if (levelNode instanceof UseOrHideNode || levelNode instanceof TheoremNode) {
    IMarker marker=module.createMarker(SANY_MARKER);
    Location locForAttr;
    if (levelNode instanceof UseOrHideNode) {
      locForAttr=levelNode.getLocation();
    }
 else {
      locForAttr=((TheoremNode)levelNode).getTheorem().getLocation();
    }
    marker.setAttribute(SANY_LOC_ATR,locToString(locForAttr));
    IRegion locRegion=AdapterFactory.locationToRegion(locForAttr);
    marker.setAttribute(IMarker.CHAR_START,locRegion.getOffset());
    marker.setAttribute(IMarker.CHAR_END,locRegion.getOffset() + locRegion.getLength());
  }
  if (levelNode instanceof TheoremNode) {
    TheoremNode theoremNode=(TheoremNode)levelNode;
    ProofNode proof=theoremNode.getProof();
    if (proof != null) {
      if (proof instanceof NonLeafProofNode) {
        NonLeafProofNode nonLeafProof=(NonLeafProofNode)proof;
        LevelNode[] steps=nonLeafProof.getSteps();
        for (int i=0; i < steps.length; i++) {
          createSANYMarkersForTree(steps[i],module);
        }
      }
    }
  }
}