Program: 17543
Project: 17543
Buggy source:
/** 
 * This function goes through the incoming stream of characters that represents the document to parse. It processes the document scanning for patterns within the data. Once a pattern has been found it is added to a list of matches. This match list will be used later on by the document tree creator.
 * @param inData
 * @return
 */
protected ArrayList tagMatchingAttempts(String inData){
  String data=this.data2Parse;
  int lastMatch=0;
  int currPos=0;
  int currState=0;
  Stack stateStack=new Stack();
  Stack statePositionStack=new Stack();
  ArrayList matches=new ArrayList();
  try {
    for (currPos=0; currPos < data.length(); currPos++) {
      char currChar=data.charAt(currPos);
      String next2Chars="String_Node_Str";
      String next3Chars="String_Node_Str";
      String around="String_Node_Str";
      if (parserState.hadFatal())       break;
      next2Chars=(data.length() - currPos > 2) ? data.substring(currPos + 1,currPos + 3) : "String_Node_Str";
      next3Chars=(data.length() - currPos > 3) ? next2Chars + data.charAt(currPos + 3) : "String_Node_Str";
      around=getSurroundingData(data,currPos);
      if (currState == MATCHER_NOTHING && currChar == '<') {
        if (next2Chars.compareTo("String_Node_Str") == 0) {
          if (next3Chars.compareTo("String_Node_Str") == 0 && data.charAt(currPos + 4) == '-') {
            stateStack.push(new Integer(currState));
            statePositionStack.push(new Integer(currPos));
            currState=MATCHER_CFMLCOMMENT;
            lastMatch=currPos;
          }
 else {
            currState=MATCHER_COMMENT;
            lastMatch=currPos;
          }
        }
 else         if (next2Chars.compareTo("String_Node_Str") == 0) {
          if (data.length() - currPos > "String_Node_Str".length() && data.substring(currPos,currPos + "String_Node_Str".length()).compareTo("String_Node_Str") == 0) {
            currPos=matchingCFScript(parserState,inData,currPos);
          }
 else           currPos=matchingCFML(parserState,inData,currPos);
        }
 else {
          currPos=matchingHTML(parserState,inData,currPos);
        }
      }
 else       if (currState == MATCHER_CFMLCOMMENT && currChar == '-' && next2Chars.compareTo("String_Node_Str") == 0 && inData.charAt(currPos + 3) == '>') {
        currState=((Integer)stateStack.pop()).intValue();
        int lastStatePos=((Integer)statePositionStack.pop()).intValue();
        if (currState == MATCHER_NOTHING) {
          ParseItemMatch commentMatch=new ParseItemMatch(inData.substring(lastStatePos,currPos + 4),lastStatePos,currPos + 4,getLineNumber(lastStatePos),MATCHER_CFMLCOMMENT);
          parserState.addMatch(commentMatch);
        }
      }
 else       if (currState == MATCHER_COMMENT && currChar == '-' && next2Chars.compareTo("String_Node_Str") == 0) {
        currState=MATCHER_NOTHING;
      }
    }
  }
 catch (  Exception excep) {
    parserState.addMessage(new ParseError(0,currPos,currPos,"String_Node_Str","String_Node_Str",true));
  }
  return matches;
}

Fixed version (ground truth):
/** 
 * This function goes through the incoming stream of characters that represents the document to parse. It processes the document scanning for patterns within the data. Once a pattern has been found it is added to a list of matches. This match list will be used later on by the document tree creator.
 * @param inData
 * @return
 */
protected ArrayList tagMatchingAttempts(String inData){
  String data=this.data2Parse;
  int lastMatch=0;
  int currPos=0;
  int currState=0;
  Stack stateStack=new Stack();
  Stack statePositionStack=new Stack();
  ArrayList matches=new ArrayList();
  try {
    for (currPos=0; currPos < data.length(); currPos++) {
      char currChar=data.charAt(currPos);
      String next2Chars="String_Node_Str";
      String next3Chars="String_Node_Str";
      String around="String_Node_Str";
      if (parserState.hadFatal())       break;
      next2Chars=(data.length() - currPos > 2) ? data.substring(currPos + 1,currPos + 3) : "String_Node_Str";
      next3Chars=(data.length() - currPos > 3) ? next2Chars + data.charAt(currPos + 3) : "String_Node_Str";
      around=getSurroundingData(data,currPos);
      if (currState == MATCHER_NOTHING && currChar == '<') {
        if (next2Chars.compareTo("String_Node_Str") == 0) {
          if (next3Chars.compareTo("String_Node_Str") == 0 && data.charAt(currPos + 4) == '-') {
            stateStack.push(new Integer(currState));
            statePositionStack.push(new Integer(currPos));
            currState=MATCHER_CFMLCOMMENT;
            lastMatch=currPos;
          }
 else {
            currState=MATCHER_COMMENT;
            lastMatch=currPos;
          }
        }
 else         if (next2Chars.toLowerCase().compareTo("String_Node_Str") == 0) {
          if (data.length() - currPos > "String_Node_Str".length() && data.substring(currPos,currPos + "String_Node_Str".length()).compareTo("String_Node_Str") == 0) {
            currPos=matchingCFScript(parserState,inData,currPos);
          }
 else           currPos=matchingCFML(parserState,inData,currPos);
        }
 else {
          currPos=matchingHTML(parserState,inData,currPos);
        }
      }
 else       if (currState == MATCHER_CFMLCOMMENT && currChar == '-' && next2Chars.compareTo("String_Node_Str") == 0 && inData.charAt(currPos + 3) == '>') {
        currState=((Integer)stateStack.pop()).intValue();
        int lastStatePos=((Integer)statePositionStack.pop()).intValue();
        if (currState == MATCHER_NOTHING) {
          ParseItemMatch commentMatch=new ParseItemMatch(inData.substring(lastStatePos,currPos + 4),lastStatePos,currPos + 4,getLineNumber(lastStatePos),MATCHER_CFMLCOMMENT);
          parserState.addMatch(commentMatch);
        }
      }
 else       if (currState == MATCHER_COMMENT && currChar == '-' && next2Chars.compareTo("String_Node_Str") == 0) {
        currState=MATCHER_NOTHING;
      }
    }
  }
 catch (  Exception excep) {
    parserState.addMessage(new ParseError(0,currPos,currPos,"String_Node_Str","String_Node_Str",true));
  }
  return matches;
}