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

Woonsan Ko updated JEXL-144:
----------------------------

    Attachment: jexl3-empty-array-patch.txt
                jexl2-empty-array-patch.txt

Attaching patches:
- jexl2-empty-array-patch.txt for 2.0 branch
- jexl3-empty-array-patch.txt for trunk

All the internal method cache objects (ClassMap, MethodMap, MethodKey, etc) do 
not have the argument information. So, they cannot detect if the property value 
argument is an empty array.
Therefore, the most proper location to improve is PropertySetExecutor.java, 
IMHO, where methods are looked up by the input argument and its type.

Basically, PropertySetExecutor now finds an array setter method by the method 
name if no proper method was found yet.
And, it invokes the detected method with a newly created empty array object 
later by the detected array component type.

Please review the patches.

Thanks in advance,

Woonsan

> Empty array property setting fails
> ----------------------------------
>
>                 Key: JEXL-144
>                 URL: https://issues.apache.org/jira/browse/JEXL-144
>             Project: Commons JEXL
>          Issue Type: Bug
>            Reporter: Woonsan Ko
>             Fix For: 2.1.2, 3.0
>
>         Attachments: jexl2-empty-array-patch.txt, jexl3-empty-array-patch.txt
>
>
> Suppose a bean has an array property setter method (e.g, public void 
> setStrarr(String []) ).
> If I use an expression like this with an empty array, then it fails with the 
> error message, "inaccessible or unknown property strarr".
>   // example expression
>   bean.strarr = [ ];



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to