Gert-Jan Schouten created WICKET-6600:
-----------------------------------------
Summary: Error logging in AjaxRequestHandler is too strict
Key: WICKET-6600
URL: https://issues.apache.org/jira/browse/WICKET-6600
Project: Wicket
Issue Type: Improvement
Components: wicket-core
Affects Versions: 8.0.0
Reporter: Gert-Jan Schouten
As a result of these three commits,
[one|[https://github.com/apache/wicket/commit/dec1293da853357f483eadec4616c9758ea025f9#diff-8964e43671328bf6f9b1d75703103db8],]
[two|[https://github.com/apache/wicket/commit/3be55cf5a24982cfca400225aabb6c4296859a7d#diff-8964e43671328bf6f9b1d75703103db8]|https://github.com/apache/wicket/commit/3be55cf5a24982cfca400225aabb6c4296859a7d#diff-8964e43671328bf6f9b1d75703103db8],]
and
[three|[https://github.com/apache/wicket/commit/830fb15c333ad6099f466b2344a84b513690db86#diff-8964e43671328bf6f9b1d75703103db8],]
Wicket now logs a stacktrace on error level if you add something to the
AjaxRequestTarget that has been removed from the page. I don't think this is a
good idea, because you're not always in control of what happens in an Ajax
call. Imagine, for example, the following scenario:
{code:java}
public abstract class MyPanel extends Panel {
public MyPanel(String id) {
super(id);
this.setOutputMarkupId(true);
this.add(new AjaxLink("myLink") {
public void onClick(final AjaxRequestTarget target) {
this.executeImportantWork(target);
//Display something nice on this Panel
//...
target.add(MyPanel.this); //In order to show the nice things
}
});
}
protected abstract void executeImportantWork(AjaxRequestTarget target);
}
{code}
Now, what if the user of MyPanel actually adds it to the Page and then, in
executeImportantWork, removes it and replaces it with smth else? Then, you get
an error in the log, everytime someone clicks myLink.
In this case, it could be fixed by adding MyPanel.this to the target *before*
calling executeImportantWork, in which case you also get something in the log,
but without stacktrace and on WARN level, namely this: "Component not rendered
because it was already removed from page", but this is far less invasive than
the scary stacktrace on ERROR level.
I suggest changing the level of the message to WARN and removing the stacktrace.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)