You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hannes Schubert <in...@tele2.de> on 2008/10/27 11:24:57 UTC
Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Hi all,
if I call removeNodeFromParent for the last (and only) child node of a
parent node on second or deeper level in a TreeTable, Wicket throws an
IllegalStateException like this:
ERROR - RequestCycle - Cannot remove [MarkupContainer
[Component id = 11, page = <No Page>, path = 11.AbstractTree$TreeItem]]
from null parent!
java.lang.IllegalStateException: Cannot remove [MarkupContainer
[Component id = 11, page = <No Page>, path = 11.AbstractTree$TreeItem]]
from null parent!
at org.apache.wicket.Component.remove(Component.java:2204)
at
org.apache.wicket.markup.html.tree.AbstractTree.removeItem(AbstractTree.java:1441)
at
org.apache.wicket.markup.html.tree.AbstractTree.treeNodesRemoved(AbstractTree.java:832)
at
javax.swing.tree.DefaultTreeModel.fireTreeNodesRemoved(DefaultTreeModel.java:530)
at
javax.swing.tree.DefaultTreeModel.nodesWereRemoved(DefaultTreeModel.java:310)
at
javax.swing.tree.DefaultTreeModel.removeNodeFromParent(DefaultTreeModel.java:244)
It runs well if child node is not the last child of parent. Before
calling removeNodeFromParent() the instance method
TreeNode.getParent() always returns the valid instance of
DefaultMutableTreeNode. So tree seems to be intact for me...
Any hints?
Best regards
Hannes Schubert
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Posted by skatz <st...@nokia.com>.
I posted a bug (WICKET-2178) with a test case/source code. The last action I
saw on it was it was assigned to Matej Knopp back in April.
I tested the same code against the 1.4 code and it seemed to work.
Leena wrote:
>
> Any resolution on this? Or may be some workaround? I am facing a similar
> issue, so thought this could be related.
>
> I am getting a NullPointerException while trying to move nodes within the
> tree (ajax requests)
>
> Partial Stack trace:
> java.lang.NullPointerException
> at
> org.apache.wicket.markup.html.tree.AbstractTree.treeNodesInserted(AbstractTree.java:790)
> at javax.swing.tree.DefaultTreeModel.fireTreeNodesInserted(Unknown
> Source)
> at javax.swing.tree.DefaultTreeModel.nodesWereInserted(Unknown
> Source)
> at javax.swing.tree.DefaultTreeModel.insertNodeInto(Unknown Source)
>
> Please let me know if there is any solution/workaround to this. I am using
> wicket-1.3.5.
>
> +Leena
>
>
> skatz wrote:
>>
>> I have the same problem using 1.3.5, but not when using 1.3.3. I spent
>> some time tracing the source code and it seems related to the addition of
>> this line:
>>
>> getTreeState().selectNode((TreeNode)item.getModelObject(), false);
>>
>> at the very end of the function (line 835):
>>
>> AbstractTree.treeNodesRemoved()
>>
>> This line results (eventually) in a call to
>>
>> AbstractTree.invalidateNode()
>>
>> which on line 1295 calls:
>>
>> item.remove()
>>
>> which alters the state of "item" such that the call to item.remove() in
>> AbstractTree.treeNodesRemoved() fails with the exception mentioned
>> previously.
>>
>> I note that the IItemCallback() code, immediately above, calls two
>> identical lines in the reverse order. I wonder reversing the later two
>> would fix the problem?
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Illegal-State-Exception-on-DefaultTeeModel.removeNodeFromParent-tp20185042p23640768.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Posted by Leena <le...@yahoo.com>.
Collapsing the node works :)
+Leena
--
View this message in context: http://www.nabble.com/Illegal-State-Exception-on-DefaultTeeModel.removeNodeFromParent-tp20185042p23556124.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Posted by Leena <le...@yahoo.com>.
Any resolution on this? Or may be some workaround?
+Leena
skatz wrote:
>
> I have the same problem using 1.3.5, but not when using 1.3.3. I spent
> some time tracing the source code and it seems related to the addition of
> this line:
>
> getTreeState().selectNode((TreeNode)item.getModelObject(), false);
>
> at the very end of the function (line 835):
>
> AbstractTree.treeNodesRemoved()
>
> This line results (eventually) in a call to
>
> AbstractTree.invalidateNode()
>
> which on line 1295 calls:
>
> item.remove()
>
> which alters the state of "item" such that the call to item.remove() in
> AbstractTree.treeNodesRemoved() fails with the exception mentioned
> previously.
>
> I note that the IItemCallback() code, immediately above, calls two
> identical lines in the reverse order. I wonder reversing the later two
> would fix the problem?
>
>
--
View this message in context: http://www.nabble.com/Illegal-State-Exception-on-DefaultTeeModel.removeNodeFromParent-tp20185042p23541664.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Posted by skatz <st...@nokia.com>.
I have the same problem using 1.3.5, but not when using 1.3.3. I spent some
time tracing the source code and it seems related to the addition of this
line:
getTreeState().selectNode((TreeNode)item.getModelObject(), false);
at the very end of the function (line 835):
AbstractTree.treeNodesRemoved()
This line results (eventually) in a call to
AbstractTree.invalidateNode()
which on line 1295 calls:
item.remove()
which alters the state of "item" such that the call to item.remove() in
AbstractTree.treeNodesRemoved() fails with the exception mentioned
previously.
I note that the IItemCallback() code, immediately above, calls two identical
lines in the reverse order. I wonder reversing the later two would fix the
problem?
--
View this message in context: http://www.nabble.com/Illegal-State-Exception-on-DefaultTeeModel.removeNodeFromParent-tp20185042p22547387.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Posted by Hannes Schubert <in...@tele2.de>.
Hi all,
so far I did not isolate the issue. However, I found a workaround:
exception was thrown only if node had been expanded. If I do collapse
the node before removal, it does not fail again...
Best regards
Hannes
Matej Knopp wrote:
> Might be a big. Jira issue with attached quickstart project to reproduce it
> would be helpful.
>
> -Matej
>
> On Mon, Oct 27, 2008 at 11:24 AM, Hannes Schubert <in...@tele2.de> wrote:
>
>
>> Hi all,
>>
>> if I call removeNodeFromParent for the last (and only) child node of a
>> parent node on second or deeper level in a TreeTable, Wicket throws an
>> IllegalStateException like this:
>>
>> ERROR - RequestCycle - Cannot remove [MarkupContainer
>> [Component id = 11, page = <No Page>, path = 11.AbstractTree$TreeItem]] from
>> null parent!
>> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component
>> id = 11, page = <No Page>, path = 11.AbstractTree$TreeItem]] from null
>> parent!
>> at org.apache.wicket.Component.remove(Component.java:2204)
>> at
>> org.apache.wicket.markup.html.tree.AbstractTree.removeItem(AbstractTree.java:1441)
>> at
>> org.apache.wicket.markup.html.tree.AbstractTree.treeNodesRemoved(AbstractTree.java:832)
>> at
>> javax.swing.tree.DefaultTreeModel.fireTreeNodesRemoved(DefaultTreeModel.java:530)
>> at
>> javax.swing.tree.DefaultTreeModel.nodesWereRemoved(DefaultTreeModel.java:310)
>> at
>> javax.swing.tree.DefaultTreeModel.removeNodeFromParent(DefaultTreeModel.java:244)
>>
>> It runs well if child node is not the last child of parent. Before calling
>> removeNodeFromParent() the instance method TreeNode.getParent() always
>> returns the valid instance of DefaultMutableTreeNode. So tree seems to be
>> intact for me...
>>
>> Any hints?
>>
>> Best regards
>> Hannes Schubert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Illegal State Exception on DefaultTeeModel.removeNodeFromParent
Posted by Matej Knopp <ma...@gmail.com>.
Might be a big. Jira issue with attached quickstart project to reproduce it
would be helpful.
-Matej
On Mon, Oct 27, 2008 at 11:24 AM, Hannes Schubert <in...@tele2.de> wrote:
> Hi all,
>
> if I call removeNodeFromParent for the last (and only) child node of a
> parent node on second or deeper level in a TreeTable, Wicket throws an
> IllegalStateException like this:
>
> ERROR - RequestCycle - Cannot remove [MarkupContainer
> [Component id = 11, page = <No Page>, path = 11.AbstractTree$TreeItem]] from
> null parent!
> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component
> id = 11, page = <No Page>, path = 11.AbstractTree$TreeItem]] from null
> parent!
> at org.apache.wicket.Component.remove(Component.java:2204)
> at
> org.apache.wicket.markup.html.tree.AbstractTree.removeItem(AbstractTree.java:1441)
> at
> org.apache.wicket.markup.html.tree.AbstractTree.treeNodesRemoved(AbstractTree.java:832)
> at
> javax.swing.tree.DefaultTreeModel.fireTreeNodesRemoved(DefaultTreeModel.java:530)
> at
> javax.swing.tree.DefaultTreeModel.nodesWereRemoved(DefaultTreeModel.java:310)
> at
> javax.swing.tree.DefaultTreeModel.removeNodeFromParent(DefaultTreeModel.java:244)
>
> It runs well if child node is not the last child of parent. Before calling
> removeNodeFromParent() the instance method TreeNode.getParent() always
> returns the valid instance of DefaultMutableTreeNode. So tree seems to be
> intact for me...
>
> Any hints?
>
> Best regards
> Hannes Schubert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>