mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2477 Treat the empty string in the same way as null.
Fix an issue in the behaviour checking where the empty string was being passed as the instructions when nothing was set. +review RM git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@109843 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -144,10 +144,23 @@ public class ClassifiedAspect extends BaseBehaviourBean implements NodeServicePo
|
||||
Serializable downgradeDate = nodeService.getProperty(nodeRef, PROP_DOWNGRADE_DATE);
|
||||
Serializable downgradeEvent = nodeService.getProperty(nodeRef, PROP_DOWNGRADE_EVENT);
|
||||
Serializable downgradeInstructions = nodeService.getProperty(nodeRef, PROP_DOWNGRADE_INSTRUCTIONS);
|
||||
if (downgradeInstructions == null && (downgradeDate != null || downgradeEvent != null))
|
||||
if (isEmpty(downgradeInstructions) && !(isEmpty(downgradeDate) && isEmpty(downgradeEvent)))
|
||||
{
|
||||
throw new MissingDowngradeInstructions(nodeRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a property is null or the empty string. Note that this is the same as
|
||||
* {@link org.apache.commons.lang.StringUtils#isEmpty(String)}, except that it takes a Serializable rather than a
|
||||
* String. This avoids awkward casting exceptions when working with properties.
|
||||
*
|
||||
* @param value The (probably String) value to check.
|
||||
* @return true if the supplied value is null or the empty string.
|
||||
*/
|
||||
private boolean isEmpty(Serializable value)
|
||||
{
|
||||
return (value == null || value.equals(""));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user