From 40714870483677e7b6b597e38b6ce93c3596b0a2 Mon Sep 17 00:00:00 2001 From: delvh Date: Sun, 14 Jun 2020 16:03:02 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: CyB3RC0nN0R --- src/main/java/envoy/client/net/Receiver.java | 5 +++-- src/main/java/envoy/client/ui/Startup.java | 2 +- .../java/envoy/client/ui/controller/ChatScene.java | 12 ++++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/envoy/client/net/Receiver.java b/src/main/java/envoy/client/net/Receiver.java index 514e20a..55042d3 100644 --- a/src/main/java/envoy/client/net/Receiver.java +++ b/src/main/java/envoy/client/net/Receiver.java @@ -69,8 +69,9 @@ public class Receiver extends Thread { // Get appropriate processor @SuppressWarnings("rawtypes") final Consumer processor = processors.get(obj.getClass()); - if (processor == null) logger.log(Level.WARNING, - String.format("The received object has the class %s for which no processor is defined.", obj.getClass())); + if (processor == null) + logger.log(Level.WARNING, String.format( + "The received object has the class %s for which no processor is defined.", obj.getClass())); else processor.accept(obj); } } diff --git a/src/main/java/envoy/client/ui/Startup.java b/src/main/java/envoy/client/ui/Startup.java index 906f704..cc70ec2 100644 --- a/src/main/java/envoy/client/ui/Startup.java +++ b/src/main/java/envoy/client/ui/Startup.java @@ -65,7 +65,7 @@ public final class Startup extends Application { if (!config.isInitialized()) throw new EnvoyException("Configuration is not fully initialized"); } catch (final Exception e) { new Alert(AlertType.ERROR, "Error loading configuration values:\n" + e); - logger.log(Level.SEVERE, "Error loading configuration values", e); + logger.log(Level.SEVERE, "Error loading configuration values: ", e); e.printStackTrace(); System.exit(1); } diff --git a/src/main/java/envoy/client/ui/controller/ChatScene.java b/src/main/java/envoy/client/ui/controller/ChatScene.java index 08e1501..5f675f9 100644 --- a/src/main/java/envoy/client/ui/controller/ChatScene.java +++ b/src/main/java/envoy/client/ui/controller/ChatScene.java @@ -199,15 +199,15 @@ public final class ChatScene { /** * Checks the text length of the {@code messageTextArea}, adjusts the - * {@code remainingChars} - Label and checks whether to send the message + * {@code remainingChars} label and checks whether to send the message * automatically. * - * @param e the keys that have been entered + * @param e the key event that will be analyzed for a post request * @since Envoy Client v0.1-beta */ @FXML private void checkKeyCombination(KeyEvent e) { - // checks whether the text is too long + // Checks whether the text is too long messageTextUpdated(); // Automatic sending of messages via (ctrl +) enter checkPostConditions(e); @@ -219,8 +219,8 @@ public final class ChatScene { */ @FXML private void checkPostConditions(KeyEvent e) { - if (!postButton.isDisabled() && settings.isEnterToSend() && e.getCode() == KeyCode.ENTER - || !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown()) + if (!postButton.isDisabled() && (settings.isEnterToSend() && e.getCode() == KeyCode.ENTER + || !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown())) postMessage(); postButton.setDisable(messageTextArea.getText().isBlank() || currentChat == null); } @@ -242,7 +242,7 @@ public final class ChatScene { } /** - * Sets the text and text-color of the {@code remainingChars} - Label. + * Sets the text and text color of the {@code remainingChars} label. * * @since Envoy Client v0.1-beta */