Program: 135967
Project: 135967
Buggy source:
/** 
 * Called to stream text into this parser. This method creates instances of   {@link TLAPMMessage} andprocess them according to their type.  
 * @param text
 * @throws BadLocationException
 */
public void appendText(String text){
  String searchText=text;
  while (!searchText.isEmpty()) {
    if (inMessage) {
      int endTagIndex=searchText.indexOf(END_TAG);
      if (endTagIndex != -1) {
        inMessage=false;
        currentMessageBuffer.append(searchText.substring(0,endTagIndex));
        TLAPMMessage data=TLAPMMessage.parseMessage(currentMessageBuffer.toString(),moduleFile.getLocation().removeFileExtension().lastSegment());
        if (data != null) {
          if (data instanceof ObligationStatusMessage) {
            ProverHelper.processObligationMessage((ObligationStatusMessage)data,description.getLevelNode());
            if (ProverHelper.isObligationFinished((ObligationStatusMessage)data,description)) {
              monitor.worked(1);
            }
          }
 else           if (data instanceof ObligationNumberMessage) {
            ObligationNumberMessage numMessage=(ObligationNumberMessage)data;
            monitor.beginTask("String_Node_Str" + numMessage.getCount() + "String_Node_Str",numMessage.getCount());
          }
 else           if (data instanceof StepStatusMessage) {
            ProverHelper.newStepStatusMessage((StepStatusMessage)data,description.isStatusCheck());
          }
        }
        searchText=searchText.substring(endTagIndex + END_TAG.length(),searchText.length());
      }
 else {
        currentMessageBuffer.append(searchText);
        searchText="String_Node_Str";
      }
    }
 else {
      int startTagIndex=searchText.indexOf(START_TAG);
      if (startTagIndex != -1) {
        inMessage=true;
        searchText=searchText.substring(startTagIndex + START_TAG.length(),searchText.length());
        currentMessageBuffer=new StringBuilder();
      }
 else {
        searchText="String_Node_Str";
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Called to stream text into this parser. This method creates instances of   {@link TLAPMMessage} andprocess them according to their type. See the comments within the method for the parsing algorithm.
 * @param text
 * @throws BadLocationException
 */
public void appendText(String text){
  currentSearchTextBuffer.append(text);
  int tagIndex=-1;
  if (inMessage) {
    tagIndex=currentSearchTextBuffer.indexOf(END_TAG);
  }
 else {
    tagIndex=currentSearchTextBuffer.indexOf(START_TAG);
  }
  while (tagIndex != -1) {
    if (inMessage) {
      TLAPMMessage data=TLAPMMessage.parseMessage(currentSearchTextBuffer.substring(0,tagIndex),moduleFile.getLocation().removeFileExtension().lastSegment());
      currentSearchTextBuffer.replace(0,tagIndex + END_TAG.length(),"String_Node_Str");
      inMessage=false;
      if (data != null) {
        if (data instanceof ObligationStatusMessage) {
          ProverHelper.processObligationMessage((ObligationStatusMessage)data,description.getLevelNode());
          if (ProverHelper.isObligationFinished((ObligationStatusMessage)data,description)) {
            monitor.worked(1);
          }
        }
 else         if (data instanceof ObligationNumberMessage) {
          ObligationNumberMessage numMessage=(ObligationNumberMessage)data;
          monitor.beginTask("String_Node_Str" + numMessage.getCount() + "String_Node_Str",numMessage.getCount());
        }
 else         if (data instanceof StepStatusMessage) {
          ProverHelper.newStepStatusMessage((StepStatusMessage)data,description.isStatusCheck());
        }
      }
    }
 else {
      currentSearchTextBuffer.replace(0,tagIndex + START_TAG.length(),"String_Node_Str");
      inMessage=true;
    }
    if (inMessage) {
      tagIndex=currentSearchTextBuffer.indexOf(END_TAG);
    }
 else {
      tagIndex=currentSearchTextBuffer.indexOf(START_TAG);
    }
  }
}