Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4479

Ognl can't access static field on enum

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.3.20
    • 2.5
    • Expression Language

    Description

      You can use an ognl expression to access a static field or an enum field, but you can't access a static field on an enum.

      @com.myco.MyEnum@MY_STATIC_FIELD

      blows up with:
      Caused by: java.lang.IllegalArgumentException: No enum constant com.myco.MyEnum.MY_STATIC_FIELD

      OgnlRuntime.getStaticField() needs to check for both enum field name and static field name for enums.

      This is particularly annoying now with ognl static method invocation deprecated.

      Attachments

        Issue Links

          Activity

            People

              aleksandr-m Aleksandr Mashchenko
              perfnorm Jasper Rosenberg
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: