From 126dce265f2ec678f40a5d4fe54bcfd234fcc8ec Mon Sep 17 00:00:00 2001 From: Percy Baker Date: Mon, 19 Oct 2026 14:12:13 +0100 Subject: [PATCH 1/3] Start and log error (rather than refusing to start) if -settings flag points to nonexistent file --- .../src/main/java/org/phoebus/product/Launcher.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java index 05b9bd88e1..58d145d1c2 100644 --- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java +++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java @@ -140,10 +140,15 @@ public static void main(final String[] original_args) throws Exception { iter.remove(); logger.info("Loading settings from " + location); - if (location.endsWith(".xml")) - Preferences.importPreferences(new FileInputStream(location)); - else - PropertyPreferenceLoader.load(location); + try { + if (location.endsWith(".xml")) + Preferences.importPreferences(new FileInputStream(location)); + else + PropertyPreferenceLoader.load(location); + } catch (Exception e) { + logger.severe("Failed to load settings from " + location); + e.printStackTrace(); + } } else if (cmd.equals("-export_settings")) { if (!iter.hasNext()) From 410a82b246adb6ec7f4b437fac94a0cd66b50024 Mon Sep 17 00:00:00 2001 From: Percy Baker Date: Mon, 26 Oct 2026 09:38:51 +0000 Subject: [PATCH 2/3] Add -force_start --- .../src/main/java/org/phoebus/product/Launcher.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java index 58d145d1c2..58716cc678 100644 --- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java +++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java @@ -109,6 +109,7 @@ public static void main(final String[] original_args) throws Exception { // Handle arguments, potentially not even starting the UI final Iterator iter = args.iterator(); int port = -1; + boolean forceStart = false; try { while (iter.hasNext()) { final String cmd = iter.next(); @@ -132,6 +133,9 @@ public static void main(final String[] original_args) throws Exception { final String filename = iter.next(); iter.remove(); LogManager.getLogManager().readConfiguration(new FileInputStream(filename)); + } else if (cmd.equals("-force_start")) { + iter.remove(); + forceStart = true; } else if (cmd.equals("-settings")) { if (!iter.hasNext()) throw new Exception("Missing -settings file name"); @@ -146,8 +150,12 @@ public static void main(final String[] original_args) throws Exception { else PropertyPreferenceLoader.load(location); } catch (Exception e) { - logger.severe("Failed to load settings from " + location); - e.printStackTrace(); + if (forceStart) { + logger.severe("Failed to load settings from " + location); + e.printStackTrace(); + } else { + throw e; + } } } else if (cmd.equals("-export_settings")) { @@ -242,6 +250,7 @@ private static void help() { System.out.println("-nosplash - Suppress the splash screen"); System.out.println("-launch_error_dialog - Shows dialog if launch fails. Must be first program argument."); System.out.println("-settings settings.xml - Import settings from file, either exported XML or property file format"); + System.out.println("-force_start - Start even if the -settings file does not exist. Must be set before -settings."); System.out.println("-export_settings settings.xml - Export settings to file"); System.out.println("-logging logging.properties - Load log settings"); System.out.println("-list - List available application features"); From ae0b2363412afd55cb9d91887ad51ebb299790bf Mon Sep 17 00:00:00 2001 From: Percy Baker Date: Mon, 26 Oct 2026 09:44:16 +0000 Subject: [PATCH 3/3] Use logger instead of printStackTrace --- core/launcher/src/main/java/org/phoebus/product/Launcher.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/launcher/src/main/java/org/phoebus/product/Launcher.java b/core/launcher/src/main/java/org/phoebus/product/Launcher.java index 58716cc678..e1eaef8455 100644 --- a/core/launcher/src/main/java/org/phoebus/product/Launcher.java +++ b/core/launcher/src/main/java/org/phoebus/product/Launcher.java @@ -151,8 +151,7 @@ public static void main(final String[] original_args) throws Exception { PropertyPreferenceLoader.load(location); } catch (Exception e) { if (forceStart) { - logger.severe("Failed to load settings from " + location); - e.printStackTrace(); + logger.log(Level.SEVERE, "Failed to load settings from " + location, e); } else { throw e; }