You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (Jira)" <ji...@apache.org> on 2021/06/29 07:00:03 UTC

[jira] [Closed] (JEXL-221) Sporadic undefined property error caused by NPE at MapGetExecutor.tryInvoke()

     [ https://issues.apache.org/jira/browse/JEXL-221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro closed JEXL-221.
------------------------------

> Sporadic undefined property error caused by NPE at MapGetExecutor.tryInvoke()
> -----------------------------------------------------------------------------
>
>                 Key: JEXL-221
>                 URL: https://issues.apache.org/jira/browse/JEXL-221
>             Project: Commons JEXL
>          Issue Type: Bug
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Major
>             Fix For: 3.1
>
>
> 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:
> {code}
>         if (obj != null && method != null
>                 && objectClass.equals(obj.getClass())
>                 && (key == null || property.getClass().equals(key.getClass()))) {
> {code}
> I have managed to overcome this issue by adding the following null check:
> {code}
>         if (obj != null && method != null
>                 && objectClass.equals(obj.getClass())
>                 && (key == null || property != null && property.getClass().equals(key.getClass()))) {
> {code}
> 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!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)