@Override
    public void setName(String oldName, String newName) throws GroupAlreadyExistsException, GroupNameInvalidException, GroupNotFoundException {
        super.setName(oldName, newName);

        if(newName.trim().isEmpty()){
            throw new GroupNameInvalidException("Group name cannot be empty");
        }

        try {
            this.getGroup(oldName);
        } catch (GroupNotFoundException e) {
            throw new GroupNotFoundException("A group with this name cannot be found");
        }

        try {
            this.getGroup(newName);
            throw new GroupAlreadyExistsException("A group with the same name already exists");
        } catch (GroupNotFoundException e) {
            //Expected, do nothing
        }

        Connection con = null;
        PreparedStatement pstmt = null;
        boolean abortTransaction = false;
        try {
            con = DbConnectionManager.getTransactionConnection();
            pstmt = con.prepareStatement(SET_GROUP_NAME_1);
            pstmt.setString(1, newName);
            pstmt.setString(2, oldName);
            pstmt.executeUpdate();
            DbConnectionManager.fastcloseStmt(pstmt);
            
            pstmt = con.prepareStatement(SET_GROUP_NAME_2);
            pstmt.setString(1, newName);
            pstmt.setString(2, oldName);
            pstmt.executeUpdate();
            DbConnectionManager.fastcloseStmt(pstmt);
            
            pstmt = con.prepareStatement(SET_GROUP_NAME_3);
            pstmt.setString(1, newName);
            pstmt.setString(2, oldName);
            pstmt.executeUpdate();
        }
        catch (SQLException e) {
            Log.error(e.getMessage(), e);
            abortTransaction = true;
        }
        finally {
            DbConnectionManager.closeStatement(pstmt);
            DbConnectionManager.closeTransactionConnection(con, abortTransaction);
        }
    }
Database implementation of the GroupManager interface.

@author Matt Tucker
xmppserver/src/main/java/org/jivesoftware/openfire/group/DefaultGroupProvider.java