@Override
    public Element loadVCard(String username) {
        final JID mutex;
        if (username.contains("@")) {
            // OF-2320: VCards are used for MUC rooms, to store their avatar. For this usecase, the 'username' is actually a (bare) JID value representing the room.
            mutex = new JID(username);
        } else {
            mutex = XMPPServer.getInstance().createJID(username, null);
        }
        synchronized (userBaseMutex.intern(mutex)) {
            Connection con = null;
            PreparedStatement pstmt = null;
            ResultSet rs = null;
            Element vCardElement = null;
            try {
                con = DbConnectionManager.getConnection();
                pstmt = con.prepareStatement(LOAD_PROPERTIES);
                pstmt.setString(1, username);
                rs = pstmt.executeQuery();
                while (rs.next()) {
                    vCardElement = SAXReaderUtil.readRootElement(rs.getString(1));
                }
            }
            catch (Exception e) {
                Log.error("Error loading vCard of username: " + username, e);
                if (e instanceof InterruptedException) {
                    Thread.currentThread().interrupt();
                }
            }
            finally {
                DbConnectionManager.closeConnection(rs, pstmt, con);
            }

            if ( JiveGlobals.getBooleanProperty( PhotoResizer.PROPERTY_RESIZE_ON_LOAD, PhotoResizer.PROPERTY_RESIZE_ON_LOAD_DEFAULT ) )
            {
                PhotoResizer.resizeAvatar( vCardElement );
            }

            return vCardElement;
        }
    }
Default implementation of the VCardProvider interface, which reads and writes data
from the {@code ofVCard} database table.

@author Gaston Dombiak
xmppserver/src/main/java/org/jivesoftware/openfire/vcard/DefaultVCardProvider.java