tri.close();
    public static BitstreamFormat[] findAll(Context context)            throws SQLException    {        List formats = new ArrayList();        TableRowIterator tri = DatabaseManager                .query(context, "bitstreamformatregistry",                        "SELECT * FROM bitstreamformatregistry ORDER BY bitstream_format_id");        while (tri.hasNext())        {            TableRow row = tri.next();            // From cache?            BitstreamFormat fromCache = (BitstreamFormat) context.fromCache(                    BitstreamFormat.class, row                            .getIntColumn("bitstream_format_id"));            if (fromCache != null)            {                formats.add(fromCache);            }            else            {                formats.add(new BitstreamFormat(context, row));            }        }        // Return the formats as an array        BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()];        formatArray = (BitstreamFormat[]) formats.toArray(formatArray);        return formatArray;    }