From 366c921ed56ba02192e58f500aa773c50fa0f5bb Mon Sep 17 00:00:00 2001 From: Rob Greene Date: Sun, 9 Jan 2022 17:14:43 -0600 Subject: [PATCH] Fixing error message handling for the Import dialog. Also updated the TextBundle#get method to check for the key. If the key does not exist, return a string indicating was is missing to help track this down in the future. --- .../com/webcodepro/applecommander/util/TextBundle.java | 7 ++++++- .../com/webcodepro/applecommander/ui/UiBundle.properties | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/TextBundle.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/TextBundle.java index 101d00a..34d876f 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/TextBundle.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/util/TextBundle.java @@ -66,7 +66,12 @@ public class TextBundle { * Retrieve a value for the given resource name. */ public String get(String name) { - return resourceBundle.getString(name); + if (resourceBundle.containsKey(name)) { + return resourceBundle.getString(name); + } + else { + return String.format("KeyNotFound: %s", name); + } } /** diff --git a/lib/ac-api/src/main/resources/com/webcodepro/applecommander/ui/UiBundle.properties b/lib/ac-api/src/main/resources/com/webcodepro/applecommander/ui/UiBundle.properties index 37771ad..e0634b5 100644 --- a/lib/ac-api/src/main/resources/com/webcodepro/applecommander/ui/UiBundle.properties +++ b/lib/ac-api/src/main/resources/com/webcodepro/applecommander/ui/UiBundle.properties @@ -23,9 +23,9 @@ DeleteFileHoverText=Delete a file (CTRL+D) DeleteFileErrorTitle=Unable to view a deleted file! ResizeDiskTitle = Resize disk? ResizeDiskMessage = This disk needs to be resized to match the formatted capacity. This should be an ApplePC HDV disk image - they typically start at 0 bytes and grow to the maximum capacity (32MB). Resize the disk? -ImportFileTitle = Unable to import file(s)! ImportMenuItem=Import...\tCTRL+I -ImportFileMessage = An error occurred during import!\n\nException was "{0}". +ImportErrorTitle = Unable to import file(s)! +ImportErrorMessage = An error occurred during import!\n\nException was "{0}". FilesTab=Files ExpandMenuItem=Expand\t+ CollapseMenuItem=Collapse\t-