aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-04-08 15:06:01 +0300
committerGravatar Vitaly Takmazov2022-04-08 15:17:01 +0300
commit771a95b92bf589e8462b5cb9eb8e02bf7bf5bb63 (patch)
tree08c3fe4fc535fb2d1e3d6ee532a92f00b63884f6 /src
parenta77884b98032bde77cb3667da03809b2b9858de6 (diff)
XMPP: log invalid JIDs
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/juick/XMPPManager.java21
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());
+ }
});
}