Program: 178558
Project: 178558
Buggy source:
/** 
 * Parse a TAP line.
 * @param tapLine TAP line
 */
public void parseLine(String tapLine){
  Matcher matcher=null;
  matcher=Constants.COMMENT_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onComment(matcher.group(1));
    return;
  }
  if (state.getBaseIndentationLevel() > -1) {
    matcher=Constants.INDENTATION_PATTERN.matcher(tapLine);
    if (matcher.matches()) {
      int indentation=matcher.group(1).length();
      state.setCurrentIndentationLevel(indentation);
      if (indentation > state.getBaseIndentationLevel()) {
        if (tapLine.trim().equals("String_Node_Str")) {
          state.setCurrentlyInYaml(true);
          state.setCurrentYamlIndentation(matcher.group(1));
          return;
        }
 else         if (tapLine.equals(state.getCurrentYamlIndentation() + "String_Node_Str")) {
          state.setCurrentlyInYaml(false);
          return;
        }
 else         if (state.isCurrentlyInYaml()) {
          state.getDiagnosticBuffer().append(tapLine);
          state.getDiagnosticBuffer().append('\n');
          return;
        }
 else {
          if (this.subtestsEnabled) {
            this.parseDiagnostics();
            if (state.getLastParsedElement() instanceof TestResult) {
              indentation=state.getBaseIndentationLevel();
              TestResult lastTestResult=(TestResult)state.getLastParsedElement();
              this.pushMemento();
              lastTestResult.setSubtest(state.getTestSet());
            }
 else             if (state.getLastParsedElement() instanceof Plan) {
              indentation=state.getBaseIndentationLevel();
              Plan lastTestResult=(Plan)state.getLastParsedElement();
              this.pushMemento();
              lastTestResult.setSubtest(state.getTestSet());
            }
          }
        }
      }
      this.checkIndentationLevel(indentation,tapLine);
    }
  }
  this.parseDiagnostics();
  state.setLastLine(tapLine);
  matcher=Constants.BAIL_OUT_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onBailOut(matcher.group(1),matcher.group(3));
    return;
  }
  matcher=Constants.HEADER_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onHeader(Integer.parseInt(matcher.group(1)),matcher.group(3));
    return;
  }
  matcher=Constants.PLAN_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onPlan(Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(3)),matcher.group(6),matcher.group(8));
    return;
  }
  matcher=Constants.TEST_RESULT_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    String testNumberText=matcher.group(2);
    int testNumber=0;
    if (testNumberText != null && testNumberText.trim().equals("String_Node_Str") == false) {
      testNumber=Integer.parseInt(testNumberText);
    }
 else {
      if (state.getTestSet().getPlan() != null && state.isPlanBeforeTestResult() == false)       return;
      if (state.getTestSet().getPlan() != null && state.getTestSet().getPlan().getLastTestNumber() == state.getTestSet().getTestResults().size())       return;
      testNumber=getTestSet().getNextTestNumber();
    }
    onTestResult(StatusValues.get(matcher.group(1)),testNumber,matcher.group(3),DirectiveValues.get(matcher.group(5)),matcher.group(6),matcher.group(8));
    return;
  }
  matcher=Constants.FOOTER_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onFooter(matcher.group(1),matcher.group(3));
    return;
  }
  final Text text=new Text(tapLine);
  getTestSet().getTapLines().add(text);
  state.setLastParsedElement(text);
}

Fixed version (ground truth):
/** 
 * Parse a TAP line.
 * @param tapLine TAP line
 */
public void parseLine(String tapLine){
  Matcher matcher=null;
  matcher=Constants.COMMENT_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onComment(matcher.group(1));
    return;
  }
  if (state.getBaseIndentationLevel() > -1) {
    matcher=Constants.INDENTATION_PATTERN.matcher(tapLine);
    if (matcher.matches()) {
      int indentation=matcher.group(1).length();
      state.setCurrentIndentationLevel(indentation);
      if (indentation > state.getBaseIndentationLevel()) {
        if (state.isCurrentlyInYaml()) {
          if (tapLine.equals(state.getCurrentYamlIndentation() + "String_Node_Str")) {
            state.setCurrentlyInYaml(false);
            return;
          }
          state.getDiagnosticBuffer().append(tapLine);
          state.getDiagnosticBuffer().append('\n');
          return;
        }
 else         if (tapLine.trim().equals("String_Node_Str")) {
          state.setCurrentlyInYaml(true);
          state.setCurrentYamlIndentation(matcher.group(1));
          return;
        }
 else {
          if (this.subtestsEnabled) {
            this.parseDiagnostics();
            if (state.getLastParsedElement() instanceof TestResult) {
              indentation=state.getBaseIndentationLevel();
              TestResult lastTestResult=(TestResult)state.getLastParsedElement();
              this.pushMemento();
              lastTestResult.setSubtest(state.getTestSet());
            }
 else             if (state.getLastParsedElement() instanceof Plan) {
              indentation=state.getBaseIndentationLevel();
              Plan lastTestResult=(Plan)state.getLastParsedElement();
              this.pushMemento();
              lastTestResult.setSubtest(state.getTestSet());
            }
          }
        }
      }
      this.checkIndentationLevel(indentation,tapLine);
    }
  }
  this.parseDiagnostics();
  state.setLastLine(tapLine);
  matcher=Constants.BAIL_OUT_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onBailOut(matcher.group(1),matcher.group(3));
    return;
  }
  matcher=Constants.HEADER_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onHeader(Integer.parseInt(matcher.group(1)),matcher.group(3));
    return;
  }
  matcher=Constants.PLAN_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onPlan(Integer.parseInt(matcher.group(1)),Integer.parseInt(matcher.group(3)),matcher.group(6),matcher.group(8));
    return;
  }
  matcher=Constants.TEST_RESULT_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    String testNumberText=matcher.group(2);
    int testNumber=0;
    if (testNumberText != null && testNumberText.trim().equals("String_Node_Str") == false) {
      testNumber=Integer.parseInt(testNumberText);
    }
 else {
      if (state.getTestSet().getPlan() != null && state.isPlanBeforeTestResult() == false)       return;
      if (state.getTestSet().getPlan() != null && state.getTestSet().getPlan().getLastTestNumber() == state.getTestSet().getTestResults().size())       return;
      testNumber=getTestSet().getNextTestNumber();
    }
    onTestResult(StatusValues.get(matcher.group(1)),testNumber,matcher.group(3),DirectiveValues.get(matcher.group(5)),matcher.group(6),matcher.group(8));
    return;
  }
  matcher=Constants.FOOTER_PATTERN.matcher(tapLine);
  if (matcher.matches()) {
    onFooter(matcher.group(1),matcher.group(3));
    return;
  }
  final Text text=new Text(tapLine);
  getTestSet().getTapLines().add(text);
  state.setLastParsedElement(text);
}