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
This commit is contained in:
Alan Davis
2015-03-07 08:07:55 +00:00
parent a330f85a38
commit 19ba57da33
2 changed files with 8 additions and 1 deletions

View File

@@ -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(

View File

@@ -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, "");