From 439e274c3735139925f89a0b959e1e8218ce3fd7 Mon Sep 17 00:00:00 2001 From: DieGurke <55625494+DieGurke@users.noreply.github.com> Date: Thu, 11 Jun 2020 13:55:38 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: CyB3RC0nN0R --- src/main/java/envoy/event/GroupMessageStatusChangeEvent.java | 3 ++- src/main/java/envoy/event/GroupResizeEvent.java | 4 ++-- src/main/java/envoy/event/HandshakeRejectionEvent.java | 4 ++-- src/main/java/envoy/util/EnvoyLog.java | 3 --- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/envoy/event/GroupMessageStatusChangeEvent.java b/src/main/java/envoy/event/GroupMessageStatusChangeEvent.java index 81f6a15..b02f980 100644 --- a/src/main/java/envoy/event/GroupMessageStatusChangeEvent.java +++ b/src/main/java/envoy/event/GroupMessageStatusChangeEvent.java @@ -41,5 +41,6 @@ public class GroupMessageStatusChangeEvent extends MessageStatusChangeEvent { public long getMemberID() { return memberID; } @Override - public String toString() { return String.format("GroupMessageStatusChangeEvent[meta=%s, memberID=%d]", super.toString(), memberID); } + public String toString() { return String.format("GroupMessageStatusChangeEvent[meta=%s,memberID=%d]", super.toString(), memberID); } + } diff --git a/src/main/java/envoy/event/GroupResizeEvent.java b/src/main/java/envoy/event/GroupResizeEvent.java index c750d7f..a0d8d40 100644 --- a/src/main/java/envoy/event/GroupResizeEvent.java +++ b/src/main/java/envoy/event/GroupResizeEvent.java @@ -37,10 +37,10 @@ public class GroupResizeEvent extends Event { public GroupResizeEvent(User user, Group group, ElementOperation operation) { super(user); if (group.getContacts().contains(user)) { - if (operation.equals(ElementOperation.ADD)) throw new IllegalStateException( + if (operation.equals(ElementOperation.ADD)) throw new IllegalArgumentException( "Cannot add " + user + " to group " + group.getID() + " because he is already a member of this group"); } else if (operation.equals(ElementOperation.REMOVE)) - throw new IllegalStateException("Cannot remove " + user + " from group " + group.getID() + " because he is no part of this group"); + throw new IllegalArgumentException("Cannot remove " + user + " from group " + group.getID() + " because he is no part of this group"); groupID = group.getID(); this.operation = operation; } diff --git a/src/main/java/envoy/event/HandshakeRejectionEvent.java b/src/main/java/envoy/event/HandshakeRejectionEvent.java index 697eeac..fea1058 100644 --- a/src/main/java/envoy/event/HandshakeRejectionEvent.java +++ b/src/main/java/envoy/event/HandshakeRejectionEvent.java @@ -16,12 +16,12 @@ public class HandshakeRejectionEvent extends Event { /** * Select this value if a given password hash or user was incorrect. */ - public static final String WRONG_PASSWORD_OR_USER = "password or user were entered incorrectly"; + public static final String WRONG_PASSWORD_OR_USER = "Incorrect user name or password."; /** * Select this value if the handshake could not be completed for some reason. */ - public static final String INTERNAL_ERROR = "the process could not be finished as an internal error occurred"; + public static final String INTERNAL_ERROR = "An internal error occured."; private static final long serialVersionUID = 0L; diff --git a/src/main/java/envoy/util/EnvoyLog.java b/src/main/java/envoy/util/EnvoyLog.java index a797d75..f3bc919 100644 --- a/src/main/java/envoy/util/EnvoyLog.java +++ b/src/main/java/envoy/util/EnvoyLog.java @@ -62,9 +62,6 @@ public class EnvoyLog { } consoleHandler = new StreamHandler(System.out, formatter) { - /** - * {@inheritDoc} - */ @Override public synchronized void publish(LogRecord record) { super.publish(record);