It was the intent in the other version, returning an array contructed directly from the temporary list. Now this list itself should be returned, not erased!
Thanks for finding this bug (now corrected;-).
Alain.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am wondering about the decodeResultSetAsList method in this template. The version I am working with contains the following:
Is this code not clearing v if it is not null in all cases? (in the finally block)
//28
public List<$beanClass> decodeResultSetAsList(ResultSet rs, int[] fieldList, int startRow, int numRows) throws DAOException
{
List<$beanClass> v = new ArrayList<$beanClass>();
int count = 0;
try
{
if (rs.absolute(startRow) && numRows!=0)
{
do
{
if(fieldList == null)
v.add(decodeRow(rs));
else
v.add(decodeRow(rs, fieldList));
count++;
} while ( (count<numRows||numRows<0) && rs.next() );
}
return v;
}
catch(SQLException e)
{
throw new DataAccessException(e);
}
finally
{
if (v != null) { v.clear(); v = null;}
}
}
It was the intent in the other version, returning an array contructed directly from the temporary list. Now this list itself should be returned, not erased!
Thanks for finding this bug (now corrected;-).
Alain.
Thank you Alain.