glassfish
  1. glassfish
  2. GLASSFISH-17996

ExpressionFactory.createMethodExpression(context, null, null, null) should throw NPE but does not

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Works as designed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: web_container
    • Labels:
      None

      Description

      The assert in this method should be true, but as of 20111130 it is false.

      public void testNullReference(ExpressionFactory ef, ELContext context) {
      boolean exceptionThrown = false;
      try

      { ef.createMethodExpression(context, null, null, null); }

      catch (NullPointerException npe)

      { exceptionThrown = true; }

      // this should be true but it is false.
      assert(exceptionThrown);
      }

        Issue Links

          Activity

          Hide
          Ed Burns added a comment -

          I find that the following argument list to createMethodExpression() should also throw an NPE but no longer does:

          (context, "$

          {foo > 1}

          ", null, null)

          Show
          Ed Burns added a comment - I find that the following argument list to createMethodExpression() should also throw an NPE but no longer does: (context, "$ {foo > 1} ", null, null)
          Hide
          Tom Mueller added a comment -

          Removing 3.1.2 as a Fix Version since 3.1.2 has already shipped.

          Show
          Tom Mueller added a comment - Removing 3.1.2 as a Fix Version since 3.1.2 has already shipped.
          Hide
          kchung added a comment -

          Both test cases are not valid EL method expressions, and the EL compiler throws an ELException with error messages

          (1st case) "Expression cannot be null"
          (2nd case) "Not a Valid Method Expression: #

          {foo>1}

          "

          as it should.

          With a valid method expression, such as "#

          {a.b}

          ", a NPE is thrown, with the message "Parameter types cannot be null", as expected.

          No idea why it behaved differently before, but the current behavior is correct.

          Show
          kchung added a comment - Both test cases are not valid EL method expressions, and the EL compiler throws an ELException with error messages (1st case) "Expression cannot be null" (2nd case) "Not a Valid Method Expression: # {foo>1} " as it should. With a valid method expression, such as "# {a.b} ", a NPE is thrown, with the message "Parameter types cannot be null", as expected. No idea why it behaved differently before, but the current behavior is correct.

            People

            • Assignee:
              kchung
              Reporter:
              Ed Burns
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 days
                2d
                Remaining:
                Remaining Estimate - 2 days
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified