Uploaded image for project: 'Commons OGNL (Dormant)'
  1. Commons OGNL (Dormant)
  2. OGNL-14

Ternary expression, NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.7
    • 2.7
    • ExpressionCompiler
    • None
    • Tapestry 4.1.2-SNAPSHOT (latest)

      OGNL 2.7-SNAPSHOT

    Description

      The following throws a NPE in OGNL 2.7 but not in previous versions:

      test.html:

      <span jwcid="@Insert" value="ognl:(text1 == null) ? 'Empty' : text1.length()"/><br/>

      <span jwcid="@Insert" value="ognl:(text2 == null) ? 'Empty' : text2.length()"/> <------- text2 is null

      test.page:

      <page-specification>

      <property name="text1" initial-value="'text1'"/>

      <property name="text2"/> <------- text2 is null

      </page-specification>

      exception:

      java.lang.NullPointerException: target is null for method length

      at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:963)

      at ognl.ASTMethod.getValueBody(ASTMethod.java:90)

      etc.

      Another thing I noticed is that:

      <span jwcid="@Insert" value="ognl:(text1 == null) ? '1' : text1.length()"/><br/>

      works for the previous OGNL, but not for 2.7

      Best Regards,

      Manri Offermann

      Attachments

        Activity

          People

            jkuhnert Jesse Kuhnert
            moffermann Manri Offermann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: