Better Null handling, ACE-4246

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@112631 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2015-09-22 15:29:30 +00:00
parent d6b3f5acd3
commit 410c24d2d1
6 changed files with 103 additions and 14 deletions

View File

@@ -828,11 +828,10 @@ public class ActionServiceImpl implements ActionService, RuntimeActionService, A
public void directActionExecution(Action action, NodeRef actionedUponNodeRef)
{
// Debug output
if (logger.isDebugEnabled() == true)
if (logger.isDebugEnabled())
{
logger
.debug("The action is being executed as the user: "
+ this.authenticationContext.getCurrentUserName());
logger.debug("The action is being executed as the user: "
+ this.authenticationContext.getCurrentUserName());
}
// Get the action executer and execute

View File

@@ -211,19 +211,23 @@ public abstract class ParameterizedItemAbstractBase extends CommonResourceAbstra
protected void checkMandatoryProperties(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition)
{
List<ParameterDefinition> definitions = ruleItemDefinition.getParameterDefinitions();
for (ParameterDefinition definition : definitions)
if (definitions!= null && definitions.size()>0)
{
if (definition.isMandatory() == true)
for (ParameterDefinition definition : definitions)
{
// Check that a value has been set for the mandatory parameter
if (ruleItem.getParameterValue(definition.getName()) == null)
if (definition.isMandatory() == true)
{
// Error since a mandatory parameter has a null value
throw new RuleServiceException(
MessageFormat.format(ERR_MAND_PROP, new Object[]{definition.getName(), ruleItemDefinition.getName()}));
// Check that a value has been set for the mandatory parameter
if (ruleItem.getParameterValue(definition.getName()) == null)
{
// Error since a mandatory parameter has a null value
throw new RuleServiceException(
MessageFormat.format(ERR_MAND_PROP, new Object[]{definition.getName(), ruleItemDefinition.getName()}));
}
}
}
}
}
}

View File

@@ -191,9 +191,12 @@ public abstract class ParameterizedItemDefinitionImpl implements ParameterizedIt
List<ParameterDefinition> localizedDefinitions = this.parameterDefinitions.get(locale);
for (ParameterDefinition definition : localizedDefinitions)
if (localizedDefinitions!= null && localizedDefinitions.size()>0)
{
namedDefinitions.put(definition.getName(), definition);
for (ParameterDefinition definition : localizedDefinitions)
{
namedDefinitions.put(definition.getName(), definition);
}
}
}
}