tri.close();
    public void removeItem(Item item) throws SQLException, AuthorizeException,            IOException    {        // Check authorisation        AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);        log.info(LogManager.getHeader(ourContext, "remove_item",                "collection_id=" + getID() + ",item_id=" + item.getID()));        DatabaseManager.updateQuery(ourContext,                "DELETE FROM collection2item WHERE collection_id=" + getID()                        + " AND item_id=" + item.getID());        // Is the item an orphan?        TableRowIterator tri = DatabaseManager.query(ourContext,                "SELECT * FROM collection2item WHERE item_id=" + item.getID());        if (!tri.hasNext())        {            //make the right to remove the item explicit because the implicit            // relation            //has been removed. This only has to concern the currentUser            // because            //he started the removal process and he will end it too.            //also add right to remove from the item to remove it's bundles.            AuthorizeManager.addPolicy(ourContext, item, Constants.DELETE,                    ourContext.getCurrentUser());            AuthorizeManager.addPolicy(ourContext, item, Constants.REMOVE,                    ourContext.getCurrentUser());            // Orphan; delete it            item.delete();        }    }