You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Josu? Burgos (JIRA)" <de...@myfaces.apache.org> on 2006/03/21 10:59:06 UTC

[jira] Created: (TOMAHAWK-206) Process an event of a node changed after removing the node cause an Exception

Process an event of a node changed after removing the node cause an Exception
-----------------------------------------------------------------------------

         Key: TOMAHAWK-206
         URL: http://issues.apache.org/jira/browse/TOMAHAWK-206
     Project: MyFaces Tomahawk
        Type: Bug
  Components: Tree Table  
    Versions: 1.1.1    
    Reporter: Josué Burgos
    Priority: Minor


I think this is a bug but I'm not sure. When processing a node changed event after removing the node in the tree model cause this exception:
java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.ArrayList.get(ArrayList.java:326)
        at javax.faces.component._ComponentChildrenList.get(_ComponentChildrenList.java:42)
        at org.apache.myfaces.custom.tree.HtmlTree.findNode(HtmlTree.java:550)
        at org.apache.myfaces.custom.tree.HtmlTree.treeNodesChanged(HtmlTree.java:761)
        at org.apache.myfaces.custom.tree.HtmlTree$Event.process(HtmlTree.java:1021)
        at org.apache.myfaces.custom.tree.HtmlTree.processModelEvents(HtmlTree.java:865)
        at org.apache.myfaces.custom.tree.HtmlTree.encodeBegin(HtmlTree.java:707)
        at org.apache.myfaces.renderkit.RendererUtils.renderChild(RendererUtils.java:441)

It doesn't find the node because it is removed before processing the event. Perhaps I have to force processign the events before removing the node but I don't think so.

A fix to the problem could be:

  549          int index = translatedPath[i];
  550          if (index == -1) return null;
  551          node = (HtmlTreeNode) node.getChildren().get(index);

instead of:
  549          int index = translatedPath[i];
  550          node = (HtmlTreeNode) node.getChildren().get(index);

or capture the IndexOutOfBoundException and return null.

in HtmlTree.java

-- 
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