diff options
Diffstat (limited to 'src/main/java')
-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 a7146352d..6343378c3 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()); + } }); } |