Program: 69747
Project: 69747
Buggy source:
private ResultInfos<U> loadDatas(String query,List<String> addQueries,final boolean force,final int firstResult,final int maxResults,SortKey... orderBy){
  if (rows == null) {
    rows=new ArrayList<U>();
  }
  for (int i=rows.size(); i < firstResult; i++) {
    rows.add(null);
  }
  int correctedFirstResult=firstResult;
  int correctMaxResults=maxResults;
  if (!force && rows.size() > 0) {
    correctMaxResults=maxResults <= 0 ? rowCount : maxResults;
    int maxRowsResults=maxResults <= 0 ? rows.size() : maxResults;
    for (int i=firstResult; i < maxRowsResults && i < rows.size(); i++) {
      if (rows.get(i) == null) {
        break;
      }
 else {
        correctedFirstResult++;
        correctMaxResults--;
      }
    }
    if (correctMaxResults == 0) {
      return new DefaultResultInfos<U>(rowCount,rowCount,rows);
    }
  }
  ResultInfos<U> newRows=sourceDelegate.getRows(query,addQueries,correctedFirstResult,correctMaxResults,orderBy);
  if (firstResult == 0) {
    if (newRows.getObjects().size() < correctMaxResults) {
      rowCount=newRows.getObjects().size();
    }
 else {
      rowCount=sourceDelegate.getRowCount();
    }
  }
 else   if (newRows.getCorrectedRowCount() >= 0) {
    rowCount=newRows.getCorrectedRowCount();
  }
  for (int i=0; i < newRows.getObjects().size(); i++) {
    int rowIndex=i + firstResult;
    if (rowIndex < rows.size()) {
      rows.set(rowIndex,newRows.getObjects().get(i));
    }
 else {
      rows.add(newRows.getObjects().get(i));
    }
  }
  return new DefaultResultInfos<U>(newRows.getNextFirstResult(),newRows.getCorrectedRowCount(),rows);
}

Fixed version (ground truth):
private ResultInfos<U> loadDatas(String query,List<String> addQueries,final boolean force,final int firstResult,final int maxResults,SortKey... orderBy){
  if (rows == null) {
    rows=new ArrayList<U>();
  }
  for (int i=rows.size(); i < firstResult; i++) {
    rows.add(null);
  }
  int correctedFirstResult=firstResult;
  int correctMaxResults=maxResults;
  if (!force && rows.size() > 0) {
    correctMaxResults=maxResults <= 0 ? rowCount : maxResults;
    int maxRowsResults=maxResults <= 0 ? rows.size() : maxResults;
    for (int i=firstResult; i < maxRowsResults && i < rows.size(); i++) {
      if (rows.get(i) == null) {
        break;
      }
 else {
        correctedFirstResult++;
        correctMaxResults--;
      }
    }
    if (correctMaxResults == 0) {
      return new DefaultResultInfos<U>(rowCount,rowCount,rows);
    }
  }
  ResultInfos<U> newRows=sourceDelegate.getRows(query,addQueries,correctedFirstResult,correctMaxResults,orderBy);
  if (firstResult == 0) {
    if (newRows.getObjects().size() < correctMaxResults) {
      rowCount=newRows.getObjects().size();
    }
 else     if (newRows.getCorrectedRowCount() >= 0) {
      rowCount=newRows.getCorrectedRowCount();
    }
 else {
      rowCount=sourceDelegate.getRowCount();
    }
  }
 else   if (newRows.getCorrectedRowCount() >= 0) {
    rowCount=newRows.getCorrectedRowCount();
  }
  for (int i=0; i < newRows.getObjects().size(); i++) {
    int rowIndex=i + firstResult;
    if (rowIndex < rows.size()) {
      rows.set(rowIndex,newRows.getObjects().get(i));
    }
 else {
      rows.add(newRows.getObjects().get(i));
    }
  }
  return new DefaultResultInfos<U>(newRows.getNextFirstResult(),newRows.getCorrectedRowCount(),rows);
}