Tree2 fails with NumberFormat Exception or Null Pointer Exception when 
ExpandAll button is placed in the same form as Tree2 using RI
------------------------------------------------------------------------------------------------------------------------------------

                 Key: TOMAHAWK-671
                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-671
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Tree2
    Affects Versions: 1.1.5-SNAPSHOT
         Environment: WindowsXP, SUN JSF RI 1.1.02, Tomahawk 1.1.5
            Reporter: Stan Laufik


When a button that executes HtmlTree.expandAll is put into the same <h:form> 
then the Tree2 component after clicking on the button Tree2 throws NumberFormat 
or NullPointer exception (depending on which build of Tomahawk is used).

On our system I have fixed it with teh following code:


package org.apache.myfaces.custom.tree2
class UITreeData

public void broadcast(FacesEvent event) throws AbortProcessingException
    {
        if (event instanceof FacesEventWrapper)
        {
            FacesEventWrapper childEvent = (FacesEventWrapper) event;
            String currNodeId = getNodeId();
            setNodeId(childEvent.getNodeId());
            FacesEvent nodeEvent = childEvent.getFacesEvent();
            nodeEvent.getComponent().broadcast(nodeEvent);
            setNodeId(currNodeId);
            return;
        }
        else if(event instanceof ToggleExpandedEvent)
        {
            ToggleExpandedEvent toggleEvent = (ToggleExpandedEvent) event;
                        
            if (toggleEvent.getNodeId() != null &&  
!"null".equals(toggleEvent.getNodeId())) {
                String currentNodeId = getNodeId();
                    setNodeId(toggleEvent.getNodeId());
                    toggleExpanded();
                    setNodeId(currentNodeId);
            }                        
            
        }
        else
        {
            super.broadcast(event);
            return;
        }
    }

The chanegd code first check if the node to be toggledis valid before it 
performs the toggle.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to