You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Maxime Garenne (Jira)" <ji...@apache.org> on 2020/02/26 14:49:00 UTC
[jira] [Updated] (BEANUTILS-533) If expression contains ")",
DefaultResolver #getKey return wrong value
[ https://issues.apache.org/jira/browse/BEANUTILS-533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maxime Garenne updated BEANUTILS-533:
-------------------------------------
Description:
h2. Context
I use BeanUtils to return a map that contain properties.
I had a failure in my code because this property causes a fail in the BeanUtils "getMappedProperty" method :
test(myvalue(ineedthisparenthis))
h2. Explanation
In DefaultResolver #getKey(String expression), if the expression contains a ")", the returned value is incorrect because the algorithm stops at the first ")" character (#indefOf is used).
Instead of using :
{code:java}
final int end = expression.indexOf(MAPPED_END, i);{code}
It would be better to just check if the last character of "expression" is a ")" and then substring between "i+1" and last character index.
Then my example would not fail.
# escape # parenthesis # bracket # DefaultResolver # getKey # expression
was:
h2. Context
I use BeanUtils to return a map that contain properties.
I had a failure in my code because this property causes a fail in the BeanUtils "getMappedProperty" method :
test(myvalue(ineedthisparenthis))
h2. Explanation
In DefaultResolver #getKey(String expression), if the expression contains a ")", the returned value is incorrect because the algorithm stops at the first ")" character (#indefOf is used).
Instead of using :
{code:java}
final int end = expression.indexOf(MAPPED_END, i);{code}
It would be better to just check if the last character of "expression" is a ")" and then substring between "i+1" and last character index.
Then my example would not fail.
> If expression contains ")", DefaultResolver #getKey return wrong value
> ----------------------------------------------------------------------
>
> Key: BEANUTILS-533
> URL: https://issues.apache.org/jira/browse/BEANUTILS-533
> Project: Commons BeanUtils
> Issue Type: Bug
> Components: Bean / Property Utils
> Affects Versions: 1.7.0, 1.8.0, 1.9.0, 1.9.3
> Reporter: Maxime Garenne
> Priority: Blocker
>
> h2. Context
> I use BeanUtils to return a map that contain properties.
> I had a failure in my code because this property causes a fail in the BeanUtils "getMappedProperty" method :
> test(myvalue(ineedthisparenthis))
> h2. Explanation
> In DefaultResolver #getKey(String expression), if the expression contains a ")", the returned value is incorrect because the algorithm stops at the first ")" character (#indefOf is used).
> Instead of using :
> {code:java}
> final int end = expression.indexOf(MAPPED_END, i);{code}
> It would be better to just check if the last character of "expression" is a ")" and then substring between "i+1" and last character index.
> Then my example would not fail.
>
> # escape # parenthesis # bracket # DefaultResolver # getKey # expression
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)