Program: 135975
Project: 135975
Buggy source:
/** 
 * Removes or modifies status markers so that no markers appear on any of the lines from the begin line to the end line of the root. Any markers that are only on those lines are deleted. Any markers that overlap with those lines are shortened so that they do not overlap. If root is a TheoremNode with a proof, then the begin line is root.getLocation().beginLine() and the end line is root.getProof().getLocation().endLine(). For all other cases, the begin line is root.getLocation().beginLine() and the end line is root.getLocation().endLine().
 * @param module
 * @param root
 */
public static void removeStatusFromTree(IFile module,LevelNode root){
  try {
    IDocument document=ResourceHelper.getDocFromFile(module);
    int beginLine=root.getLocation().beginLine() - 1;
    int endLine=root.getLocation().endLine() - 1;
    if (root instanceof TheoremNode && ((TheoremNode)root).getProof() != null) {
      endLine=((TheoremNode)root).getProof().getLocation().endLine() - 1;
    }
    int treeBeginChar=document.getLineOffset(beginLine);
    int treeEndChar=document.getLineOffset(endLine) + document.getLineLength(endLine) - 1;
    IMarker[] markers=module.findMarkers(STEP_STATUS_MARKER,true,IResource.DEPTH_ZERO);
    for (int i=0; i < markers.length; i++) {
      IMarker oldMarker=markers[i];
      int markerStartChar=oldMarker.getAttribute(IMarker.CHAR_START,-1);
      int markerEndChar=oldMarker.getAttribute(IMarker.CHAR_END,-1);
      if (markerStartChar >= treeBeginChar && markerEndChar <= treeEndChar) {
        oldMarker.delete();
      }
 else       if (markerStartChar < treeBeginChar && markerEndChar >= treeBeginChar && markerEndChar <= treeEndChar) {
        IMarker newMarker=module.createMarker(oldMarker.getType());
        newMarker.setAttribute(IMarker.CHAR_START,markerStartChar);
        newMarker.setAttribute(IMarker.CHAR_END,treeBeginChar - 1);
        oldMarker.delete();
      }
 else       if (markerStartChar < treeBeginChar && markerEndChar > treeEndChar) {
        IMarker beforeMarker=module.createMarker(oldMarker.getType());
        beforeMarker.setAttribute(IMarker.CHAR_START,markerStartChar);
        beforeMarker.setAttribute(IMarker.CHAR_END,treeBeginChar - 1);
        IMarker afterMarker=module.createMarker(oldMarker.getType());
        afterMarker.setAttribute(IMarker.CHAR_START,treeEndChar + 1);
        afterMarker.setAttribute(IMarker.CHAR_END,markerEndChar);
        oldMarker.delete();
      }
 else       if (markerStartChar >= treeBeginChar && markerStartChar <= treeEndChar && markerEndChar > treeEndChar) {
        IMarker newMarker=module.createMarker(oldMarker.getType());
        newMarker.setAttribute(IMarker.CHAR_START,treeEndChar + 1);
        newMarker.setAttribute(IMarker.CHAR_END,markerEndChar);
        oldMarker.delete();
      }
    }
  }
 catch (  CoreException e) {
    ProverUIActivator.logError("String_Node_Str" + root,e);
  }
catch (  BadLocationException e) {
    ProverUIActivator.logError("String_Node_Str" + root,e);
  }
}

Fixed version (ground truth):
/** 
 * Removes or modifies status markers so that no markers appear on any of the lines from the begin line to the end line of the root. Any markers that are only on those lines are deleted. Any markers that overlap with those lines are shortened so that they do not overlap. If root is a TheoremNode with a proof, then the begin line is root.getLocation().beginLine() and the end line is root.getProof().getLocation().endLine(). For all other cases, the begin line is root.getLocation().beginLine() and the end line is root.getLocation().endLine().
 * @param module
 * @param root
 */
public static void removeStatusFromTree(IFile module,LevelNode root){
  try {
    IDocument document=ResourceHelper.getDocFromFile(module);
    int beginLine=root.getLocation().beginLine() - 1;
    int endLine=root.getLocation().endLine() - 1;
    if (root instanceof TheoremNode && ((TheoremNode)root).getProof() != null) {
      endLine=((TheoremNode)root).getProof().getLocation().endLine() - 1;
    }
    int treeBeginChar=document.getLineOffset(beginLine);
    int treeEndChar=document.getLineOffset(endLine) + document.getLineLength(endLine);
    IMarker[] markers=module.findMarkers(STEP_STATUS_MARKER,true,IResource.DEPTH_ZERO);
    for (int i=0; i < markers.length; i++) {
      IMarker oldMarker=markers[i];
      int markerStartChar=oldMarker.getAttribute(IMarker.CHAR_START,-1);
      int markerEndChar=oldMarker.getAttribute(IMarker.CHAR_END,-1);
      if (markerStartChar >= treeBeginChar && markerEndChar <= treeEndChar) {
        oldMarker.delete();
      }
 else       if (markerStartChar < treeBeginChar && markerEndChar >= treeBeginChar && markerEndChar <= treeEndChar) {
        IMarker newMarker=module.createMarker(oldMarker.getType());
        newMarker.setAttribute(IMarker.CHAR_START,markerStartChar);
        newMarker.setAttribute(IMarker.CHAR_END,treeBeginChar - 1);
        oldMarker.delete();
      }
 else       if (markerStartChar < treeBeginChar && markerEndChar > treeEndChar) {
        IMarker beforeMarker=module.createMarker(oldMarker.getType());
        beforeMarker.setAttribute(IMarker.CHAR_START,markerStartChar);
        beforeMarker.setAttribute(IMarker.CHAR_END,treeBeginChar - 1);
        IMarker afterMarker=module.createMarker(oldMarker.getType());
        afterMarker.setAttribute(IMarker.CHAR_START,treeEndChar + 1);
        afterMarker.setAttribute(IMarker.CHAR_END,markerEndChar);
        oldMarker.delete();
      }
 else       if (markerStartChar >= treeBeginChar && markerStartChar <= treeEndChar && markerEndChar > treeEndChar) {
        IMarker newMarker=module.createMarker(oldMarker.getType());
        newMarker.setAttribute(IMarker.CHAR_START,treeEndChar + 1);
        newMarker.setAttribute(IMarker.CHAR_END,markerEndChar);
        oldMarker.delete();
      }
    }
  }
 catch (  CoreException e) {
    ProverUIActivator.logError("String_Node_Str" + root,e);
  }
catch (  BadLocationException e) {
    ProverUIActivator.logError("String_Node_Str" + root,e);
  }
}