Program: 29479
Project: 29479
Buggy source:
/** 
 * Private helper for the constructor to parse the SoyDoc declarations.
 * @param cleanedSoyDoc The cleaned SoyDoc text. Must not be null.
 * @return A SoyDocDeclsInfo object with the parsed info.
 */
private List<SoyDocParam> parseSoyDocDeclsHelper(String cleanedSoyDoc,SourceLocation soyDocSourceLocation){
  List<SoyDocParam> params=new ArrayList<>();
  Matcher matcher=SOY_DOC_DECL_PATTERN.matcher(cleanedSoyDoc);
  boolean isFound=matcher.find();
  while (isFound) {
    String declKeyword=matcher.group(1);
    String declText=matcher.group(2);
    int descStart=matcher.end();
    isFound=matcher.find();
    int descEnd=(isFound) ? matcher.start() : cleanedSoyDoc.length();
    String desc=cleanedSoyDoc.substring(descStart,descEnd).trim();
    if (declKeyword.equals("String_Node_Str") || declKeyword.equals("String_Node_Str")) {
      if (SOY_DOC_PARAM_TEXT_PATTERN.matcher(declText).matches()) {
        params.add(new SoyDocParam(declText,declKeyword.equals("String_Node_Str"),desc));
      }
 else {
        if (declText.startsWith("String_Node_Str")) {
          if (!isMarkedV1) {
            errorReporter.report(soyDocSourceLocation,LEGACY_COMPATIBLE_PARAM_TAG,declText);
          }
        }
 else {
          errorReporter.report(soyDocSourceLocation,INVALID_SOYDOC_PARAM,declText);
        }
      }
    }
 else {
      throw new AssertionError();
    }
  }
  return params;
}

Fixed version (ground truth):
/** 
 * Private helper for the constructor to parse the SoyDoc declarations.
 * @param cleanedSoyDoc The cleaned SoyDoc text. Must not be null.
 * @return A SoyDocDeclsInfo object with the parsed info.
 */
private List<SoyDocParam> parseSoyDocDeclsHelper(String originalSoyDoc,String cleanedSoyDoc,SourceLocation soyDocSourceLocation){
  List<SoyDocParam> params=new ArrayList<>();
  RawTextNode originalSoyDocAsNode=new RawTextNode(-1,originalSoyDoc,soyDocSourceLocation);
  Matcher matcher=SOY_DOC_DECL_PATTERN.matcher(cleanedSoyDoc);
  boolean isFound=matcher.find();
  while (isFound) {
    String declKeyword=matcher.group(1);
    String declText=matcher.group(2);
    String fullMatch=matcher.group();
    int indexOfParamName=originalSoyDoc.indexOf(declText,originalSoyDoc.indexOf(fullMatch));
    SourceLocation paramLocation=originalSoyDocAsNode.substringLocation(indexOfParamName,indexOfParamName + declText.length());
    int descStart=matcher.end();
    isFound=matcher.find();
    int descEnd=(isFound) ? matcher.start() : cleanedSoyDoc.length();
    String desc=cleanedSoyDoc.substring(descStart,descEnd).trim();
    if (declKeyword.equals("String_Node_Str") || declKeyword.equals("String_Node_Str")) {
      if (SOY_DOC_PARAM_TEXT_PATTERN.matcher(declText).matches()) {
        params.add(new SoyDocParam(declText,declKeyword.equals("String_Node_Str"),desc,paramLocation));
      }
 else {
        if (declText.startsWith("String_Node_Str")) {
          if (!isMarkedV1) {
            errorReporter.report(paramLocation,LEGACY_COMPATIBLE_PARAM_TAG,declText);
          }
        }
 else {
          errorReporter.report(paramLocation,INVALID_SOYDOC_PARAM,declText);
        }
      }
    }
 else {
      throw new AssertionError();
    }
  }
  return params;
}