Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-1192

DialectUtil.normalizeRuleName() doesn't normalize multibyte rule names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 6.4.0.Final
    • core engine
    • None
    • NEW
    • NEW

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

      package com.sample
      
      rule "rule(hello)"
          when
          then
      end
      

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

      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
      

      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.

            mfusco@redhat.com Mario Fusco
            rhn-support-tkobayas Toshiya Kobayashi
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: