Program: 35817
Project: 35817
Buggy source:
/** 
 * Finds next   {@linkplain Region} in content starting from provided<code>position</code>.
 * @return {@linkplain Result} object with next found {@linkplain Region}and its end position for further parsing or <code>null</code> if no more regions could not be found.
 */
protected Result find(String content,int position) throws AggregationSyntaxException {
  if (position >= content.length()) {
    return null;
  }
  final Template esiComment=Tag.findTemplate("String_Node_Str",Tag.WAT_END,content,position);
  final Template esi=Tag.findTemplate("String_Node_Str","String_Node_Str",content,position);
  final Template wat=Tag.findTemplate(Tag.WAT_START + "String_Node_Str",Tag.WAT_END,content,position);
  final Template first=findFirst(LAST,esiComment,esi,wat);
  if (LAST == first) {
    return new Result(new UnmodifiableRegion(content,position,content.length()),content.length());
  }
 else   if (first.getStart() > position) {
    return new Result(new UnmodifiableRegion(content,position,first.getStart()),first.getStart());
  }
 else   if (esiComment == first) {
    String inner=first.getContent();
    inner=inner.substring("String_Node_Str".length(),inner.length() - Tag.WAT_END.length());
    List<Region> parsed=doParse(inner);
    CompositeRegion result=new CompositeRegion();
    for (    Region child : parsed) {
      result.add(child);
    }
    return new Result(result,first.getEnd());
  }
 else   if (esi == first) {
    EsiIncludeTag esiTag=new EsiIncludeTag(first);
    return new Result(new IncludeBlockRegion(esiTag.getProvider(),esiTag.getPage(),null,propagateJsessionId),esiTag.getEnd());
  }
 else {
    Tag openTag=Tag.create(Tag.WAT_START,Tag.WAT_END,wat);
    if (openTag.countTokens() < 3 || openTag.countTokens() > 4)     throw new AggregationSyntaxException("String_Node_Str" + openTag);
    String provider=openTag.getToken(1);
    String page=openTag.getToken(2);
    String blockOrTemplate=(openTag.countTokens() == 4) ? openTag.getToken(3) : null;
    if ("String_Node_Str".equals(openTag.getToken(0))) {
      Tag closeTag=Tag.findNext("String_Node_Str",content,openTag);
      if (closeTag == null || !"String_Node_Str".equals(closeTag.getToken(0))) {
        closeTag=openTag;
      }
      return new Result(new IncludeBlockRegion(provider,page,blockOrTemplate,propagateJsessionId),closeTag.getEndIndex());
    }
 else     if ("String_Node_Str".equals(openTag.getToken(0))) {
      Tag closeTag=Tag.findNext("String_Node_Str",content,openTag);
      return new Result(new IncludeTemplateRegion(provider,page,blockOrTemplate,propagateJsessionId,content.substring(openTag.getEndIndex(),closeTag.getBeginIndex())),closeTag.getEndIndex());
    }
 else {
      throw new AggregationSyntaxException("String_Node_Str" + openTag);
    }
  }
}

Fixed version (ground truth):
/** 
 * Finds next   {@linkplain Region} in content starting from provided<code>position</code>.
 * @return {@linkplain Result} object with next found {@linkplain Region}and its end position for further parsing or <code>null</code> if no more regions could not be found.
 */
protected Result find(String content,int position) throws AggregationSyntaxException {
  if (position >= content.length()) {
    return null;
  }
  final Template esiComment=findTemplate("String_Node_Str","String_Node_Str",content,position);
  final Template esiInclude=findTemplate("String_Node_Str","String_Node_Str",content,position);
  final Tag includeBlockTag=Tag.find("String_Node_Str",content,position);
  final Tag includeTemplateTag=Tag.find("String_Node_Str",content,position);
  int firstPosition=Integer.MAX_VALUE;
  if (esiComment != null)   firstPosition=esiComment.getStart();
  if (esiInclude != null && esiInclude.getStart() < firstPosition)   firstPosition=esiInclude.getStart();
  if (includeBlockTag != null && includeBlockTag.getBeginIndex() < firstPosition)   firstPosition=includeBlockTag.getBeginIndex();
  if (includeTemplateTag != null && includeTemplateTag.getBeginIndex() < firstPosition)   firstPosition=includeTemplateTag.getBeginIndex();
  if (firstPosition == Integer.MAX_VALUE) {
    return new Result(new UnmodifiableRegion(content,position,content.length()),content.length());
  }
 else   if (firstPosition > position) {
    return new Result(new UnmodifiableRegion(content,position,firstPosition),firstPosition);
  }
 else   if (esiComment != null && esiComment.getStart() == firstPosition) {
    String inner=esiComment.getContent();
    inner=inner.substring("String_Node_Str".length(),inner.length() - "String_Node_Str".length());
    List<Region> parsed=doParse(inner);
    CompositeRegion result=new CompositeRegion();
    for (    Region child : parsed) {
      result.add(child);
    }
    return new Result(result,esiComment.getEnd());
  }
 else   if (esiInclude != null && esiInclude.getStart() == firstPosition) {
    EsiIncludeTag esiTag=new EsiIncludeTag(esiInclude);
    return new Result(new IncludeBlockRegion(esiTag.getProvider(),esiTag.getPage(),null,propagateJsessionId),esiTag.getEnd());
  }
 else   if (includeBlockTag != null && includeBlockTag.getBeginIndex() == firstPosition) {
    if (includeBlockTag.countTokens() < 3 || includeBlockTag.countTokens() > 4)     throw new AggregationSyntaxException("String_Node_Str" + includeBlockTag);
    String provider=includeBlockTag.getToken(1);
    String page=includeBlockTag.getToken(2);
    String block=(includeBlockTag.countTokens() == 4) ? includeBlockTag.getToken(3) : null;
    Tag closeTag=Tag.find("String_Node_Str",content,includeBlockTag.getEndIndex());
    if (closeTag == null)     closeTag=includeBlockTag;
    return new Result(new IncludeBlockRegion(provider,page,block,propagateJsessionId),closeTag.getEndIndex());
  }
 else   if (includeTemplateTag != null && includeTemplateTag.getBeginIndex() == firstPosition) {
    if (includeTemplateTag.countTokens() < 3 || includeTemplateTag.countTokens() > 4)     throw new AggregationSyntaxException("String_Node_Str" + includeTemplateTag);
    String provider=includeTemplateTag.getToken(1);
    String page=includeTemplateTag.getToken(2);
    String template=(includeTemplateTag.countTokens() == 4) ? includeTemplateTag.getToken(3) : null;
    Tag closeTag=Tag.find("String_Node_Str",content,includeTemplateTag.getEndIndex());
    if (closeTag == null)     closeTag=includeTemplateTag;
    return new Result(new IncludeTemplateRegion(provider,page,template,propagateJsessionId,content.substring(includeTemplateTag.getEndIndex(),closeTag.getBeginIndex())),closeTag.getEndIndex());
  }
  return null;
}