From 19ba57da3314ab96c7539f8ddade4ea46722ec3e Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 7 Mar 2015 08:07:55 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud) 98967: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud) 98775: Merged NESS/5.0.N-2015_03_04 (5.0.2) to 5.0.N (5.0.2) 98751: MNT-13556 : Integrity check allows null values for mandatory properties git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@98983 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/node/integrity/PropertiesIntegrityEvent.java | 2 +- .../org/alfresco/repo/node/integrity/IntegrityTest.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/repo/node/integrity/PropertiesIntegrityEvent.java b/source/java/org/alfresco/repo/node/integrity/PropertiesIntegrityEvent.java index fd68fa7077..c1f78dfffa 100644 --- a/source/java/org/alfresco/repo/node/integrity/PropertiesIntegrityEvent.java +++ b/source/java/org/alfresco/repo/node/integrity/PropertiesIntegrityEvent.java @@ -151,7 +151,7 @@ public class PropertiesIntegrityEvent extends AbstractIntegrityEvent { QName propertyQName = propertyDef.getName(); // check that enforced, mandatoryproperties are set - if (propertyDef.isMandatory() && propertyDef.isMandatoryEnforced() && !nodeProperties.containsKey(propertyQName)) + if (propertyDef.isMandatory() && propertyDef.isMandatoryEnforced() && (!nodeProperties.containsKey(propertyQName) || null == nodeProperties.get(propertyQName))) { String nameProp = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); IntegrityRecord result = new IntegrityRecord( diff --git a/source/test-java/org/alfresco/repo/node/integrity/IntegrityTest.java b/source/test-java/org/alfresco/repo/node/integrity/IntegrityTest.java index 00065bd8fc..e69ca22974 100644 --- a/source/test-java/org/alfresco/repo/node/integrity/IntegrityTest.java +++ b/source/test-java/org/alfresco/repo/node/integrity/IntegrityTest.java @@ -245,6 +245,13 @@ public class IntegrityTest extends TestCase checkIntegrityNoFailure(); } + public void testCreateWithNullMandatoryProperty() throws Exception + { + allProperties.put(TEST_PROP_TEXT_A, null); + NodeRef nodeRef = createNode("abc", TEST_TYPE_WITH_PROPERTIES, allProperties); + checkIntegrityExpectFailure("Failed to detect null mandatory properties", 1); + } + public void testCreateWithEmptyMandatoryProperty() throws Exception { allProperties.put(TEST_PROP_TEXT_A, "");