@Override
    public Element loadVCard(String username) {
        LOG.debug("loadvcard {}", username);

        if (MUTEX.containsKey(username)) {
            // preventing looping
            return null;
        }

        try {
            MUTEX.put(username, username);
            
            Element vcard = super.loadVCard(username);
            
            if (vcard == null) {
                CrowdUserProvider userProvider = (CrowdUserProvider) UserManager.getUserProvider();
                try {
                    User user = userProvider.getCrowdUser(username);
                    String str = VCARD_TEMPLATE.replace("@displayname@", user.displayName)
                            .replace("@lastname@", user.lastName)
                            .replace("@firstname@", user.firstName)
                            .replace("@email@", user.email)
                            .replace("@nickname@", username);
                    vcard = SAXReaderUtil.readRootElement(str);
                } catch (UserNotFoundException unfe) {
                    LOG.error("Unable to find user '{}' for loading its vcard", username, unfe);
                    return null;
                } catch (ExecutionException e) {
                    LOG.error("VCard parsing error", e);
                    return null;
                } catch (InterruptedException e) {
                    LOG.error("VCard parsing interrupted", e);
                    Thread.currentThread().interrupt();
                    return null;
                }

                LOG.debug(vcard != null ? vcard.asXML() : "vcard is null");

                
                // store this new vcard
                if (vcard != null) {
                    try {
                        createVCard(username, vcard);
                    } catch (AlreadyExistsException aee) {
                        LOG.error("Unable to create and store a new vcard for user:" + username + "; one already exists", aee);
                    }
                }
            }
            
            return vcard;

        } catch (RuntimeException re) {
            LOG.error("Failure occurred when loading a vcard for user:" + username, re);
            throw re;
        } finally {
            MUTEX.remove(username);
        }
    }
@see org.jivesoftware.openfire.vcard.DefaultVCardProvider#loadVCard(java.lang.String)
xmppserver/src/main/java/org/jivesoftware/openfire/crowd/CrowdVCardProvider.java