Change the behavior of AVMService.getAVMStore() and AVMService.lookup()

methods to return null for not found instead of throwing an exception.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-13 14:54:25 +00:00
parent a06fc74aef
commit 194d96082c
8 changed files with 91 additions and 76 deletions

View File

@@ -450,6 +450,10 @@ public class AVMServiceImpl implements AVMService
*/
public AVMNodeDescriptor lookup(int version, String path)
{
if (path == null)
{
throw new AVMBadArgumentException("Illegal null path.");
}
return lookup(version, path, false);
}
@@ -471,8 +475,15 @@ public class AVMServiceImpl implements AVMService
{
throw new AVMBadArgumentException("Path is null.");
}
Lookup lookup = fAVMRepository.lookup(version, path, includeDeleted);
return lookup.getCurrentNode().getDescriptor(lookup);
try
{
Lookup lookup = fAVMRepository.lookup(version, path, includeDeleted);
return lookup.getCurrentNode().getDescriptor(lookup);
}
catch (AVMNotFoundException e)
{
return null;
}
}
/**
@@ -483,6 +494,10 @@ public class AVMServiceImpl implements AVMService
*/
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name)
{
if (dir == null || name == null)
{
throw new AVMBadArgumentException("Illegal null argument.");
}
return lookup(dir, name, false);
}
@@ -503,7 +518,14 @@ public class AVMServiceImpl implements AVMService
{
throw new AVMBadArgumentException("Illegal null argument.");
}
return fAVMRepository.lookup(dir, name, includeDeleted);
try
{
return fAVMRepository.lookup(dir, name, includeDeleted);
}
catch (AVMNotFoundException e)
{
return null;
}
}
/**
@@ -626,7 +648,14 @@ public class AVMServiceImpl implements AVMService
{
throw new AVMBadArgumentException("Null Store Name.");
}
return fAVMRepository.getAVMStore(name);
try
{
return fAVMRepository.getAVMStore(name);
}
catch (AVMNotFoundException e)
{
return null;
}
}
/**