[jboss-jira] [JBoss JIRA] (DROOLS-1015) Wrong MvelConstraint compilation with Unicode class name and the same name property

Toshiya Kobayashi (JIRA) issues at jboss.org
Fri Jan 8 04:02:00 EST 2016


     [ https://issues.jboss.org/browse/DROOLS-1015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Toshiya Kobayashi updated DROOLS-1015:
--------------------------------------
    Workaround Description: 
* A. Add "this." to the property. for example, ( 住所 != null ) -> ( this.住所 != null )
or
* B. Use a different property name from class name

  was:
A. Add "this." to the property. for example, ( 住所 != null ) -> ( this.住所 != null )
or
B. Use a different property name from class name



> Wrong MvelConstraint compilation with Unicode class name and the same name property
> -----------------------------------------------------------------------------------
>
>                 Key: DROOLS-1015
>                 URL: https://issues.jboss.org/browse/DROOLS-1015
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 6.3.0.Final
>            Reporter: Toshiya Kobayashi
>            Assignee: Mario Fusco
>             Fix For: 7.0.0.Final
>
>
> If a fact has a property of Unicode class name (e.g. 住所) and the property name is the same (住所), constraint is not correctly compiled by MVEL. Internally, AbstractParser.createPropertyToken() misunderstands the property as a class name literal.
> {code:java}
> public class I18nPerson implements Serializable {
>     private 住所 住所; // "address" in Japanese
>     public 住所 get住所() {
>         return 住所;
>     }
>     ....
> {code}
> {noformat}
> when
>   p : I18nPerson( 住所 != null )
> {noformat}
> This constraint is always evaluated to "true".
> Essentially, this is not only a problem of Unicode. We can reproduce the issue by a capitalized property name.
> {code:java}
> public class Person implements Serializable {
>     private Address address;
>     public Address getAddress() {
>         return address;
>     }
>     ....
> {code}
> {noformat}
> when
>   p : I18nPerson( Address != null )
> {noformat}
> Of course we should use lower case letters here from JavaBeans point of view so we don't hit this issue with English usually. But some languages like Japanese cannot express "lower case/upper case" so result in this issue.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)



More information about the jboss-jira mailing list