Program: 145612
Project: 145612
Buggy source:
/** 
 * Reads data from ResultSet object and creates new Rowset based on the data. Warning! The rowset returned doesn't log it's changes.
 * @param aPageSize Page size of reading process. May be less then zero toindicate that whole data should be fetched.
 * @param aResultSet
 * @return New Rowset object created.
 * @throws SQLException
 * @throws InvalidColIndexException
 * @throws RowsetException
 */
public Rowset readRowset(ResultSet aResultSet,int aPageSize) throws SQLException {
  try {
    if (aResultSet != null) {
      ResultSetMetaData lowLevelJdbcFields=aResultSet.getMetaData();
      Fields jdbcFields=new Fields();
      for (int i=1; i <= lowLevelJdbcFields.getColumnCount(); i++) {
        Field field=new Field();
        field.setName(lowLevelJdbcFields.getColumnName(i));
        field.setDescription(lowLevelJdbcFields.getColumnLabel(i));
        field.setNullable(lowLevelJdbcFields.isNullable(i) == ResultSetMetaData.columnNullable);
        DataTypeInfo typeInfo=new DataTypeInfo();
        typeInfo.setSqlType(lowLevelJdbcFields.getColumnType(i));
        typeInfo.setSqlTypeName(lowLevelJdbcFields.getColumnTypeName(i));
        typeInfo.setJavaClassName(lowLevelJdbcFields.getColumnClassName(i));
        field.setTypeInfo(typeInfo);
        field.setSize(lowLevelJdbcFields.getColumnDisplaySize(i));
        field.setPrecision(lowLevelJdbcFields.getPrecision(i));
        field.setScale(lowLevelJdbcFields.getScale(i));
        field.setSigned(lowLevelJdbcFields.isSigned(i));
        field.setTableName(lowLevelJdbcFields.getTableName(i));
        field.setSchemaName(lowLevelJdbcFields.getSchemaName(i));
        jdbcFields.add(field);
      }
      Rowset rowset=new Rowset(expectedFields != null ? expectedFields : jdbcFields);
      List<Row> rows=readRows(rowset.getFields(),jdbcFields,aResultSet,aPageSize,converter);
      rowset.setCurrent(rows);
      rowset.currentToOriginal();
      return rowset;
    }
 else {
      throw new SQLException(ROWSET_MISSING_EXCEPTION_MSG);
    }
  }
 catch (  Exception ex) {
    if (ex instanceof SQLException) {
      throw (SQLException)ex;
    }
 else {
      throw new SQLException(ex);
    }
  }
}

Fixed version (ground truth):
/** 
 * Reads data from ResultSet object and creates new Rowset based on the data. Warning! The rowset returned doesn't log it's changes.
 * @param aPageSize Page size of reading process. May be less then zero toindicate that whole data should be fetched.
 * @param aResultSet
 * @return New Rowset object created.
 * @throws SQLException
 * @throws InvalidColIndexException
 * @throws RowsetException
 */
public Rowset readRowset(ResultSet aResultSet,int aPageSize) throws SQLException {
  try {
    if (aResultSet != null) {
      ResultSetMetaData lowLevelJdbcFields=aResultSet.getMetaData();
      Fields jdbcFields=new Fields();
      for (int i=1; i <= lowLevelJdbcFields.getColumnCount(); i++) {
        Field field=new Field();
        field.setName(lowLevelJdbcFields.getColumnName(i));
        field.setDescription(lowLevelJdbcFields.getColumnLabel(i));
        field.setNullable(lowLevelJdbcFields.isNullable(i) == ResultSetMetaData.columnNullable);
        DataTypeInfo typeInfo=new DataTypeInfo();
        typeInfo.setSqlType(lowLevelJdbcFields.getColumnType(i));
        typeInfo.setSqlTypeName(lowLevelJdbcFields.getColumnTypeName(i));
        typeInfo.setJavaClassName(lowLevelJdbcFields.getColumnClassName(i));
        field.setTypeInfo(typeInfo);
        field.setSize(lowLevelJdbcFields.getColumnDisplaySize(i));
        field.setPrecision(lowLevelJdbcFields.getPrecision(i));
        field.setScale(lowLevelJdbcFields.getScale(i));
        field.setSigned(lowLevelJdbcFields.isSigned(i));
        field.setTableName(lowLevelJdbcFields.getTableName(i));
        field.setSchemaName(lowLevelJdbcFields.getSchemaName(i));
        jdbcFields.add(field);
      }
      Rowset rowset=new Rowset(expectedFields != null && !expectedFields.isEmpty() ? expectedFields : jdbcFields);
      List<Row> rows=readRows(rowset.getFields(),jdbcFields,aResultSet,aPageSize,converter);
      rowset.setCurrent(rows);
      rowset.currentToOriginal();
      return rowset;
    }
 else {
      throw new SQLException(ROWSET_MISSING_EXCEPTION_MSG);
    }
  }
 catch (  Exception ex) {
    if (ex instanceof SQLException) {
      throw (SQLException)ex;
    }
 else {
      throw new SQLException(ex);
    }
  }
}