From 19b59bb47e7da3cca737dd3044ce01254b4598ad Mon Sep 17 00:00:00 2001 From: Brandon Date: Tue, 27 Oct 2026 13:16:57 -0700 Subject: [PATCH] report only the error when the startup preset cannot be read --- .../model/DeviceManager.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/micromanager/lightsheetmanager/model/DeviceManager.java b/src/main/java/org/micromanager/lightsheetmanager/model/DeviceManager.java index d5a66074..9a8c1d4f 100644 --- a/src/main/java/org/micromanager/lightsheetmanager/model/DeviceManager.java +++ b/src/main/java/org/micromanager/lightsheetmanager/model/DeviceManager.java @@ -548,8 +548,17 @@ public void createConfigGroup() { } } - ArrayList updatedProperties = updateConfig(groupName, configName); + // read the preset to compare against + final Configuration config; + try { + config = core_.getConfigData(groupName, configName); + } catch (Exception e) { + studio_.logs().showError("could not get the configuration data of " + groupName + "::" + + configName + ": " + e.getMessage()); + return; // early exit + } + ArrayList updatedProperties = updateConfig(groupName, configName, config); if (updatedProperties.isEmpty()) { studio_.logs().showMessage("All device adapter properties are present in the " + groupName + "::" + configName + " configuration group."); @@ -569,22 +578,15 @@ public void createConfigGroup() { * * @param groupName the group name to check * @param configName the configuration preset to check + * @param config the current data of the configuration preset * @return an ArrayList of new properties */ - private ArrayList updateConfig(final String groupName, final String configName) { + private ArrayList updateConfig(final String groupName, final String configName, + final Configuration config) { ArrayList newProperties = new ArrayList<>(); final String[] props = adapter().getDevicePropertyNames(); final String[] properties = adapter().getEditableProperties(props); - Configuration config; - try { - config = core_.getConfigData(groupName, configName); - } catch (Exception e) { - studio_.logs().showError("could not get the configuration data of " + groupName + "::" - + configName + ": " + e.getMessage()); - return newProperties; // early exit => could not get config data to compare - } - for (String propertyName : properties) { if (!config.isPropertyIncluded(deviceAdapterName_, propertyName)) { try {