Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4529

TCK: Spec 1422IT: Improve UISelectMany to Support Different Types within a Collection (Including Null)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.10, 2.3-next-M7, 3.0.2, 4.0.0-RC2
    • 4.0.0-RC3
    • None
    • None

    Description

      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.

      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 
      

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

      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)
      

      MyFaces updates them to Integers:

      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)	
      

      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

      Attachments

        Issue Links

          Activity

            People

              volosied Volodymyr Siedlecki
              volosied Volodymyr Siedlecki
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: