tri.close();
    public void removeSubcommunity(Community c) throws SQLException,            AuthorizeException, IOException    {        // Check authorisation        AuthorizeManager.authorizeAction(ourContext, this, Constants.REMOVE);        log.info(LogManager.getHeader(ourContext, "remove_subcommunity",                "parent_comm_id=" + getID() + ",child_comm_id=" + c.getID()));        // Remove any mappings        DatabaseManager.updateQuery(ourContext,                "DELETE FROM community2community WHERE parent_comm_id="                        + getID() + " AND child_comm_id=" + c.getID());        // Is the subcommunity an orphan?        TableRowIterator tri = DatabaseManager.query(ourContext,                "SELECT * FROM community2community WHERE child_comm_id="                        + c.getID());        if (!tri.hasNext())        {            //make the right to remove the sub 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 subcommunity to remove it's            // children.            AuthorizeManager.addPolicy(ourContext, c, Constants.DELETE,                    ourContext.getCurrentUser());            AuthorizeManager.addPolicy(ourContext, c, Constants.REMOVE,                    ourContext.getCurrentUser());            // Orphan; delete it            c.delete();        }    }