myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Kitching (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1760) Using "getSelectedValues" of "UISelectMany" seems to be causing "ClassCastException"
Date Wed, 07 Nov 2007 17:02:50 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-1760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540802
] 

Simon Kitching commented on MYFACES-1760:
-----------------------------------------

Yes, but  my point was that it is not clear whether the fix is to
(a) convert list to array in getSelectedValues, or
(b) report an error if the valueBinding points to a non-array. This error check would need
to be done early (not just in getSelectedValues).

I agree the current setup is inconsistent.

> Using "getSelectedValues" of "UISelectMany" seems to be causing "ClassCastException"
> ------------------------------------------------------------------------------------
>
>                 Key: MYFACES-1760
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1760
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.5
>            Reporter: Guy Bashan
>
> It seems like calling getSelectedValues method of selectBooleanCheckbox causes exception.
> This is an example for a fregment of code:
> ---------------------------------------------------------
>                             <t:selectManyCheckbox value="#{test_scope.targetPagePhysicals}"
layout="pageDirection" converter="PagePhysicalConverter" binding="#{test_scope.htmlSelect}">
>                               <f:selectItems value="#{test_scope.pagePhysicals}" />
>                             </t:selectManyCheckbox>
>                             <t:commandButton value="submitTargetPages" style="width:100px"
immediate="true" onclick="submit()" forceId="true" actionListener="#{test_scope.targetPagesSelectedAction}"
/>
> In the bean:
> ----------------
>   public void targetPagesSelectedAction(ActionEvent event)
>   {
>     Object[] xx = htmlSelect.getSelectedValues();
>     FacesContext.getCurrentInstance().renderResponse();
>   }
> Causes the following exception:
> -------------------------------------------
> javax.servlet.ServletException: Exception while invoking expression #{test_scope.targetPagesSelectedAction}
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:154)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:46)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.shale.faces.ShaleApplicationFilter.doFilter(ShaleApplicationFilter.java:285)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at com.amadesa.admin.model.persistence.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:149)
> 	at com.amadesa.admin.model.persistence.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:56)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
> 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
> 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
> 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{test_scope.targetPagesSelectedAction}
> 	at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
> 	at javax.faces.component.UICommand.broadcast(UICommand.java:89)
> 	at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
> 	at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:139)
> 	at org.apache.myfaces.lifecycle.ApplyRequestValuesExecutor.execute(ApplyRequestValuesExecutor.java:32)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
> 	at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
> 	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
> 	... 25 more
> Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to [Ljava.lang.Object;
> 	at javax.faces.component.UISelectMany.getSelectedValues(UISelectMany.java:48)
> 	at com.amadesa.admin.view.bean.test.TestScopeBean.targetPagesSelectedAction(TestScopeBean.java:166)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
> 	... 32 more

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


Mime
View raw message