diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-05-02 20:39:16 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-05-02 20:39:16 +0200 |
commit | 41d726ef73a20e7e7ee1ff81c5f8326aa0e6c7d8 (patch) | |
tree | fc1b190df4275cc753bc869c7f137c0486ba2c91 /src/main/java/de/pixart/messenger/parser/IqParser.java | |
parent | 419504eaecd538561307d2b10ef08bdc3a47b137 (diff) |
return InvalidJid object instead of null if Jid can not be parsed
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/parser/IqParser.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/IqParser.java b/src/main/java/de/pixart/messenger/parser/IqParser.java index 8f8cf9ae4..04ce4afaa 100644 --- a/src/main/java/de/pixart/messenger/parser/IqParser.java +++ b/src/main/java/de/pixart/messenger/parser/IqParser.java @@ -29,6 +29,7 @@ import de.pixart.messenger.entities.Contact; import de.pixart.messenger.services.XmppConnectionService; import de.pixart.messenger.utils.Namespace; import de.pixart.messenger.xml.Element; +import de.pixart.messenger.xmpp.InvalidJid; import de.pixart.messenger.xmpp.OnIqPacketReceived; import de.pixart.messenger.xmpp.OnUpdateBlocklist; import de.pixart.messenger.xmpp.stanzas.IqPacket; @@ -47,7 +48,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { } for (final Element item : query.getChildren()) { if (item.getName().equals("item")) { - final Jid jid = item.getAttributeAsJid("jid"); + final Jid jid = InvalidJid.getNullForInvalid(item.getAttributeAsJid("jid")); if (jid == null) { continue; } @@ -310,7 +311,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { // Create a collection of Jids from the packet for (final Element item : items) { if (item.getName().equals("item")) { - final Jid jid = item.getAttributeAsJid("jid"); + final Jid jid = InvalidJid.getNullForInvalid(item.getAttributeAsJid("jid")); if (jid != null) { jids.add(jid); } @@ -344,7 +345,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { final Collection<Jid> jids = new ArrayList<>(items.size()); for (final Element item : items) { if (item.getName().equals("item")) { - final Jid jid = item.getAttributeAsJid("jid"); + final Jid jid = InvalidJid.getNullForInvalid(item.getAttributeAsJid("jid")); if (jid != null) { jids.add(jid); } |