12 Replies Latest reply on Feb 13, 2014 10:01 AM by laszlovandenhoek

    Regression from CR1: ELResolver problem

    vrelits

      Hi!

       

      I get this error with final. Works with CR1:

       

      javax.el.ELException: Cannot determine property for expression #{adminLogController.form.levels[level]}
      at org.richfaces.el.ValueExpressionAnalayserImpl.resolveValue(ValueExpressionAnalayserImpl.java:75)
      at org.richfaces.el.ValueExpressionAnalayserImpl.updateValueAndGetPropertyDescriptor(ValueExpressionAnalayserImpl.java:92)
      at org.richfaces.validator.BeanValidatorServiceImpl.validateExpression(BeanValidatorServiceImpl.java:157)
      at org.richfaces.validator.FacesBeanValidator.validate(FacesBeanValidator.java:110)
      at javax.faces.component.UIInput.validateValue(UIInput.java:1147)
      at javax.faces.component.UIInput.validate(UIInput.java:965)
      at javax.faces.component.UIInput.executeValidate(UIInput.java:1209)
      at javax.faces.component.UIInput.processValidators(UIInput.java:698)
      at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:513)
      at com.sun.faces.facelets.component.UIRepeat.processValidators(UIRepeat.java:740)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1085)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1085)
      at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1085)

       

      Here is the form:

       

      public Map<LogLevel, Boolean> getLevels() {

              return levels;

          }

       

          public void setLevels(Map<LogLevel, Boolean> levels) {

              this.levels = levels;

          }

       

      It works with CR1 but not with Final.

       

      Creates the checkboxes like this:

       

      <ui:repeat value="#{adminLogController.form.allLevels}" var="level">

                       <h:selectBooleanCheckbox id="level" value="#{adminLogController.form.levels[level]}"/>

                        <h:outputLabel value="#{level}" for="level"/>

      </ui:repeat>

        • 1. Regression from CR1: ELResolver problem
          ilya_shaikovsky

          please past complete page code.

          • 2. Regression from CR1: ELResolver problem
            vrelits

            Complete page:

             

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml"

                  xmlns:h="http://java.sun.com/jsf/html"

                  xmlns:ui="http://java.sun.com/jsf/facelets"

                  xmlns:rich="http://richfaces.org/rich"

                  xmlns:f="http://java.sun.com/jsf/core">

             

            <ui:composition template="/template/layout.xhtml">

                <ui:define name="title">#{dps_msgs['adminlog.title']}</ui:define>

                <ui:define name="body">

                    <h:form>

                        <rich:collapsiblePanel header="#{dps_msgs['filter']}" switchType="ajax" expanded="false">

                            <rich:graphValidator value="#{adminLogController.form}" id="gv">

                                <rich:messages for="gv"/>

                                <h:panelGrid columns="2">

                                    <h:outputLabel value="#{dps_msgs['from']}" for="from"/>

                                    <h:panelGroup>

                                        <rich:calendar id="from" value="#{adminLogController.form.from}" enableManualInput="true"

                                                       datePattern="dd.MM.yyyy"/>

                                        <rich:message for="from"/>

                                    </h:panelGroup>

                                    <h:outputLabel value="#{dps_msgs['to']}" for="to"/>

                                    <h:panelGroup>

                                        <rich:calendar id="to" value="#{adminLogController.form.to}" enableManualInput="true"

                                                       datePattern="dd.MM.yyyy"/>

                                        <rich:message for="to"/>

                                    </h:panelGroup>

                                    <h:outputLabel value="#{dps_msgs['level']}"/>

                                    <h:panelGroup id="levels">

                                        <ui:repeat value="#{adminLogController.form.allLevels}" var="level">

                                            <h:selectBooleanCheckbox id="level" value="#{adminLogController.form.levels[level]}"/>

                                            <h:outputLabel value="#{level}" for="level"/>

                                        </ui:repeat>

                                        <h:graphicImage value="/gfx/checkall.png">

                                            <f:ajax event="click" listener="#{adminLogController.form.selectLevelsListener}" render="levels"

                                                    execute="@this" immediate="true"/>

                                        </h:graphicImage>

                                        <h:graphicImage value="/gfx/uncheckall.png">

                                            <f:ajax event="click" listener="#{adminLogController.form.unSelectLevelsListener}" render="levels"

                                                    execute="@this" immediate="true"/>

                                        </h:graphicImage>

                                    </h:panelGroup>

                                    <h:outputLabel value="#{dps_msgs['environment']}" for="environment"/>

                                    <h:panelGroup>

                                        <h:selectOneMenu id="environment" value="#{adminLogController.form.environment}">

                                            <f:selectItems value="#{environmentHelper.allEnvironments}"/>

                                        </h:selectOneMenu>

                                        <rich:message for="environment"/>

                                    </h:panelGroup>

                                </h:panelGrid>

                            </rich:graphValidator>

                            <h:commandButton value="#{dps_msgs['update']}" action="#{adminLogController.updatedFilter}"/>

                        </rich:collapsiblePanel>

                    </h:form>

             

                    <rich:dataTable value="#{adminLogController.adminLogs}" var="deployment">

                        <rich:column>

                            <f:facet name="header">

                                <h:outputText value="#{dps_msgs['timestamp']}"/>

                            </f:facet>

                            <h:outputText value="#{deployment.timestamp}">

                                <f:convertDateTime pattern="#{dps_msgs['timestamp.format']}"/>

                            </h:outputText>

                        </rich:column>

                        <rich:column>

                            <f:facet name="header">

                                <h:outputText value="#{dps_msgs['level']}"/>

                            </f:facet>

                            <h:outputText value="#{deployment.level}"/>

                        </rich:column>

                        <rich:column>

                            <f:facet name="header">

                                <h:outputText value="#{dps_msgs['environment']}"/>

                            </f:facet>

                            <h:outputText value="#{deployment.environment}"/>

                        </rich:column>

                        <rich:column>

                            <f:facet name="header">

                                <h:outputText value="#{dps_msgs['message']}"/>

                            </f:facet>

                            <h:outputText value="#{deployment.message}"/>

                        </rich:column>

                        <rich:column>

                            <f:facet name="header">

                                <h:outputText value="#{dps_msgs['user']}"/>

                            </f:facet>

                            <h:outputText value="#{deployment.user}"/>

                        </rich:column>

                    </rich:dataTable>

                </ui:define>

            </ui:composition>

            </html>

            • 3. Regression from CR1: ELResolver problem
              ilya_shaikovsky

              <h:form>

                                  <ui:repeat var="lev" value="#{userBean.allLevels}">

                                            <h:selectBooleanCheckbox value="#{userBean.levelsMap[lev]}" />

                                  </ui:repeat>

                                  <h:commandButton value="Submit"  />

                        </h:form>

               

              and

               

                  private Map<String, Boolean> levelsMap;

                  private List<String> allLevels;

                 

                  public UserBean() {

                      super();

                      allLevels = new ArrayList<String>();

                      levelsMap = new HashMap<String, Boolean>();

                     

                      allLevels.add("error");

                      allLevels.add("warn");

                      levelsMap.put("error", true);

                      levelsMap.put("warn", true);

                     

                  }

               

              works for me with latest code.

               

              Double-check that no other changes were made togetehr with RF update.

              • 4. Regression from CR1: ELResolver problem
                vrelits

                I have reverified that if only change is from CR1 to Final it does not work.

                 

                The funny thing is that I have very similar code in another page and that works fine.

                 

                It is difficult for me too see any difference between the one that works and the one that doesn't.

                • 5. Regression from CR1: ELResolver problem
                  vrelits

                  See screen dump below:

                   

                  In first iteration base of LocalRef is HashMap (size 4) representing my 4 checkboxes.

                   

                  But in next interation localReference.next() will return "level" as you can see in screendump.

                   

                  Level has base=null and the will exit in next iteration (return null) and I will get error.

                   

                  It seems to me the "level" comes from ui:repeat.

                   

                  Still confused about what's really going on because I have code like this that works.

                   

                  debug.gif

                  • 6. Regression from CR1: ELResolver problem
                    vrelits

                    A little bump here. Still not sure if I'm doing anything wrong as it worked in CR1 and the code seems to have changed a lot between CR1 and Final.

                    • 7. Regression from CR1: ELResolver problem
                      lfryc

                      Hi Jesper, have you tried to see differences when debugging the same code location causing errors when using CR1 and when using Final?

                      • 8. Regression from CR1: ELResolver problem
                        vrelits

                        Yes, I've tried that but the codebase seems so different that it didn't make me any wiser. Just again showed that it works in CR1.

                        • 9. Regression from CR1: ELResolver problem
                          vrelits

                          The problem only arises if I use rich:grapValidator. If I remove that it works.

                          • 10. Regression from CR1: ELResolver problem
                            ilya_shaikovsky
                            A little bump here. Still not sure if I'm doing anything wrong as it worked in CR1 and the code seems to have changed a lot between CR1 and Final.

                            version could not be the reason if we talking about

                             

                            The funny thing is that I have very similar code in another page and that works fine.

                            It is difficult for me too see any difference between the one that works and the one that doesn't.

                            if you will create small localized sample to run locally - it will be very helpfull to resolve faster.

                            • 11. Re: Regression from CR1: ELResolver problem
                              vrelits

                              I've now made a small example to show error. Just deployed to Tomcat 7. src and libs are seperate (and need to be build into war)

                               

                              Again: the error only show when graphValidator is used.

                              • 12. Re: Regression from CR1: ELResolver problem
                                laszlovandenhoek

                                Hi Jesper,

                                 

                                I think I'm running into this problem myself right now, with RF 4.3.2.Final. Like yourself I am using a rich:graphValidator around a ui:repeat around a Map<? extends Enum,Boolean>.

                                 

                                Have you found a way around this?

                                 

                                Edit: my workaround has been to simply remove the rich:graphValidator and use programmatic validation:

                                 

                                Validator validator = Validation.buildDefaultValidatorFactory().getValidator();

                                final Set<ConstraintViolation<T>> violations = validator.validate(object);

                                 

                                Thanks,

                                 

                                László