powered by Jive Software

LdapVCardProvider still calls getVCard when user doesn't exist

I see this once in a while:

2013.04.06 09:46:40 org.jivesoftware.openfire.ldap.LdapVCardProvider - Username whatever not found

org.jivesoftware.openfire.user.UserNotFoundException: Username whatever not found

at org.jivesoftware.openfire.ldap.LdapManager.findUserDN(LdapManager.java:965)

at org.jivesoftware.openfire.ldap.LdapManager.findUserDN(LdapManager.java:891)

at org.jivesoftware.openfire.ldap.LdapVCardProvider.getLdapAttributes(LdapVCardPro vider.java:179)

at org.jivesoftware.openfire.ldap.LdapVCardProvider.loadVCard(LdapVCardProvider.ja va:232)

at org.jivesoftware.openfire.vcard.VCardManager.getOrLoadVCard(VCardManager.java:2 39)

at org.jivesoftware.openfire.vcard.VCardManager.getVCard(VCardManager.java:232)

at org.jivesoftware.openfire.handler.IQvCardHandler.handleIQ(IQvCardHandler.java:1 20)

2013.04.06 09:46:40 org.jivesoftware.openfire.handler.IQHandler - Internal server error

java.lang.NullPointerException

at java.util.regex.Matcher.quoteReplacement(Matcher.java:615)

at org.jivesoftware.openfire.ldap.LdapVCardProvider$VCard.treeWalk(LdapVCardProvid er.java:543)

at org.jivesoftware.openfire.ldap.LdapVCardProvider$VCard.treeWalk(LdapVCardProvid er.java:547)

at org.jivesoftware.openfire.ldap.LdapVCardProvider$VCard.getVCard(LdapVCardProvid er.java:524)

at org.jivesoftware.openfire.ldap.LdapVCardProvider.loadVCard(LdapVCardProvider.ja va:234)

at org.jivesoftware.openfire.vcard.VCardManager.getOrLoadVCard(VCardManager.java:2 39)

at org.jivesoftware.openfire.vcard.VCardManager.getVCard(VCardManager.java:232)

at org.jivesoftware.openfire.handler.IQvCardHandler.handleIQ(IQvCardHandler.java:1 20)

Looking at LdapVCardProvider.java, it does this:

// Un-escape username.

username = JID.unescapeNode(username);

Map<String, String> map = getLdapAttributes(username);

Log.debug("LdapVCardProvider: Getting mapped vcard for " + username);

Element vcard = new VCard(template).getVCard(map);

Maybe if map is null (is it null if user doesn’t exist?), loadVCard should be returning null before it calls getVCard?