Prevent NPE in LdapVcardProvider.java

Please add

else {

result = IQ.createResultIQ(packet);
result.setChildElement(packet.getChildElement().createCopy());
result.setError(PacketError.Condition.item_not_found);
}

between lines 145 and 146 of IQvCardHandler.java.

With this, I get the expected “item not found” result when looking for a user that doesn’t exist. Without it, a NPE is thrown in LdapVcardProvider.java and a “internal server error” is returned.

I forgot the other part of the fix. Add

if (map.isEmpty()) {

return null;

}

between 263 and 264 of LdapVcardProvider.java.

Please supply patches as .patch files against the latest version of trunk.

How do I submit the patches?

Press Reply and then press the Use advanced editor link. There will be the Browse button for attachments.

The patches…
LdapVCardProvider.java.patch.zip (481 Bytes)
IQvCardHandler.java.patch.zip (419 Bytes)

Filed as OF-540