Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ protected void loadValidatedSettingsFrom(final NodeSettingsRO settings)
if (iErrorCounter == arrDeprecatedKeys.length - 1) {
LOGGER.debug("Deprecated keys did not work either. - Giving up.");

if (bIgnoreNonExistingSetting) {
if (bIgnoreNonExistingSetting && isNonExistingSettingException(excOrig)) {
LOGGER.warn("The new setting '" + newKey + "' was not known when the node" +
(nodeName == null ? "" : " '" + nodeName + "'") + " was saved. " +
"Please save the workflow again to include it for the future.");
Expand All @@ -1465,7 +1465,7 @@ protected void loadValidatedSettingsFrom(final NodeSettingsRO settings)
setting.loadSettingsFrom(settings);
}
catch (final InvalidSettingsException excOrig) {
if (bIgnoreNonExistingSetting) {
if (bIgnoreNonExistingSetting && isNonExistingSettingException(excOrig)) {
LOGGER.debug("A new setting was not known when the node" +
(nodeName == null ? "" : " '" + nodeName + "'") + " was saved.");
}
Expand Down Expand Up @@ -1547,7 +1547,7 @@ protected void validateSettings(final NodeSettingsRO settings)
if (iErrorCounter == arrDeprecatedKeys.length - 1) {
LOGGER.debug("Deprecated keys did not work either. - Giving up.");

if (!bIgnoreNonExistingSetting) {
if (!bIgnoreNonExistingSetting || !isNonExistingSettingException(excOrig)) {
throw excOrig;
}
}
Expand All @@ -1558,7 +1558,7 @@ protected void validateSettings(final NodeSettingsRO settings)
setting.validateSettings(settings);
}
catch (final InvalidSettingsException excOrig) {
if (!bIgnoreNonExistingSetting) {
if (!bIgnoreNonExistingSetting || !isNonExistingSettingException(excOrig)) {
throw excOrig;
}
}
Expand Down Expand Up @@ -2907,5 +2907,22 @@ protected static PortObject[] tablesToObjects(BufferedDataTable[] inTables) {
.toArray(PortObject[]::new);
}

//
// Private static methods
//

/**
* Checks and returns True if the supplied {@code InvalidSettingsException} instance
* is about a non-existing settings entry, otherwise False.
*
* @param e The {@code InvalidSettingsException} instance to check.
* Can be null.
* @return True if the supplied {@code InvalidSettingsException} instance is about a non-existing settings entry, otherwise False.
*/
private static boolean isNonExistingSettingException(InvalidSettingsException e) {
return e != null && e.getMessage() != null
&& e.getMessage().matches(".*? for key \".*?\" not found.");
}

}