Program: 69690
Project: 69690
Buggy source:
/** 
 * Highlight (bold,color) query words in result-document. Set HighlightResult for content or description. 
 * @param query
 * @param analyzer
 * @param doc
 * @param resultDocument
 * @throws IOException
 */
private void doHighlight(Query query,Analyzer analyzer,Document doc,ResultDocument resultDocument) throws IOException {
  Highlighter highlighter=new Highlighter(new SimpleHTMLFormatter(HIGHLIGHT_PRE_TAG,HIGHLIGHT_POST_TAG),new SimpleHTMLEncoder(),new QueryScorer(query));
  try {
    String content=doc.get(AbstractOlatDocument.CONTENT_FIELD_NAME);
    TokenStream tokenStream=analyzer.tokenStream(AbstractOlatDocument.CONTENT_FIELD_NAME,new StringReader(content));
    String highlightResult=highlighter.getBestFragments(tokenStream,content,3,HIGHLIGHT_SEPARATOR);
    if (highlightResult.length() == 0) {
      String description=doc.get(AbstractOlatDocument.DESCRIPTION_FIELD_NAME);
      tokenStream=analyzer.tokenStream(AbstractOlatDocument.DESCRIPTION_FIELD_NAME,new StringReader(description));
      highlightResult=highlighter.getBestFragments(tokenStream,description,3,HIGHLIGHT_SEPARATOR);
      resultDocument.setHighlightingDescription(true);
    }
    resultDocument.setHighlightResult(highlightResult);
    String title=doc.get(AbstractOlatDocument.TITLE_FIELD_NAME);
    tokenStream=analyzer.tokenStream(AbstractOlatDocument.TITLE_FIELD_NAME,new StringReader(title));
    String highlightTitle=highlighter.getBestFragments(tokenStream,title,3,"String_Node_Str");
    resultDocument.setHighlightTitle(highlightTitle);
  }
 catch (  InvalidTokenOffsetsException e) {
    log.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Highlight (bold,color) query words in result-document. Set HighlightResult for content or description. 
 * @param query
 * @param analyzer
 * @param doc
 * @param resultDocument
 * @throws IOException
 */
private void doHighlight(Query query,Analyzer analyzer,Document doc,ResultDocument resultDocument) throws IOException {
  Highlighter highlighter=new Highlighter(new SimpleHTMLFormatter(HIGHLIGHT_PRE_TAG,HIGHLIGHT_POST_TAG),new SimpleHTMLEncoder(),new QueryScorer(query));
  try {
    String content=doc.get(AbstractOlatDocument.CONTENT_FIELD_NAME);
    TokenStream tokenStream=analyzer.tokenStream(AbstractOlatDocument.CONTENT_FIELD_NAME,new StringReader(content));
    String highlightResult=highlighter.getBestFragments(tokenStream,content,3,HIGHLIGHT_SEPARATOR);
    if (highlightResult.length() == 0) {
      String description=doc.get(AbstractOlatDocument.DESCRIPTION_FIELD_NAME);
      tokenStream=analyzer.tokenStream(AbstractOlatDocument.DESCRIPTION_FIELD_NAME,new StringReader(description));
      highlightResult=highlighter.getBestFragments(tokenStream,description,3,HIGHLIGHT_SEPARATOR);
      resultDocument.setHighlightingDescription(true);
    }
    resultDocument.setHighlightResult(highlightResult);
    String title=doc.get(AbstractOlatDocument.TITLE_FIELD_NAME);
    title=title.trim();
    if (title.length() > 128) {
      title=FilterFactory.getHtmlTagsFilter().filter(title);
      title=Formatter.truncate(title,128);
    }
    tokenStream=analyzer.tokenStream(AbstractOlatDocument.TITLE_FIELD_NAME,new StringReader(title));
    String highlightTitle=highlighter.getBestFragments(tokenStream,title,3,"String_Node_Str");
    resultDocument.setHighlightTitle(highlightTitle);
  }
 catch (  InvalidTokenOffsetsException e) {
    log.warn("String_Node_Str",e);
  }
}