tri.close();
    public Community[] getCommunities() throws SQLException    {        List communities = new ArrayList();        // Get community table rows        TableRowIterator tri = DatabaseManager                .query(                        ourContext,                        "community",                        "SELECT community.* FROM community, community2item "                                + "WHERE community2item.community_id=community.community_id "                                + "AND community2item.item_id="                                + itemRow.getIntColumn("item_id"));        while (tri.hasNext())        {            TableRow row = tri.next();            // First check the cache            Community owner = (Community) ourContext.fromCache(Community.class,                    row.getIntColumn("community_id"));            if (owner == null)            {                owner = new Community(ourContext, row);            }            communities.add(owner);            // now add any parent communities            Community[] parents = owner.getAllParents();            for (int i = 0; i < parents.length; i++)            {                communities.add(parents[i]);            }        }        Community[] communityArray = new Community[communities.size()];        communityArray = (Community[]) communities.toArray(communityArray);        return communityArray;    }