Commit 5d0abf5b authored by Daryl Herzmann's avatar Daryl Herzmann Committed by akrherz

prevent NPE in LDAP Provider when username is not found, OF-540


git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13058 b35dd754-fafc-0310-a699-88a17e54d16e
parent f9b3b3e5
...@@ -143,6 +143,10 @@ public class IQvCardHandler extends IQHandler { ...@@ -143,6 +143,10 @@ public class IQvCardHandler extends IQHandler {
result.setChildElement(packet.getChildElement().createCopy()); result.setChildElement(packet.getChildElement().createCopy());
result.setError(PacketError.Condition.item_not_found); result.setError(PacketError.Condition.item_not_found);
} }
} else {
result = IQ.createResultIQ(packet);
result.setChildElement(packet.getChildElement().createCopy());
result.setError(PacketError.Condition.item_not_found);
} }
} }
else { else {
......
...@@ -261,6 +261,9 @@ public class LdapVCardProvider implements VCardProvider, PropertyEventListener { ...@@ -261,6 +261,9 @@ public class LdapVCardProvider implements VCardProvider, PropertyEventListener {
username = JID.unescapeNode(username); username = JID.unescapeNode(username);
Map<String, String> map = getLdapAttributes(username); Map<String, String> map = getLdapAttributes(username);
Log.debug("LdapVCardProvider: Retrieving LDAP mapped vcard for " + username); Log.debug("LdapVCardProvider: Retrieving LDAP mapped vcard for " + username);
if (map.isEmpty()) {
return null;
}
Element vcard = new VCard(template).getVCard(map); Element vcard = new VCard(template).getVCard(map);
if (mergeVCard == null) { if (mergeVCard == null) {
// No vcard passed in? Hrm. Fine, return LDAP vcard. // No vcard passed in? Hrm. Fine, return LDAP vcard.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment