From ea8fb9be06773184ec9c74c9acc531de58b22373 Mon Sep 17 00:00:00 2001 From: Robrecht Vanhuysse Date: Wed, 20 Nov 2024 14:36:07 +0100 Subject: [PATCH] [issue-229] do not persist legacy property-backed-beans from legacy propertybackedbeans on init This fix prevents property-backed-beans configuration being persisted at init. This mitigates issues where breaking configuration is duplicated in the database, ensuring that simple removal of the broken configuration allows for startup. --- .../config/PropertyBackedBeanPersister.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/repository/src/main/java/org/orderofthebee/addons/support/tools/repo/config/PropertyBackedBeanPersister.java b/repository/src/main/java/org/orderofthebee/addons/support/tools/repo/config/PropertyBackedBeanPersister.java index f29a4c8e..63baf369 100644 --- a/repository/src/main/java/org/orderofthebee/addons/support/tools/repo/config/PropertyBackedBeanPersister.java +++ b/repository/src/main/java/org/orderofthebee/addons/support/tools/repo/config/PropertyBackedBeanPersister.java @@ -280,12 +280,21 @@ protected void handleNewPropertyBackedBean(final PropertyBackedBean propertyBack // for some reason most subsystem beans are by default not configured to broadcast property changes // JMX only works because it is the only tool / component dealing with this, and only performs direct calls - if (propertyBackedBean instanceof AbstractPropertyBackedBean) + try { - ((AbstractPropertyBackedBean) propertyBackedBean).setSaveSetProperty(true); + if (propertyBackedBean instanceof AbstractPropertyBackedBean) + { + ((AbstractPropertyBackedBean) propertyBackedBean).setSaveSetProperty(false); + } + this.initializeFromPersistedProperties(name, propertyBackedBean); + } + finally + { + if (propertyBackedBean instanceof AbstractPropertyBackedBean) + { + ((AbstractPropertyBackedBean) propertyBackedBean).setSaveSetProperty(true); + } } - - this.initializeFromPersistedProperties(name, propertyBackedBean); } protected void handleRemovedPropertyBackedBean(final PropertyBackedBean propertyBackedBean, final boolean permanent)