Volodymyr Siedlecki created MYFACES-4529:
--------------------------------------------

             Summary: TCK: Spec 1422IT: Improve UISelectMany to Support 
Different Types within a Collection (Including Null)
                 Key: MYFACES-4529
                 URL: https://issues.apache.org/jira/browse/MYFACES-4529
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 4.0.0-RC2, 3.0.2, 2.3-next-M7, 2.3.10
            Reporter: Volodymyr Siedlecki


Original Spec Issue: https://github.com/javaee/javaserverfaces-spec/issues/1422 
(Note: BalusC mentions MyFaces not supporting items of different types)

Mojarra made an improvement to support various different types within a 
collection, and it's now part of the new  TCK 4.0.x TCK. 

See the Spec1422 Bean here: 
https://github.com/jakartaee/faces/blob/4.0.1/tck/faces23/uiinput/src/main/java/ee/jakarta/tck/faces/test/javaee8/uiinput/Spec1422.java#L36
 

There are two issues with the test. 

1) MyFaces fails here due to a NPE - first item in the collection.

{code:java}
Caused by: java.lang.NullPointerException

    at 
org.apache.myfaces.core.api.shared.SharedRendererUtils.getSelectItemsValueConverter(SharedRendererUtils.java:440)

    at 
org.apache.myfaces.renderkit.RendererUtils.findUISelectManyConverter(RendererUtils.java:476)

    at 
org.apache.myfaces.renderkit.html.util.HtmlRendererUtils.findUISelectManyConverterFailsafe(HtmlRendererUtils.java:512)

    at 
org.apache.myfaces.renderkit.html.util.HtmlRendererUtils.findUISelectManyConverterFailsafe(HtmlRendererUtils.java:502)

    at 
org.apache.myfaces.renderkit.html.base.HtmlCheckboxRendererBase.getConverter(HtmlCheckboxRendererBase.java:558)

    at 
org.apache.myfaces.renderkit.html.base.HtmlCheckboxRendererBase.renderCheckboxList(HtmlCheckboxRendererBase.java:166)

    at 
{code}


2) If the null is removed, then the asserts fail as the types are changed.

{code:java}
Caused by: java.lang.ClassCastException: class java.lang.Integer cannot be cast 
to class java.lang.Long (java.lang.Integer and java.lang.Long are in module 
java.base of loader 'bootstrap')

at ee.jakarta.tck.faces.test.javaee8.uiinput.Spec1422.submit(Spec1422.java:48)
{code}


MyFaces updates them to Integers: 

{code:java}
selectedNumbers ArrayList<E>  (id=33727)        
        elementData     Object[7]  (id=33741)   
                [0]     Integer  (id=33743)     
                [1]     Integer  (id=22115)     
                [2]     Integer  (id=33744)     
                [3]     Integer  (id=33745)     
                [4]     Integer  (id=33746)     
                [5]     Integer  (id=33747)     
                [6]     Integer  (id=33748)     
{code}

The spec doesn't seem to outline this as a requirement, but I think it's a 
worthwhile addition.  

https://jakarta.ee/specifications/faces/4.0/apidocs/jakarta/faces/component/uiselectmany



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to