Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-221

Sporadic undefined property error caused by NPE at MapGetExecutor.tryInvoke()

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      I'm getting sporadic undefined property error when accessing hashmap by a key. The stack trace tells the cause is NPE in MapGetExecutor.tryInvoke() at the following line:

              if (obj != null && method != null
                      && objectClass.equals(obj.getClass())
                      && (key == null || property.getClass().equals(key.getClass()))) {
      

      I have managed to overcome this issue by adding the following null check:

              if (obj != null && method != null
                      && objectClass.equals(obj.getClass())
                      && (key == null || property != null && property.getClass().equals(key.getClass()))) {
      

      I have only vague understanding of how things work inside jexl with tryInvoke() and unfortunately can not provide any test case for this, but it has worked in my case, so if nobody have any objections please include the fix in source tree.

      Thanks!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                henrib Henri Biestro
                Reporter:
                dmitri_blinov Dmitri Blinov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: