Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Cannot Reproduce
-
1.3.5
-
None
-
None
-
Redhat Linux 4 WS
Java 1.6.0_12 (from Sun)
Description
Source that replicates the problem is attached. Extract with 'tar xvzf treeproblem.tgz'
The example works fine with wicket 1.3.4
The page displays a Tree Component
1) Expand the top node of the tree
2) Select the first child node (or any node really)
3) Press the Delete link
Here is the contents of the eclipse console window:
18:14:12.307 EVENT Statistics on = false for org.mortbay.jetty.Server@19c26f5
18:14:12.333 EVENT Starting Jetty/4.2.24
18:14:12.421 EVENT Started WebApplicationContext[/quickstart,src/webapp]
18:14:12.587 WARN!! Delete existing temp dir /tmp/Jetty_8081_quickstart for WebApplicationContext[/quickstart,src/webapp]
INFO - Application - [QuickStartApplication] init: Wicket core library initializer
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IFormSubmitListener, method=public abstract void org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IFormSubmitListener, method=public abstract void org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=ILinkListener, method=public abstract void org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=ILinkListener, method=public abstract void org.apache.wicket.markup.html.link.ILinkListener.onLinkClicked()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IOnChangeListener, method=public abstract void org.apache.wicket.markup.html.form.IOnChangeListener.onSelectionChanged()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IOnChangeListener, method=public abstract void org.apache.wicket.markup.html.form.IOnChangeListener.onSelectionChanged()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IRedirectListener, method=public abstract void org.apache.wicket.IRedirectListener.onRedirect()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IRedirectListener, method=public abstract void org.apache.wicket.IRedirectListener.onRedirect()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IResourceListener, method=public abstract void org.apache.wicket.IResourceListener.onResourceRequested()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IResourceListener, method=public abstract void org.apache.wicket.IResourceListener.onResourceRequested()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IActivePageBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=IActivePageBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()]
INFO - Application - [QuickStartApplication] init: Wicket extensions initializer
INFO - WebApplication - [QuickStartApplication] Started Wicket version 1.3.5 in development mode
********************************************************************
-
-
- WARNING: Wicket is running in DEVELOPMENT mode. ***
- ^^^^^^^^^^^ ***
- Do NOT deploy to your live server(s) without changing this. ***
- See Application#getConfigurationType() for more information. ***
********************************************************************
18:14:12.688 EVENT jsp: init
18:14:12.722 EVENT default: init
18:14:12.724 EVENT invoker: init
18:14:12.732 EVENT Started SocketListener on 0.0.0.0:8081
18:14:12.732 EVENT Started org.mortbay.jetty.Server@19c26f5
INFO - RequestListenerInterface - registered listener interface [RequestListenerInterface name=INewBrowserWindowListener, method=public abstract void org.apache.wicket.markup.html.INewBrowserWindowListener.onNewBrowserWindow()]
INFO - Index - Yes I was Clicked!!
ERROR - RequestCycle - Cannot remove [MarkupContainer [Component id = 1]] from null parent!
java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1]] from null parent!
at org.apache.wicket.Component.remove(Component.java:2203)
at org.apache.wicket.markup.html.tree.AbstractTree.removeItem(AbstractTree.java:1466)
at org.apache.wicket.markup.html.tree.AbstractTree.treeNodesRemoved(AbstractTree.java:837)
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)
at wicket.quickstart.Index$1.onClick(Index.java:52)
at org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:65)
at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:297)
at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:100)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:200)
at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
-
Here is the stack trace displayed in the browser:
Root cause:
java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1]] from null parent!
at org.apache.wicket.Component.remove(Component.java:2203)
at org.apache.wicket.markup.html.tree.AbstractTree.removeItem(AbstractTree.java:1466)
at org.apache.wicket.markup.html.tree.AbstractTree.treeNodesRemoved(AbstractTree.java:837)
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)
at wicket.quickstart.Index$1.onClick(Index.java:52)
at org.apache.wicket.ajax.markup.html.AjaxLink$1.onEvent(AjaxLink.java:65)
at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163)
at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:297)
at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:100)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:91)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:200)
at org.mortbay.jetty.servlet.WebApplicationHandler$Chain.doFilter(WebApplicationHandler.java:334)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:286)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:525)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:789)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:960)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:218)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)
I investigated this down through the source and the problem seem related to a change made to AbstractTree (the one in wicket not wicket-extensions)
Please see my comments on this nabble thread (reproduced below):
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?