[jboss-jira] [JBoss JIRA] (DROOLS-1192) DialectUtil.normalizeRuleName() doesn't normalize multibyte rule names

Toshiya Kobayashi (JIRA) issues at jboss.org
Wed May 25 01:32:00 EDT 2016


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

Toshiya Kobayashi updated DROOLS-1192:
--------------------------------------
    Description: 
Assuming you have a rule name "rule(hello)",

{noformat}
package com.sample

rule "rule(hello)"
    when
    then
end
{noformat}

Here, ' (' and ')' ...  U+FF08 (FULLWIDTH LEFT PARENTHESIS) and U+FF09 (FULLWIDTH RIGHT PARENTHESIS) are not a Java identifier part. The rule fails to compile.

{noformat}
Rule Compilation error : [Rule name='rule(hello)']
	com/sample/Rule_rule(hello)0.java (3:84) : Syntax error on tokens, delete these tokens
	com/sample/Rule_rule(hello)0.java (3:97) : The public type Rule_rule must be defined in its own file
	com/sample/Rule_rule(hello)0.java (3:115) : Syntax error, insert "}" to complete Block
	com/sample/Rule_rule(hello)0.java (4:121) : Syntax error on tokens, delete these tokens
	com/sample/Rule_rule(hello)0.java (6:187) : Syntax error on token "void", @ expected
	com/sample/Rule_rule(hello)0.java (6:211) : Syntax error on token(s), misplaced construct(s)
	com/sample/Rule_rule(hello)0.java (6:238) : Syntax error on token "throws", @ expected
	com/sample/Rule_rule(hello)0.java (6:255) : Syntax error, insert "enum Identifier" to complete EnumHeader
	com/sample/Rule_rule(hello)0.java (11:332) : Syntax error on token "}", delete this token
{noformat}

But such a non-java identifier part should be normalized by org.drools.compiler.rule.builder.dialect.DialectUtil.normalizeRuleName() during the build. The problem is that DialectUtil.normalizeRuleName() misses to process the name because of NON_ALPHA_REGEX check. NON_ALPHA_REGEX doesn't take account into Unicode characters.


  was:
Assuming you have a rule name "rule (hello)",

{noformat}
package com.sample

rule "rule(hello)"
    when
    then
end
{noformat}

Here, ' (' and ')' ...  U+FF08 (FULLWIDTH LEFT PARENTHESIS) and U+FF09 (FULLWIDTH RIGHT PARENTHESIS) are not a Java identifier part. The rule fails to compile.

{noformat}
Rule Compilation error : [Rule name='rule(hello)']
	com/sample/Rule_rule(hello)0.java (3:84) : Syntax error on tokens, delete these tokens
	com/sample/Rule_rule(hello)0.java (3:97) : The public type Rule_rule must be defined in its own file
	com/sample/Rule_rule(hello)0.java (3:115) : Syntax error, insert "}" to complete Block
	com/sample/Rule_rule(hello)0.java (4:121) : Syntax error on tokens, delete these tokens
	com/sample/Rule_rule(hello)0.java (6:187) : Syntax error on token "void", @ expected
	com/sample/Rule_rule(hello)0.java (6:211) : Syntax error on token(s), misplaced construct(s)
	com/sample/Rule_rule(hello)0.java (6:238) : Syntax error on token "throws", @ expected
	com/sample/Rule_rule(hello)0.java (6:255) : Syntax error, insert "enum Identifier" to complete EnumHeader
	com/sample/Rule_rule(hello)0.java (11:332) : Syntax error on token "}", delete this token
{noformat}

But such a non-java identifier part should be normalized by org.drools.compiler.rule.builder.dialect.DialectUtil.normalizeRuleName() during the build. The problem is that DialectUtil.normalizeRuleName() misses to process the name because of NON_ALPHA_REGEX check. NON_ALPHA_REGEX doesn't take account into Unicode characters.




> DialectUtil.normalizeRuleName() doesn't normalize multibyte rule names
> ----------------------------------------------------------------------
>
>                 Key: DROOLS-1192
>                 URL: https://issues.jboss.org/browse/DROOLS-1192
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 6.4.0.Final
>            Reporter: Toshiya Kobayashi
>            Assignee: Mario Fusco
>
> Assuming you have a rule name "rule(hello)",
> {noformat}
> package com.sample
> rule "rule(hello)"
>     when
>     then
> end
> {noformat}
> Here, ' (' and ')' ...  U+FF08 (FULLWIDTH LEFT PARENTHESIS) and U+FF09 (FULLWIDTH RIGHT PARENTHESIS) are not a Java identifier part. The rule fails to compile.
> {noformat}
> Rule Compilation error : [Rule name='rule(hello)']
> 	com/sample/Rule_rule(hello)0.java (3:84) : Syntax error on tokens, delete these tokens
> 	com/sample/Rule_rule(hello)0.java (3:97) : The public type Rule_rule must be defined in its own file
> 	com/sample/Rule_rule(hello)0.java (3:115) : Syntax error, insert "}" to complete Block
> 	com/sample/Rule_rule(hello)0.java (4:121) : Syntax error on tokens, delete these tokens
> 	com/sample/Rule_rule(hello)0.java (6:187) : Syntax error on token "void", @ expected
> 	com/sample/Rule_rule(hello)0.java (6:211) : Syntax error on token(s), misplaced construct(s)
> 	com/sample/Rule_rule(hello)0.java (6:238) : Syntax error on token "throws", @ expected
> 	com/sample/Rule_rule(hello)0.java (6:255) : Syntax error, insert "enum Identifier" to complete EnumHeader
> 	com/sample/Rule_rule(hello)0.java (11:332) : Syntax error on token "}", delete this token
> {noformat}
> But such a non-java identifier part should be normalized by org.drools.compiler.rule.builder.dialect.DialectUtil.normalizeRuleName() during the build. The problem is that DialectUtil.normalizeRuleName() misses to process the name because of NON_ALPHA_REGEX check. NON_ALPHA_REGEX doesn't take account into Unicode characters.



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



More information about the jboss-jira mailing list