* @throws DataAccessObjectException
*/
public static int calculateTotalRows(DataReader dataReader) throws DataAccessObjectException {
try {
//visit the rows
DAOSizeVisitor visitor = new DAOSizeVisitor();
for (Row row = dataReader.readRow(); isValidRow(row); row = dataReader.readRow()) {
visitor.visit(row);
}
return visitor.getNumberOfRows();
} catch (DataAccessObjectException daoe) {
logger.error(Messages.getString("RowUtil.error"), daoe); //$NON-NLS-1$
throw daoe;
} finally {
// since we've read all the rows, reopen the reader to reset the input