aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/CommandsManager.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-10-02 17:53:34 +0300
committerGravatar Vitaly Takmazov2020-10-02 17:53:34 +0300
commita62c1fda358f54bd3e7de9aea94ce63e89e06142 (patch)
treed6f4734e5150f849ae782ea35812bed139f5d029 /src/main/java/com/juick/CommandsManager.java
parent4eab4c56d571cbd318391c26ccb5b02aa68029e1 (diff)
Apply fixes from some IDEA code inspections
Diffstat (limited to 'src/main/java/com/juick/CommandsManager.java')
-rw-r--r--src/main/java/com/juick/CommandsManager.java16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/juick/CommandsManager.java b/src/main/java/com/juick/CommandsManager.java
index f7c37b8b..66a45f9d 100644
--- a/src/main/java/com/juick/CommandsManager.java
+++ b/src/main/java/com/juick/CommandsManager.java
@@ -106,7 +106,7 @@ public class CommandsManager {
}
}
CommandResult commandResult = (CommandResult) getClass().getMethod(cmd.get().getName(), User.class, URI.class, String[].class)
- .invoke(this, user, attachment, groups.toArray(new String[groups.size()]));
+ .invoke(this, user, attachment, groups.toArray(new String[0]));
if (StringUtils.isNotEmpty(commandResult.getText())) {
return commandResult;
}
@@ -196,26 +196,26 @@ public class CommandsManager {
List<User> blusers = userService.getUserBLUsers(user_from.getUid());
List<String> bltags = tagService.getUserBLTags(user_from.getUid());
- String txt = StringUtils.EMPTY;
+ StringBuilder txt = new StringBuilder(StringUtils.EMPTY);
if (bltags.size() > 0) {
for (String bltag : bltags) {
- txt += "*" + bltag + "\n";
+ txt.append("*").append(bltag).append("\n");
}
if (blusers.size() > 0) {
- txt += "\n";
+ txt.append("\n");
}
}
if (blusers.size() > 0) {
for (User bluser : blusers) {
- txt += "@" + bluser.getName() + "\n";
+ txt.append("@").append(bluser.getName()).append("\n");
}
}
- if (txt.isEmpty()) {
- txt = "You don't have any users or tags in your blacklist.";
+ if (txt.length() == 0) {
+ txt = new StringBuilder("You don't have any users or tags in your blacklist.");
}
- return CommandResult.fromString(txt);
+ return CommandResult.fromString(txt.toString());
}
@UserCommand(pattern = "^#\\+$", help = "#+ - Show last Juick messages")