Some parameter checks to catch null NodeRefs.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-05-04 01:11:00 +00:00
parent e58574447e
commit 5615885916

View File

@@ -75,6 +75,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.QNamePattern;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.ParameterCheck;
import org.alfresco.util.PropertyCheck;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.dao.DataIntegrityViolationException;
@@ -123,6 +124,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
*/
private Node getNodeNotNull(NodeRef nodeRef) throws InvalidNodeRefException
{
ParameterCheck.mandatory("nodeRef", nodeRef);
Node unchecked = nodeDaoService.getNode(nodeRef);
if (unchecked == null)
{
@@ -139,6 +142,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
*/
public NodeStatus getNodeStatusNotNull(NodeRef nodeRef) throws InvalidNodeRefException
{
ParameterCheck.mandatory("nodeRef", nodeRef);
NodeStatus nodeStatus = nodeDaoService.getNodeStatus(nodeRef, false);
if (nodeStatus == null || nodeStatus.getNode() == null)
{
@@ -157,6 +162,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
public boolean exists(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
Node node = nodeDaoService.getNode(nodeRef);
boolean exists = (node != null);
// done
@@ -165,6 +172,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
public Status getNodeStatus(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
NodeStatus nodeStatus = nodeDaoService.getNodeStatus(nodeRef, false);
if (nodeStatus == null) // node never existed
{