Program: 11166
Project: 11166
Buggy source:
/** 
 * Executes an asynchronous query from a String and add the alias in the Result for Selects qith paging .
 * @param query         The query in a String.
 * @param aliasColumns  The Map with the alias
 * @param session       Cassandra datastax java driver session.
 * @param queryId       The id of the query.
 * @param resultHandler The handler of the result.
 * @param pageSize      The number of fetching paging.
 */
public static void asyncExecutePaging(String query,Map<Selector,String> aliasColumns,Session session,String queryId,IResultHandler resultHandler,int pageSize) throws ConnectorException {
  try {
    Statement st=new SimpleStatement(query);
    st.setFetchSize(pageSize);
    ResultSet resultSet=session.execute(st);
    int numPage=0;
    List<ColumnDefinitions.Definition> definitions=resultSet.getColumnDefinitions().asList();
    List<Row> rows=new ArrayList<>();
    int i=0;
    for (    Row row : resultSet) {
      if (i < pageSize) {
        rows.add(row);
        i++;
      }
 else {
        i=0;
        QueryResult queryResult=com.stratio.crossdata.common.result.QueryResult.createQueryResult(utils.transformPagingToMetaResultSet(definitions,rows,aliasColumns),numPage,false);
        queryResult.setQueryId(queryId);
        resultHandler.processResult(queryResult);
        numPage++;
        rows=new ArrayList<>();
        rows.add(row);
      }
    }
    numPage++;
    QueryResult queryResult=com.stratio.crossdata.common.result.QueryResult.createQueryResult(utils.transformPagingToMetaResultSet(definitions,rows,aliasColumns),numPage,true);
    queryResult.setQueryId(queryId);
    resultHandler.processResult(queryResult);
  }
 catch (  UnsupportedOperationException unSupportException) {
    resultHandler.processException(queryId,new ExecutionException(unSupportException.getMessage(),unSupportException));
  }
catch (  DriverException dex) {
    resultHandler.processException(queryId,new ExecutionException(dex.getMessage()));
  }
catch (  Exception ex) {
    resultHandler.processException(queryId,new ExecutionException(ex.getMessage(),ex));
  }
}

Fixed version (ground truth):
/** 
 * Executes an asynchronous query from a String and add the alias in the Result for Selects qith paging .
 * @param query         The query in a String.
 * @param aliasColumns  The Map with the alias
 * @param session       Cassandra datastax java driver session.
 * @param queryId       The id of the query.
 * @param resultHandler The handler of the result.
 * @param pageSize      The number of fetching paging.
 */
public static void asyncExecutePaging(String query,Map<Selector,String> aliasColumns,Session session,String queryId,IResultHandler resultHandler,int pageSize) throws ConnectorException {
  try {
    Statement st=new SimpleStatement(query);
    st.setFetchSize(pageSize);
    ResultSet resultSet=session.execute(st);
    int numPage=0;
    List<ColumnDefinitions.Definition> definitions=resultSet.getColumnDefinitions().asList();
    List<Row> rows=new ArrayList<>();
    int i=0;
    for (    Row row : resultSet) {
      if (i < pageSize) {
        rows.add(row);
        i++;
      }
 else {
        i=0;
        QueryResult queryResult=com.stratio.crossdata.common.result.QueryResult.createQueryResult(utils.transformPagingToMetaResultSet(definitions,rows,aliasColumns),numPage,false);
        queryResult.setQueryId(queryId);
        resultHandler.processResult(queryResult);
        numPage++;
        rows=new ArrayList<>();
        rows.add(row);
      }
    }
    QueryResult queryResult=com.stratio.crossdata.common.result.QueryResult.createQueryResult(utils.transformPagingToMetaResultSet(definitions,rows,aliasColumns),numPage,true);
    queryResult.setQueryId(queryId);
    resultHandler.processResult(queryResult);
  }
 catch (  UnsupportedOperationException unSupportException) {
    resultHandler.processException(queryId,new ExecutionException(unSupportException.getMessage(),unSupportException));
  }
catch (  DriverException dex) {
    resultHandler.processException(queryId,new ExecutionException(dex.getMessage()));
  }
catch (  Exception ex) {
    resultHandler.processException(queryId,new ExecutionException(ex.getMessage(),ex));
  }
}