aboutsummaryrefslogtreecommitdiff
path: root/juick-server-xmpp/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-04 22:55:22 +0300
committerGravatar Vitaly Takmazov2018-04-04 22:55:22 +0300
commit26e8eb9f0f965bb51733b4a25734f0ebe658b9ed (patch)
tree056e1fd822e8bf0c717fce733df9adc997782bfe /juick-server-xmpp/src/main/java/com/juick
parent71c29cc99d1b3f71247b81bc42d30f8b52dad240 (diff)
more URI refactoring
Diffstat (limited to 'juick-server-xmpp/src/main/java/com/juick')
-rw-r--r--juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java b/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java
index 26dafa69..c94e70f3 100644
--- a/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java
+++ b/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java
@@ -40,6 +40,7 @@ import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
import rocks.xmpp.addr.Jid;
+import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.lang.reflect.InvocationTargetException;
@@ -84,7 +85,7 @@ public class CommandsManager {
}
- public Optional<CommandResult> processCommand(User user, Jid from, String input, URI attachment) throws InvocationTargetException,
+ public Optional<CommandResult> processCommand(User user, Jid from, String input, @Nonnull URI attachment) throws InvocationTargetException,
IllegalAccessException, NoSuchMethodException {
Optional<Method> cmd = MethodUtils.getMethodsListWithAnnotation(getClass(), UserCommand.class).stream()
.filter(m -> Pattern.compile(m.getAnnotation(UserCommand.class).pattern(),
@@ -452,7 +453,7 @@ public class CommandsManager {
}
@UserCommand(pattern = "^(#|\\.)(\\d+)((\\.|\\-|\\/)(\\d+))?\\s([\\s\\S]+)",
help = "#1234 *tag *tag2 - edit tags\n#1234 text - reply to message")
- public CommandResult EditOrReply(User user, Jid from, URI attachment, String... args) throws Exception {
+ public CommandResult EditOrReply(User user, Jid from, @Nonnull URI attachment, String... args) throws Exception {
int mid = NumberUtils.toInt(args[1]);
int rid = NumberUtils.toInt(args[4], 0);
String txt = args[5];
@@ -464,7 +465,7 @@ public class CommandsManager {
tagService.updateTags(mid, messageTags);
return CommandResult.fromString("Tags are updated");
} else {
- String attachmentType = attachment != null && StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null;
+ String attachmentType = StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null;
int newrid = messagesService.createReply(mid, rid, user.getUid(), txt, attachmentType);
if (StringUtils.isNotEmpty(attachmentType)) {
String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost()