Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-14102

orderingList, pickList: @collectionType can only be a String

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.5.9
    • Component/s: None
    • Labels:
      None
    • Environment:

      Metamer 4.5.8-SNAPSHOT
      Tried with FF38, WildFly 8.2.0/Tomcat 8.0.26

    • Steps to Reproduce:
      Hide

      Can be reproduced in Metamer:

      1. deploy Metamer and open http://127.0.0.1:8080/metamer/faces/components/richOrderingList/simple.xhtml
      2. set @collectionType to class-LinkedList
      3. submit the list with button before the pickList
        • have: exception like in issue description
      Show
      Can be reproduced in Metamer: deploy Metamer and open http://127.0.0.1:8080/metamer/faces/components/richOrderingList/simple.xhtml set @collectionType to class-LinkedList submit the list with button before the pickList have: exception like in issue description

      Description

      VDL DOC says:

      Description: Optional attribute that is a literal string that is the fully qualified class name of a concrete class that implements java.util.Collection, or an EL expression that evaluates to either 1. such a String, or 2. the Class object itself.

      Type: javax.el.ValueExpression (must evaluate to java.lang.String)

      But the second option – referencing a class, is not working. The SelectManyHelper cannot handle such situation, it only works with Strings (e.g. LinkedList.class will result in "class java.util.LinkedList"), and will result in exception.

      You can try this with:

      Bean:

      @ManagedBean(name = "richOrderingListBean")
      @SessionScoped
      public class RichOrderingListBean implements Serializable {
          private static final Class KLASS = java.util.LinkedList.class;
          public Class getCollectionType(){
              return KLASS;
          }
      ...
      }
      

      Facelet:

          <rich:pickList collectionType="#{richOrderingListBean.collectionType}".../>
      

      Will result in exception:

      javax.servlet.ServletException: class java.util.LinkedList
      	javax.faces.webapp.FacesServlet.service(FacesServlet.java:667)
      	org.richfaces.tests.metamer.TestIdentityFilter.doFilter(TestIdentityFilter.java:93)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      
      root cause
      
      java.lang.ClassNotFoundException: class java.util.LinkedList
      	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
      	org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
      	org.richfaces.renderkit.SelectManyHelper.getCollectionClass(SelectManyHelper.java:365)
      	org.richfaces.renderkit.SelectManyHelper.getConvertedValue(SelectManyHelper.java:291)
      	org.richfaces.renderkit.SelectManyRendererBase.getConvertedValue(SelectManyRendererBase.java:112)
      	javax.faces.component.UIInput.getConvertedValue(UIInput.java:1045)
      	javax.faces.component.UIInput.validate(UIInput.java:975)
      	javax.faces.component.UIInput.executeValidate(UIInput.java:1248)
      	javax.faces.component.UIInput.processValidators(UIInput.java:712)
      	javax.faces.component.UIForm.processValidators(UIForm.java:253)
      	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
      	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
      	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1260)
      	javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1195)
      	com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
      	com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
      	javax.faces.webapp.FacesServlet.service(FacesServlet.java:654)
      	org.richfaces.tests.metamer.TestIdentityFilter.doFilter(TestIdentityFilter.java:93)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                jstefek Jiří Štefek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: