AnsweredAssumed Answered

getChildByName not working

Question asked by gokceng on Mar 23, 2011
Latest reply on Mar 24, 2011 by gokceng
public static NodeRef findChildNodeRef(NodeRef parentSpaceNodeRef, String nodeName, ServiceRegistry serviceRegistry)
{
   NodeService nodeService = serviceRegistry.getNodeService();
   NodeRef nodeRef = nodeService.getChildByName(parentSpaceNodeRef, ContentModel.ASSOC_CONTAINS, ISO9075.encode(nodeName));
   return nodeRef;
}

I have a space tree like this:

RootSpace
    -
    |-Space1
    |    -
    |    |-ChildSpace1
    |    |-ChildSpace2
    |
    |
    |-Space2
        -
        |-ChildSpace3
        |-ChildSpace4
And Im calling

NodeRef Space1NodeRef = findChildNodeRef(RootSpaceNodeRef, "Space1", serviceRegistry);
NodeRef childSpace1NodeRef = findChildNodeRef(Space1NodeRef, "ChildSpace1", serviceRegistry);

And Space1NodeRef's value is correct but childSpace1NodeRef is null.

What can be the difference between these two spaces?

Outcomes