diff options
author | Vitaly Takmazov | 2022-04-08 15:06:01 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-04-08 15:17:01 +0300 |
commit | 771a95b92bf589e8462b5cb9eb8e02bf7bf5bb63 (patch) | |
tree | 08c3fe4fc535fb2d1e3d6ee532a92f00b63884f6 /src/main/java/com | |
parent | a77884b98032bde77cb3667da03809b2b9858de6 (diff) |
XMPP: log invalid JIDs
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/juick/XMPPManager.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java index a7146352..6343378c 100644 --- a/src/main/java/com/juick/XMPPManager.java +++ b/src/main/java/com/juick/XMPPManager.java @@ -382,14 +382,19 @@ public class XMPPManager implements NotificationListener { public void processLike(User liker, com.juick.model.Message jmsg, List<User> users) { if (!userService.isInBLAny(jmsg.getUser().getUid(), liker.getUid())) { userService.getJIDsbyUID(jmsg.getUser().getUid()).forEach(authorJid -> { - Message xmppMessage = new Message(); - xmppMessage.setFrom(jid); - xmppMessage.setTo(Jid.of(authorJid)); - xmppMessage.setType(Message.Type.CHAT); - xmppMessage.addExtension(jmsg); - xmppMessage.setBody(String.format("%s recommended your post #%d. %s", - liker.getName(), jmsg.getMid(), PlainTextFormatter.formatUrl(jmsg))); - xmpp.send(ClientMessage.from(xmppMessage)); + try { + Jid toJid = Jid.of(authorJid); + Message xmppMessage = new Message(); + xmppMessage.setFrom(jid); + xmppMessage.setTo(toJid); + xmppMessage.setType(Message.Type.CHAT); + xmppMessage.addExtension(jmsg); + xmppMessage.setBody(String.format("%s recommended your post #%d. %s", + liker.getName(), jmsg.getMid(), PlainTextFormatter.formatUrl(jmsg))); + xmpp.send(ClientMessage.from(xmppMessage)); + } catch (IllegalArgumentException e) { + logger.warn("{}: {}", authorJid, e.getMessage()); + } }); } |