From e31d630fde3e952261372a8d0a7a7b3baecf2f5f Mon Sep 17 00:00:00 2001 From: Dave Ward Date: Mon, 18 May 2009 16:57:54 +0000 Subject: [PATCH] Correct handling of nulls and empty strings for PropertyBackedBeans (actually save empty strings) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14354 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../ChildApplicationContextFactory.java | 45 +++++++------------ 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java b/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java index cc2f0bd6cd..d3086da59c 100644 --- a/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java +++ b/source/java/org/alfresco/repo/management/subsystems/ChildApplicationContextFactory.java @@ -342,10 +342,6 @@ public class ChildApplicationContextFactory extends AbstractPropertyBackedBean i { updateCompositeProperty(name, value, type); } - else if (value == null) - { - this.properties.remove(name); - } else { this.properties.setProperty(name, value); @@ -370,39 +366,32 @@ public class ChildApplicationContextFactory extends AbstractPropertyBackedBean i Map propertyValues = this.compositeProperties.get(name); if (propertyValues == null) { - if (value == null) - { - return; - } propertyValues = Collections.emptyMap(); } try { Map newPropertyValues = new LinkedHashMap(11); - if (value != null) + StringTokenizer tkn = new StringTokenizer(value, ", \t\n\r\f"); + while (tkn.hasMoreTokens()) { - StringTokenizer tkn = new StringTokenizer(value, ", \t\n\r\f"); - while (tkn.hasMoreTokens()) + String id = tkn.nextToken(); + + // Generate a unique ID within the category + List childId = new ArrayList(3); + childId.addAll(getId()); + childId.add(name); + childId.add(id); + + // Look out for new or updated children + CompositeDataBean child = propertyValues.get(id); + + if (child == null) { - String id = tkn.nextToken(); - - // Generate a unique ID within the category - List childId = new ArrayList(3); - childId.addAll(getId()); - childId.add(name); - childId.add(id); - - // Look out for new or updated children - CompositeDataBean child = propertyValues.get(id); - - if (child == null) - { - child = new CompositeDataBean(getParent(), this, getRegistry(), getPropertyDefaults(), - getCategory(), type, childId); - } - newPropertyValues.put(id, child); + child = new CompositeDataBean(getParent(), this, getRegistry(), getPropertyDefaults(), + getCategory(), type, childId); } + newPropertyValues.put(id, child); } // Destroy any children that have been removed