You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "James Vaudry (JIRA)" <ji...@apache.org> on 2008/10/23 23:58:44 UTC
[jira] Created: (WICKET-1890) Palette.onBeforeRender() throws
IllegalArgumentException in cases when Palette is invisible.
Palette.onBeforeRender() throws IllegalArgumentException in cases when Palette is invisible.
--------------------------------------------------------------------------------------------
Key: WICKET-1890
URL: https://issues.apache.org/jira/browse/WICKET-1890
Project: Wicket
Issue Type: Bug
Components: wicket
Affects Versions: 1.3.4
Reporter: James Vaudry
Priority: Minor
Palette.onBeforeRender() conditionally adds components in initFactories() based on the "FLAG_HAS_BEEN_RENDERED".
This is incorrect logic and it results in IllegalArgumentException at times. Instead it should check "FLAG_PREPARED_FOR_RENDER". The difference is that "FLAG_PREPARED_FOR_RENDER" will be true the *first time* onBeforeRender() is called, and no longer after that, which is what was intended. That is not the case for "FLAG_HAS_BEEN_RENDERED", which can be true the first time onBeforeRender() is called and may continue to be true on successive calls in the case when the Palette is invisible/hidden.
This is the opposite of http://issues.apache.org/jira/browse/WICKET-1275. In that bug, invisible palette components were not added, now in this bug, invisible palette components are added more than once. Both bugs deal with invisible palette.
Workaround:
--------------------------------
Subclass Palette.java and override onBeforeRender() as shown:
protected void onBeforeRender() {
super.onBeforeRender();
setFlag(0x1000, true); // Force set FLAG_HAS_BEEN_RENDERED
}
Suggested fix:
--------------------------------
In Palette.java, change the onBeforeRender():
Before:
protected void onBeforeRender()
{
if (!hasBeenRendered()) // change this
{
initFactories();
}
super.onBeforeRender();
}
After:
protected void onBeforeRender()
{
if (!getFlag(FLAG_PREPARED_FOR_RENDER))
{
initFactories();
}
super.onBeforeRender();
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (WICKET-1890) Palette.onBeforeRender() throws
IllegalArgumentException in cases when Palette is invisible.
Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-1890.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.4-RC2
1.3.6
Assignee: Igor Vaynberg
> Palette.onBeforeRender() throws IllegalArgumentException in cases when Palette is invisible.
> --------------------------------------------------------------------------------------------
>
> Key: WICKET-1890
> URL: https://issues.apache.org/jira/browse/WICKET-1890
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.4
> Reporter: James Vaudry
> Assignee: Igor Vaynberg
> Priority: Minor
> Fix For: 1.3.6, 1.4-RC2
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> Palette.onBeforeRender() conditionally adds components in initFactories() based on the "FLAG_HAS_BEEN_RENDERED".
> This is incorrect logic and it results in IllegalArgumentException at times. Instead it should check "FLAG_PREPARED_FOR_RENDER". The difference is that "FLAG_PREPARED_FOR_RENDER" will be true the *first time* onBeforeRender() is called, and no longer after that, which is what was intended. That is not the case for "FLAG_HAS_BEEN_RENDERED", which can be true the first time onBeforeRender() is called and may continue to be true on successive calls in the case when the Palette is invisible/hidden.
> This is the opposite of http://issues.apache.org/jira/browse/WICKET-1275. In that bug, invisible palette components were not added, now in this bug, invisible palette components are added more than once. Both bugs deal with invisible palette.
> Workaround:
> --------------------------------
> Subclass Palette.java and override onBeforeRender() as shown:
> protected void onBeforeRender() {
> super.onBeforeRender();
> setFlag(0x1000, true); // Force set FLAG_HAS_BEEN_RENDERED
> }
> Suggested fix:
> --------------------------------
> In Palette.java, change the onBeforeRender():
> Before:
> protected void onBeforeRender()
> {
> if (!hasBeenRendered()) // change this
> {
> initFactories();
> }
> super.onBeforeRender();
> }
> After:
> protected void onBeforeRender()
> {
> if (!getFlag(FLAG_PREPARED_FOR_RENDER))
> {
> initFactories();
> }
> super.onBeforeRender();
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.