Hi, 

I would say that this is a bug as the NPE is thrown deep under the code. 

I have something like a categories and items under that. If I have a
categories that dont have any items or if I dont have any categories this
exception is thrown. 

I call the code as follows 

<t:tree model="assetGroupValueWrapperModel" value="valueWrapper" /> 

public TreeModel<ValueWrapper> getAssetGroupValueWrapperModel() {
        ValueEncoder<ValueWrapper> encoder = new
ValueEncoder<ValueWrapper>() {
            @Override
            public String toClient(ValueWrapper value) {
                return value.getId().toString();
            }

            @Override
            public ValueWrapper toValue(String clientValue) {
                return assetGroupRootNode.seek(clientValue);
            }
        };
        assetGroupRootNode = new
AssetGroupRootValueWrapper(systemManager.getAssetGroups(user.getSelectedProject()));
        return new DefaultTreeModel<ValueWrapper>(encoder, new
ValueWrapperTreeModelAdapter(), assetGroupRootNode.getChildren());
    }

The methods getChildren() always return an empty list if not data is
present. 

The error happens in the following place of the Tree class

private RenderCommand toRenderCommand(final TreeNode node, final boolean
isLast)
    {
        return new RenderCommand()
        {
            public void render(MarkupWriter writer, RenderQueue queue)
            {
                // Inform the component's container about what value is
being rendered
                // (this may be necessary to generate the correct label for
the node).
                Tree.this.node = node;

                value = node.getValue();

.......

when node.getValue is called it throws an exception as node is null. This
method seems to be called even though lists are empty...

Please let me know if you need more code.

Cheers



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/NPE-in-Tree-when-I-dont-have-any-data-tp5720289p5720305.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to