[
https://issues.apache.org/jira/browse/WICKET-1922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matej Knopp resolved WICKET-1922.
---------------------------------
Resolution: Fixed
Fix Version/s: 1.4-RC5
1.3.7
> AbstractTree - setting root to null causes NullPointerException
> ---------------------------------------------------------------
>
> Key: WICKET-1922
> URL: https://issues.apache.org/jira/browse/WICKET-1922
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5
> Environment: JDK 1.6.0_01
> Reporter: Vlastimil
> Assignee: Matej Knopp
> Fix For: 1.3.7, 1.4-RC5
>
>
> I have TreeTable with some nodes, perform some filtering of them and update
> tree model. If result of filtering is nothing (empty Tree) I set
> setRoot(null) on the tree model. This send treeStructureChanged event to all
> listeners (to my TreeTable) with parameter TreeModelEvent which is
> constructed with null TreePath parameter. This cause NullPointerException in
> AbstractTree (implements TreeModelListener).
> I propose this fix:
> org.apache.wicket.markup.html.tree.AbstractTree
> /**
> * @see
> javax.swing.event.TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent)
> */
> public final void treeStructureChanged(TreeModelEvent e)
> {
> // empty root
> if(e.getTreePath() == null) {
> invalidateAll();
> }
> else {
> // get the parent node of changed nodes
> TreeNode node =
> (TreeNode)e.getTreePath().getLastPathComponent();
> // has the tree root changed?
> if (e.getTreePath().getPathCount() == 1 &&
> node.equals(rootItem.getModelObject()))
> {
> invalidateAll();
> }
> else
> {
> invalidateNodeWithChildren(node);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.