Program: 33932
Project: 33932
Buggy source:
private ScoredResult.Builder handleDocResult(IndexSearcher is,SortRequest sortRequest,boolean sorting,ScoreDoc[] results,int i) throws IOException {
  int docId=results[i].doc;
  Document d=is.doc(docId,fetchSet);
  ScoredResult.Builder srBuilder=ScoredResult.newBuilder();
  srBuilder.setScore(results[i].score);
  srBuilder.setUniqueId(d.get(indexConfig.getUniqueIdField()));
  IndexableField f=d.getField(LumongoConstants.TIMESTAMP_FIELD);
  srBuilder.setTimestamp(f.numericValue().longValue());
  srBuilder.setDocId(docId);
  srBuilder.setSegment(segmentNumber);
  srBuilder.setIndexName(indexName);
  srBuilder.setResultIndex(i);
  if (sorting) {
    FieldDoc result=(FieldDoc)results[i];
    int c=0;
    for (    Object o : result.fields) {
      FieldSort fieldSort=sortRequest.getFieldSort(c);
      String sortField=fieldSort.getSortField();
      Lumongo.SortAs.SortType sortType=indexConfig.getSortType(sortField);
      if (IndexConfig.isNumericOrDateSortType(sortType)) {
        if (IndexConfig.isNumericIntSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortInteger(0);
          }
 else {
            srBuilder.addSortInteger((Integer)o);
          }
        }
 else         if (IndexConfig.isNumericLongSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortLong(0L);
          }
 else {
            srBuilder.addSortLong((Long)o);
          }
        }
 else         if (IndexConfig.isNumericFloatSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortFloat(0f);
          }
 else {
            srBuilder.addSortFloat((Float)o);
          }
        }
 else         if (IndexConfig.isNumericDoubleSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortDouble(0);
          }
 else {
            srBuilder.addSortDouble((Double)o);
          }
        }
 else         if (IndexConfig.isNumericDateSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortDate(0L);
          }
 else {
            srBuilder.addSortDate(((Date)o).getTime());
          }
        }
      }
 else {
        if (o == null) {
          srBuilder.addSortTerm("String_Node_Str");
        }
 else {
          BytesRef b=(BytesRef)o;
          srBuilder.addSortTerm(b.utf8ToString());
        }
      }
      c++;
    }
  }
  return srBuilder;
}

Fixed version (ground truth):
private ScoredResult.Builder handleDocResult(IndexSearcher is,SortRequest sortRequest,boolean sorting,ScoreDoc[] results,int i) throws IOException {
  int docId=results[i].doc;
  Document d=is.doc(docId,fetchSet);
  ScoredResult.Builder srBuilder=ScoredResult.newBuilder();
  srBuilder.setScore(results[i].score);
  srBuilder.setUniqueId(d.get(indexConfig.getUniqueIdField()));
  IndexableField f=d.getField(LumongoConstants.TIMESTAMP_FIELD);
  srBuilder.setTimestamp(f.numericValue().longValue());
  srBuilder.setDocId(docId);
  srBuilder.setSegment(segmentNumber);
  srBuilder.setIndexName(indexName);
  srBuilder.setResultIndex(i);
  if (sorting) {
    FieldDoc result=(FieldDoc)results[i];
    int c=0;
    for (    Object o : result.fields) {
      FieldSort fieldSort=sortRequest.getFieldSort(c);
      String sortField=fieldSort.getSortField();
      Lumongo.SortAs.SortType sortType=indexConfig.getSortType(sortField);
      if (IndexConfig.isNumericOrDateSortType(sortType)) {
        if (IndexConfig.isNumericIntSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortInteger(0);
          }
 else {
            srBuilder.addSortInteger((Integer)o);
          }
        }
 else         if (IndexConfig.isNumericLongSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortLong(0L);
          }
 else {
            srBuilder.addSortLong((Long)o);
          }
        }
 else         if (IndexConfig.isNumericFloatSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortFloat(0f);
          }
 else {
            srBuilder.addSortFloat((Float)o);
          }
        }
 else         if (IndexConfig.isNumericDoubleSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortDouble(0);
          }
 else {
            srBuilder.addSortDouble((Double)o);
          }
        }
 else         if (IndexConfig.isNumericDateSortType(sortType)) {
          if (o == null) {
            srBuilder.addSortDate(0L);
          }
 else {
            srBuilder.addSortDate(((Long)o));
          }
        }
      }
 else {
        if (o == null) {
          srBuilder.addSortTerm("String_Node_Str");
        }
 else {
          BytesRef b=(BytesRef)o;
          srBuilder.addSortTerm(b.utf8ToString());
        }
      }
      c++;
    }
  }
  return srBuilder;
}