From 0167af54b019469a542233863d08b9cc938608e5 Mon Sep 17 00:00:00 2001 From: delvh Date: Tue, 28 Jul 2020 08:53:10 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: CyB3RC0nN0R --- .../src/main/java/envoy/client/ui/listcell/MessageControl.java | 2 +- .../java/envoy/client/ui/settings/DownloadSettingsPane.java | 3 +-- common/src/main/java/envoy/data/Attachment.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/main/java/envoy/client/ui/listcell/MessageControl.java b/client/src/main/java/envoy/client/ui/listcell/MessageControl.java index 0c0d91b..eec8612 100644 --- a/client/src/main/java/envoy/client/ui/listcell/MessageControl.java +++ b/client/src/main/java/envoy/client/ui/listcell/MessageControl.java @@ -132,7 +132,7 @@ public class MessageControl extends Label { fileChooser.setInitialFileName(fileName); fileChooser.setInitialDirectory(downloadLocation); file = fileChooser.showSaveDialog(sceneContext.getStage()); - } else file = new File(downloadLocation + (downloadLocation.getName().endsWith("/") ? "" : "/") + fileName); + } else file = new File(downloadLocation, fileName); // A file was selected if (file != null) try (FileOutputStream fos = new FileOutputStream(file)) { diff --git a/client/src/main/java/envoy/client/ui/settings/DownloadSettingsPane.java b/client/src/main/java/envoy/client/ui/settings/DownloadSettingsPane.java index c97cdd4..bdc1352 100644 --- a/client/src/main/java/envoy/client/ui/settings/DownloadSettingsPane.java +++ b/client/src/main/java/envoy/client/ui/settings/DownloadSettingsPane.java @@ -23,7 +23,7 @@ import envoy.client.ui.SceneContext; public class DownloadSettingsPane extends SettingsPane { /** - * Constructs a new {@code DownloadSettingsPane} + * Constructs a new {@code DownloadSettingsPane}. * * @param sceneContext the {@code SceneContext} used to block input to the * {@link javafx.stage.Stage} used in Envoy @@ -62,5 +62,4 @@ public class DownloadSettingsPane extends SettingsPane { vbox.getChildren().add(hbox); getChildren().add(vbox); } - } diff --git a/common/src/main/java/envoy/data/Attachment.java b/common/src/main/java/envoy/data/Attachment.java index 67fca01..e231a76 100644 --- a/common/src/main/java/envoy/data/Attachment.java +++ b/common/src/main/java/envoy/data/Attachment.java @@ -68,8 +68,8 @@ public class Attachment implements Serializable { */ public Attachment(byte[] data, String name, AttachmentType type) { this.data = data; - this.type = type; this.name = name; + this.type = type; } /**