[ 
https://issues.apache.org/jira/browse/WICKET-622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502286
 ] 

Johan Compagner commented on WICKET-622:
----------------------------------------

in 1.3 its already safe:


                if (detailed)
                {
                        final Page page = findPage();
                        if (page == null)
                        {
                                return new StringBuffer("[Component id = 
").append(getId()).append(
                                                ", page = <No Page>, path = 
").append(getPath()).append(".").append(
                                                
Classes.simpleName(getClass())).append("]").toString();
                        }
                        else
                        {
                                return new StringBuffer("[Component id = 
").append(getId()).append(", page = ")
                                                
.append(getPage().getClass().getName()).append(", path = ").append(
                                                                
getPath()).append(".").append(Classes.simpleName(getClass()))
                                                .append(", isVisible = 
").append((isRenderAllowed() && isVisible()))
                                                .append(", isVersioned = 
").append(isVersioned()).append("]").toString();
                        }
                }
                else
                {
                        return "[Component id = " + getId() + "]";
                }
        
so if we don't find a page many things are not called.

> Component.toString() is unsafe 
> -------------------------------
>
>                 Key: WICKET-622
>                 URL: https://issues.apache.org/jira/browse/WICKET-622
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.2
>            Reporter: Nili Adoram
>
> I add a component to its container when the page is initialized, BEFORE
> it is rendered and before page model finished to initialize.
> if log4j is configured to enable wicket debug, the container toString()
> is called.
> This method invokes isVisible() of the container.
> I have overridden isVisible(), to query the page model before deciding
> whether the component is actually visible.
> I assumed this method is called when the component is rendered, and by
> that time the model is completely initialized.
> However, since it was called before component rendering, my code failed
> and the page failed to be created.
> To sum up, toString() of Component should be safe.

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

Reply via email to