You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mike Kienenberger (JIRA)" <de...@myfaces.apache.org> on 2006/03/13 17:48:53 UTC

[jira] Commented: (TOMAHAWK-187) ClassCastException using panelTabbedPane in nightly build

    [ http://issues.apache.org/jira/browse/TOMAHAWK-187?page=comments#action_12370207 ] 

Mike Kienenberger commented on TOMAHAWK-187:
--------------------------------------------

Roland,

Excellent!  This is the right direction to go with this patch. 

Nice catch on the saveState/restoreState issue.  I'm surprised that the missing state saving hasn't caused bug reports!

I would recommend this format which returns a boolean instead of a Boolean and also allows setting a constant in the java file when serverSideTabSwitch isn't defined.

    public boolean getServerSideTabSwitch()
    {
        if (_displayValueOnly != null) return _displayValueOnly.booleanValue();
        ValueBinding vb = getValueBinding("displayValueOnly");
        Boolean v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
        return v != null ? v.booleanValue() : DEFAULT_SERVER_SIDE_TAB_SWITCH;
    }

You also need to change isClientSide which currently isn't calling your code.

    public boolean isClientSide(){
        Boolean serverSideTabSwitch = (Boolean)getAttributes().get("serverSideTabSwitch");

        return serverSideTabSwitch != null ? !serverSideTabSwitch.booleanValue() : true;
    }

to

    public boolean isClientSide(){
        return getServerSideTabSwitch();
    }

It'd also be helpful if you'd submit your patches in patch format (unified diff).

-Mike


> ClassCastException using panelTabbedPane in nightly build
> ---------------------------------------------------------
>
>          Key: TOMAHAWK-187
>          URL: http://issues.apache.org/jira/browse/TOMAHAWK-187
>      Project: MyFaces Tomahawk
>         Type: Bug
>   Components: Tabbed Pane
>     Versions: 1.1.2-SNAPSHOT
>     Reporter: Roland Schaal
>  Attachments: HtmlPanelTabbedPane.java
>
> Hello,
> When using 
> serverSideTabSwitch="true"
> I get the following ClassCastException:
> java.lang.ClassCastException
>         at org.apache.myfaces.custom.tabbedpane.HtmlPanelTabbedPane.isClientSide(HtmlPanelTabbedPane.java:142)
>         at org.apache.myfaces.custom.tabbedpane.HtmlTabbedPaneRenderer.encodeEnd(HtmlTabbedPaneRenderer.java:92)
>         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
>         at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
>         at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:419)
>         at org.apache.myfaces.shared_impl.renderkit.html.HtmlGroupRendererBase.encodeEnd(HtmlGroupRendererBase.java:75)
>         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
>         at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
>         at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
> ...
> Looking at the code of HtmlPanelTabbedPane it seems to me that they try to cast a String- into a Boolean-object, which causes the exception:
> public boolean isClientSide(){
> Boolean serverSideTabSwitch = (Boolean)getAttributes().get("serverSideTabSwitch");
> return serverSideTabSwitch != null ? !serverSideTabSwitch.booleanValue() : true;
> }
> Regards,
> Roland Schaal

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira