You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Kent Tong (JIRA)" <ji...@apache.org> on 2007/03/03 14:08:51 UTC

[jira] Created: (WICKET-349) ListView can't undo changes to model

ListView can't undo changes to model
------------------------------------

                 Key: WICKET-349
                 URL: https://issues.apache.org/jira/browse/WICKET-349
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.2.5
         Environment: WinXP, Tomcat 5.5.
            Reporter: Kent Tong


Given the code below (adapted from the guestbook example):

		Form form = new Form("form") {
			protected void onSubmit() {
				List comments = listView.getList();
				listView.modelChanging();
				comments.add(new Comment(comment, new Date()));
				comment = "";
				listView.modelChanged();
			}
		};

Perform the steps:
1) add "a" to the ListView and submit, bringing the page to version 1.
2) add "b" to the ListView and submit, bringing the page to version 2.
3) add "c" to the ListView and submit, bringing the page to version 3.
4) press Back twice.
5) add "x" to the ListView and submit. This will try to revert the page back to version 1. But it will fail with an IllegalStateException (full stack trace is shown below).

This is because at step 3, the ListView contains two items: "a" and "b". Calling modelChanging() will store the model (a list containing "a" and "b") into a ModelChange object for later undo. The problem is, when this action is undone, ModelChange.undo() will call setModel() on the ListView, which will call removeAll() on itself. This will leave the ListView in a state different from the original (containing "a" and "b" items). This is not a problem if the ListView was to be rendered immediately (then it would create the items again). But in this case, the next step is to further undo the adding of item "b". However, the item's parent has just been set to null by removeAll().  This causes Component.remove() to throw an exception.

Full stack trace is here:
Unexpected RuntimeException

Root cause:

java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1, page = <No Page>, path = 1.ListItem]] from null parent!
at wicket.Component.remove(Component.java:1469)
at wicket.version.undo.Add.undo(Add.java:81)
at wicket.version.undo.ChangeList.undo(ChangeList.java:93)
at wicket.version.undo.UndoPageVersionManager.undo(UndoPageVersionManager.java:217)
at wicket.version.undo.UndoPageVersionManager.getVersion(UndoPageVersionManager.java:167)
at wicket.Page.getVersion(Page.java:589)
at wicket.PageMap.get(PageMap.java:461)
at wicket.Session.getPage(Session.java:447)
at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:215)
at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153)
at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48)
at wicket.RequestCycle.step(RequestCycle.java:992)
at wicket.RequestCycle.steps(RequestCycle.java:1084)
at wicket.RequestCycle.request(RequestCycle.java:454)
at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WICKET-349) ListView can't undo changes to model

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner reassigned WICKET-349:
--------------------------------------

    Assignee: Johan Compagner

in 1.3 with the SecondLevelCache this isn't a problem anymore
will see if i can reproduce this in 1.2.6 and if this is also still a problem in 1.3 with AccessStack

> ListView can't undo changes to model
> ------------------------------------
>
>                 Key: WICKET-349
>                 URL: https://issues.apache.org/jira/browse/WICKET-349
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.5, 1.2.6
>         Environment: WinXP, Tomcat 5.5.
>            Reporter: Kent Tong
>            Assignee: Johan Compagner
>             Fix For: 1.2.7, 1.3.0-rc1
>
>
> Given the code below (adapted from the guestbook example):
> 		Form form = new Form("form") {
> 			protected void onSubmit() {
> 				List comments = listView.getList();
> 				listView.modelChanging();
> 				comments.add(new Comment(comment, new Date()));
> 				comment = "";
> 				listView.modelChanged();
> 			}
> 		};
> Perform the steps:
> 1) add "a" to the ListView and submit, bringing the page to version 1.
> 2) add "b" to the ListView and submit, bringing the page to version 2.
> 3) add "c" to the ListView and submit, bringing the page to version 3.
> 4) press Back twice.
> 5) add "x" to the ListView and submit. This will try to revert the page back to version 1. But it will fail with an IllegalStateException (full stack trace is shown below).
> This is because at step 3, the ListView contains two items: "a" and "b". Calling modelChanging() will store the model (a list containing "a" and "b") into a ModelChange object for later undo. The problem is, when this action is undone, ModelChange.undo() will call setModel() on the ListView, which will call removeAll() on itself. This will leave the ListView in a state different from the original (containing "a" and "b" items). This is not a problem if the ListView was to be rendered immediately (then it would create the items again). But in this case, the next step is to further undo the adding of item "b". However, the item's parent has just been set to null by removeAll().  This causes Component.remove() to throw an exception.
> Full stack trace is here:
> Unexpected RuntimeException
> Root cause:
> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1, page = <No Page>, path = 1.ListItem]] from null parent!
> at wicket.Component.remove(Component.java:1469)
> at wicket.version.undo.Add.undo(Add.java:81)
> at wicket.version.undo.ChangeList.undo(ChangeList.java:93)
> at wicket.version.undo.UndoPageVersionManager.undo(UndoPageVersionManager.java:217)
> at wicket.version.undo.UndoPageVersionManager.getVersion(UndoPageVersionManager.java:167)
> at wicket.Page.getVersion(Page.java:589)
> at wicket.PageMap.get(PageMap.java:461)
> at wicket.Session.getPage(Session.java:447)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:215)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153)
> at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48)
> at wicket.RequestCycle.step(RequestCycle.java:992)
> at wicket.RequestCycle.steps(RequestCycle.java:1084)
> at wicket.RequestCycle.request(RequestCycle.java:454)
> at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
> at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-349) ListView can't undo changes to model

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-349:
--------------------------------

        Fix Version/s:     (was: trunk)
                           (was: 1.2.6)
                       1.3.0-rc1
                       1.2.7
    Affects Version/s: 1.2.6

> ListView can't undo changes to model
> ------------------------------------
>
>                 Key: WICKET-349
>                 URL: https://issues.apache.org/jira/browse/WICKET-349
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.5, 1.2.6
>         Environment: WinXP, Tomcat 5.5.
>            Reporter: Kent Tong
>             Fix For: 1.2.7, 1.3.0-rc1
>
>
> Given the code below (adapted from the guestbook example):
> 		Form form = new Form("form") {
> 			protected void onSubmit() {
> 				List comments = listView.getList();
> 				listView.modelChanging();
> 				comments.add(new Comment(comment, new Date()));
> 				comment = "";
> 				listView.modelChanged();
> 			}
> 		};
> Perform the steps:
> 1) add "a" to the ListView and submit, bringing the page to version 1.
> 2) add "b" to the ListView and submit, bringing the page to version 2.
> 3) add "c" to the ListView and submit, bringing the page to version 3.
> 4) press Back twice.
> 5) add "x" to the ListView and submit. This will try to revert the page back to version 1. But it will fail with an IllegalStateException (full stack trace is shown below).
> This is because at step 3, the ListView contains two items: "a" and "b". Calling modelChanging() will store the model (a list containing "a" and "b") into a ModelChange object for later undo. The problem is, when this action is undone, ModelChange.undo() will call setModel() on the ListView, which will call removeAll() on itself. This will leave the ListView in a state different from the original (containing "a" and "b" items). This is not a problem if the ListView was to be rendered immediately (then it would create the items again). But in this case, the next step is to further undo the adding of item "b". However, the item's parent has just been set to null by removeAll().  This causes Component.remove() to throw an exception.
> Full stack trace is here:
> Unexpected RuntimeException
> Root cause:
> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1, page = <No Page>, path = 1.ListItem]] from null parent!
> at wicket.Component.remove(Component.java:1469)
> at wicket.version.undo.Add.undo(Add.java:81)
> at wicket.version.undo.ChangeList.undo(ChangeList.java:93)
> at wicket.version.undo.UndoPageVersionManager.undo(UndoPageVersionManager.java:217)
> at wicket.version.undo.UndoPageVersionManager.getVersion(UndoPageVersionManager.java:167)
> at wicket.Page.getVersion(Page.java:589)
> at wicket.PageMap.get(PageMap.java:461)
> at wicket.Session.getPage(Session.java:447)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:215)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153)
> at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48)
> at wicket.RequestCycle.step(RequestCycle.java:992)
> at wicket.RequestCycle.steps(RequestCycle.java:1084)
> at wicket.RequestCycle.request(RequestCycle.java:454)
> at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
> at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-349) ListView can't undo changes to model

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eelco Hillenius updated WICKET-349:
-----------------------------------

    Fix Version/s: 1.3
                   1.2.6

> ListView can't undo changes to model
> ------------------------------------
>
>                 Key: WICKET-349
>                 URL: https://issues.apache.org/jira/browse/WICKET-349
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.5
>         Environment: WinXP, Tomcat 5.5.
>            Reporter: Kent Tong
>             Fix For: 1.2.6, 1.3
>
>
> Given the code below (adapted from the guestbook example):
> 		Form form = new Form("form") {
> 			protected void onSubmit() {
> 				List comments = listView.getList();
> 				listView.modelChanging();
> 				comments.add(new Comment(comment, new Date()));
> 				comment = "";
> 				listView.modelChanged();
> 			}
> 		};
> Perform the steps:
> 1) add "a" to the ListView and submit, bringing the page to version 1.
> 2) add "b" to the ListView and submit, bringing the page to version 2.
> 3) add "c" to the ListView and submit, bringing the page to version 3.
> 4) press Back twice.
> 5) add "x" to the ListView and submit. This will try to revert the page back to version 1. But it will fail with an IllegalStateException (full stack trace is shown below).
> This is because at step 3, the ListView contains two items: "a" and "b". Calling modelChanging() will store the model (a list containing "a" and "b") into a ModelChange object for later undo. The problem is, when this action is undone, ModelChange.undo() will call setModel() on the ListView, which will call removeAll() on itself. This will leave the ListView in a state different from the original (containing "a" and "b" items). This is not a problem if the ListView was to be rendered immediately (then it would create the items again). But in this case, the next step is to further undo the adding of item "b". However, the item's parent has just been set to null by removeAll().  This causes Component.remove() to throw an exception.
> Full stack trace is here:
> Unexpected RuntimeException
> Root cause:
> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1, page = <No Page>, path = 1.ListItem]] from null parent!
> at wicket.Component.remove(Component.java:1469)
> at wicket.version.undo.Add.undo(Add.java:81)
> at wicket.version.undo.ChangeList.undo(ChangeList.java:93)
> at wicket.version.undo.UndoPageVersionManager.undo(UndoPageVersionManager.java:217)
> at wicket.version.undo.UndoPageVersionManager.getVersion(UndoPageVersionManager.java:167)
> at wicket.Page.getVersion(Page.java:589)
> at wicket.PageMap.get(PageMap.java:461)
> at wicket.Session.getPage(Session.java:447)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:215)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153)
> at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48)
> at wicket.RequestCycle.step(RequestCycle.java:992)
> at wicket.RequestCycle.steps(RequestCycle.java:1084)
> at wicket.RequestCycle.request(RequestCycle.java:454)
> at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
> at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WICKET-349) ListView can't undo changes to model

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-349.
----------------------------------

    Resolution: Fixed

> ListView can't undo changes to model
> ------------------------------------
>
>                 Key: WICKET-349
>                 URL: https://issues.apache.org/jira/browse/WICKET-349
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.5
>         Environment: WinXP, Tomcat 5.5.
>            Reporter: Kent Tong
>             Fix For: 1.2.6, 1.3
>
>
> Given the code below (adapted from the guestbook example):
> 		Form form = new Form("form") {
> 			protected void onSubmit() {
> 				List comments = listView.getList();
> 				listView.modelChanging();
> 				comments.add(new Comment(comment, new Date()));
> 				comment = "";
> 				listView.modelChanged();
> 			}
> 		};
> Perform the steps:
> 1) add "a" to the ListView and submit, bringing the page to version 1.
> 2) add "b" to the ListView and submit, bringing the page to version 2.
> 3) add "c" to the ListView and submit, bringing the page to version 3.
> 4) press Back twice.
> 5) add "x" to the ListView and submit. This will try to revert the page back to version 1. But it will fail with an IllegalStateException (full stack trace is shown below).
> This is because at step 3, the ListView contains two items: "a" and "b". Calling modelChanging() will store the model (a list containing "a" and "b") into a ModelChange object for later undo. The problem is, when this action is undone, ModelChange.undo() will call setModel() on the ListView, which will call removeAll() on itself. This will leave the ListView in a state different from the original (containing "a" and "b" items). This is not a problem if the ListView was to be rendered immediately (then it would create the items again). But in this case, the next step is to further undo the adding of item "b". However, the item's parent has just been set to null by removeAll().  This causes Component.remove() to throw an exception.
> Full stack trace is here:
> Unexpected RuntimeException
> Root cause:
> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1, page = <No Page>, path = 1.ListItem]] from null parent!
> at wicket.Component.remove(Component.java:1469)
> at wicket.version.undo.Add.undo(Add.java:81)
> at wicket.version.undo.ChangeList.undo(ChangeList.java:93)
> at wicket.version.undo.UndoPageVersionManager.undo(UndoPageVersionManager.java:217)
> at wicket.version.undo.UndoPageVersionManager.getVersion(UndoPageVersionManager.java:167)
> at wicket.Page.getVersion(Page.java:589)
> at wicket.PageMap.get(PageMap.java:461)
> at wicket.Session.getPage(Session.java:447)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:215)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153)
> at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48)
> at wicket.RequestCycle.step(RequestCycle.java:992)
> at wicket.RequestCycle.steps(RequestCycle.java:1084)
> at wicket.RequestCycle.request(RequestCycle.java:454)
> at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
> at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (WICKET-349) ListView can't undo changes to model

Posted by "Kent Tong (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kent Tong reopened WICKET-349:
------------------------------


This bug is still there in 1.2.6.

> ListView can't undo changes to model
> ------------------------------------
>
>                 Key: WICKET-349
>                 URL: https://issues.apache.org/jira/browse/WICKET-349
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.5
>         Environment: WinXP, Tomcat 5.5.
>            Reporter: Kent Tong
>             Fix For: trunk, 1.2.6
>
>
> Given the code below (adapted from the guestbook example):
> 		Form form = new Form("form") {
> 			protected void onSubmit() {
> 				List comments = listView.getList();
> 				listView.modelChanging();
> 				comments.add(new Comment(comment, new Date()));
> 				comment = "";
> 				listView.modelChanged();
> 			}
> 		};
> Perform the steps:
> 1) add "a" to the ListView and submit, bringing the page to version 1.
> 2) add "b" to the ListView and submit, bringing the page to version 2.
> 3) add "c" to the ListView and submit, bringing the page to version 3.
> 4) press Back twice.
> 5) add "x" to the ListView and submit. This will try to revert the page back to version 1. But it will fail with an IllegalStateException (full stack trace is shown below).
> This is because at step 3, the ListView contains two items: "a" and "b". Calling modelChanging() will store the model (a list containing "a" and "b") into a ModelChange object for later undo. The problem is, when this action is undone, ModelChange.undo() will call setModel() on the ListView, which will call removeAll() on itself. This will leave the ListView in a state different from the original (containing "a" and "b" items). This is not a problem if the ListView was to be rendered immediately (then it would create the items again). But in this case, the next step is to further undo the adding of item "b". However, the item's parent has just been set to null by removeAll().  This causes Component.remove() to throw an exception.
> Full stack trace is here:
> Unexpected RuntimeException
> Root cause:
> java.lang.IllegalStateException: Cannot remove [MarkupContainer [Component id = 1, page = <No Page>, path = 1.ListItem]] from null parent!
> at wicket.Component.remove(Component.java:1469)
> at wicket.version.undo.Add.undo(Add.java:81)
> at wicket.version.undo.ChangeList.undo(ChangeList.java:93)
> at wicket.version.undo.UndoPageVersionManager.undo(UndoPageVersionManager.java:217)
> at wicket.version.undo.UndoPageVersionManager.getVersion(UndoPageVersionManager.java:167)
> at wicket.Page.getVersion(Page.java:589)
> at wicket.PageMap.get(PageMap.java:461)
> at wicket.Session.getPage(Session.java:447)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolveRenderedPage(DefaultRequestTargetResolverStrategy.java:215)
> at wicket.request.compound.DefaultRequestTargetResolverStrategy.resolve(DefaultRequestTargetResolverStrategy.java:153)
> at wicket.request.compound.AbstractCompoundRequestCycleProcessor.resolve(AbstractCompoundRequestCycleProcessor.java:48)
> at wicket.RequestCycle.step(RequestCycle.java:992)
> at wicket.RequestCycle.steps(RequestCycle.java:1084)
> at wicket.RequestCycle.request(RequestCycle.java:454)
> at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:219)
> at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:262)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
> at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
> at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
> at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:595)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.