diff options
Diffstat (limited to 'src/main/java/com/juick/server/XMPPConnection.java')
-rw-r--r-- | src/main/java/com/juick/server/XMPPConnection.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/com/juick/server/XMPPConnection.java b/src/main/java/com/juick/server/XMPPConnection.java index 5ea105af..0adc7796 100644 --- a/src/main/java/com/juick/server/XMPPConnection.java +++ b/src/main/java/com/juick/server/XMPPConnection.java @@ -288,7 +288,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { for (User user : users) { jids.addAll(userService.getJIDsbyUID(user.getUid())); } - com.juick.Message fullMsg = messagesService.getMessage(jmsg.getMid()); + com.juick.Message fullMsg = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new); String txt = "@" + jmsg.getUser().getName() + ":" + MessageUtils.getTagsString(fullMsg) + "\n"; String attachmentUrl = MessageUtils.attachmentUrl(fullMsg); if (StringUtils.isNotEmpty(attachmentUrl)) { @@ -325,7 +325,7 @@ public class XMPPConnection implements StanzaListener, NotificationListener { String replyTo; com.juick.Message replyMessage = jmsg.getReplyto() > 0 ? messagesService.getReply(jmsg.getMid(), jmsg.getReplyto()) - : messagesService.getMessage(jmsg.getMid()); + : messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new); replyTo = replyMessage.getUser().getName(); com.juick.Message fullReply = messagesService.getReply(jmsg.getMid(), jmsg.getRid()); replyQuote = StringUtils.defaultString(fullReply.getReplyQuote()); @@ -594,13 +594,14 @@ public class XMPPConnection implements StanzaListener, NotificationListener { if (jmsg != null) { if (MessageUtils.isReply(jmsg)) { // to get quote and attachment - com.juick.Message original = messagesService.getMessage(jmsg.getMid()); + com.juick.Message original = messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new); com.juick.Message reply = messagesService.getReply(jmsg.getMid(), jmsg.getRid()); applicationEventPublisher.publishEvent(new MessageEvent(this, reply, subscriptionService.getUsersSubscribedToComments(original, reply))); } else if (!MessageUtils.isPM(jmsg)) { applicationEventPublisher.publishEvent(new MessageEvent(this, - messagesService.getMessage(jmsg.getMid()), subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg))); + messagesService.getMessage(jmsg.getMid()).orElseThrow(IllegalStateException::new), + subscriptionService.getSubscribedUsers(jmsg.getUser().getUid(), jmsg))); } } else { URI attachment = URI.create(StringUtils.EMPTY); |