Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

80871: Fix for ALF-20896. ScriptNode.childByPath should return null for no child.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@83123 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Will Abson
2014-09-03 18:07:02 +00:00
parent 0bb93f7aa5
commit ac4213cd9c

View File

@@ -479,10 +479,18 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
* So a valid call might be:
* <code>mynode.childByNamePath("/QA/Testing/Docs");</code>
*
* @return The ScriptNode or null if the node is not found.
* @param path the relative path of the descendant node to find e.g. {@code "/QA/Testing/Docs"}
* @return The ScriptNode or {@code null} if the node is not found.
* {@code null} if the specified path is {@code ""}.
* @throws NullPointerException if the provided path is {@code null}.
*/
public ScriptNode childByNamePath(String path)
{
// Ensure that paths that do not represent descendants are not needlessly tokenised. See ALF-20896.
if (path == null) { throw new NullPointerException("Illegal null path"); }
else if (path.isEmpty()) { return null; }
// We have a path worth looking at...
ScriptNode child = null;
if (this.services.getDictionaryService().isSubClass(getQNameType(), ContentModel.TYPE_FOLDER))