MyFaces Core
  1. MyFaces Core
  2. MYFACES-3049

Bean Validation doesn't work with Glassfish el-impl-2.2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: JSR-314
    • Labels:
      None
    • Environment:
      Tomcat 2.0.29

      Description

      I have this expression in my Facelet: #

      {newPaymentBean.payment.toAccount}

      "payment" resolves to the following:

      @Entity
      public class Payment implements Serializable

      { // More stuff... @NotNull @AccountNumber private String toAccount; // More stuff... }

      When debugging in javax.faces.validator._BeanValidatorUELUtils, I noticed the following on line 47 "ValueReference valueReference = valueExpression.getValueReference(elCtx);":

      • With Glassfish EL, "valueReference.property" is null. This causes the BeanValidator to return at line 161, and to skip validation. "valueReference.base" points to the Payment object btw.
      • With JUEL 2.2.3, "valueReference.property" is "toAccount", which is correct AFAIK.

      I'm not sure whether this is a MyFaces or EL issue. I remember that when I wrote the BeanValidator, that the spec literally said what to do. See: http://javaserverfaces.java.net/nonav/docs/2.0/javadocs/javax/faces/validator/BeanValidator.html#validate(javax.faces.context.FacesContext, javax.faces.component.UIComponent, java.lang.Object)

      So I guess this is an EL implementation issue, but I filed it nevertheless, at least for archiving purposes...

      WDYT?

        Activity

        Hide
        Jan-Kees van Andel added a comment -

        Fixed. Added the check, fallback and warning as discussed with Jakob.

        Show
        Jan-Kees van Andel added a comment - Fixed. Added the check, fallback and warning as discussed with Jakob.
        Hide
        Jakob Korherr added a comment -

        +1 !

        Show
        Jakob Korherr added a comment - +1 !
        Hide
        Jan-Kees van Andel added a comment -

        Yep, you're right. And I guess we should log a warning (maybe once, to prevent trashing the log) to show the user that something is wrong with the configuration (b/c it also hurts performance).

        Show
        Jan-Kees van Andel added a comment - Yep, you're right. And I guess we should log a warning (maybe once, to prevent trashing the log) to show the user that something is wrong with the configuration (b/c it also hurts performance).
        Hide
        Jakob Korherr added a comment -

        Yes, but it should work anyway. This check would just come after the fallback.

        Show
        Jakob Korherr added a comment - Yes, but it should work anyway. This check would just come after the fallback.
        Hide
        Jan-Kees van Andel added a comment -

        Not sure if we can do this. You added a null-check already to prevent BV to validate for example Collections. So adding this fallback will probably break this, right?

        Show
        Jan-Kees van Andel added a comment - Not sure if we can do this. You added a null-check already to prevent BV to validate for example Collections. So adding this fallback will probably break this, right?
        Hide
        Jakob Korherr added a comment -

        I totally agree that this is an EL impl bug!

        However, we can maybe implement a fallback to the "legacy" el-1.0 mechanism (via dummy el-resolver) if el-2.2 returns null..

        Show
        Jakob Korherr added a comment - I totally agree that this is an EL impl bug! However, we can maybe implement a fallback to the "legacy" el-1.0 mechanism (via dummy el-resolver) if el-2.2 returns null..

          People

          • Assignee:
            Jan-Kees van Andel
            Reporter:
            Jan-Kees van Andel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development