Bug 1269366 - Indexing DRL related files logs null error instead of real cause
Indexing DRL related files logs null error instead of real cause
Status: VERIFIED
Product: JBoss BRMS Platform 6
Classification: JBoss
Component: Business Central (Show other bugs)
6.1.0
Unspecified Unspecified
high Severity high
: ER5
: 6.2.0
Assigned To: manstis
Jiri Locker
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-07 02:19 EDT by Hisao Furuichi
Modified: 2015-11-16 12:50 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hisao Furuichi 2015-10-07 02:19:46 EDT
Description of problem:
When I save a new asset which name contains [0-9]_[0-9], ERROR message will be logged.

Version-Release number of selected component (if applicable):
6.1.3

Steps to Reproduce:
1. On business-central, create a new DRL file named "1_1"
 rule 1_1
  when
  then
   System.out.println("1_1");
 end
2. save the drl file

Actual results:
Error message is logged
===
11:20:44,429 ERROR [org.drools.workbench.screens.drltext.backend.server.indexing.DrlFileIndexer] (EJB default - 3) Unable to index 'default://master@repository1/case01516298/src/main/resources/example/case01516298/1_1.drl'.
===

Expected results:
An asset can be saved without any ERROR
Comment 1 manstis 2015-10-14 06:27:27 EDT
The root cause is that Drools Compiler fails to populate the RuleDescr's rule name when such matches the given pattern. I have written a (failing) unit test and submitted as PR: https://github.com/droolsjbpm/drools/pull/509.
Comment 2 Mario Fusco 2015-10-14 10:30:26 EDT
The rule name has either to be a valid variable ID (i.e. starting with a letter and having no spaces) or to be wrapped between quotes. This means that for instance both this

rule a_a when ...

and this

rule "1_1" when ...

are valid rule names. Conversely when you try to do something like

rule 1_1 when ...

as expected the compiler produces a compilation error like the following 

[2,5]: [ERR 102] Line 2:5 mismatched input '1' in rule

Finally also note that this issue is totally unrelated with the presence of an underscore in the name of the rule.
Comment 3 manstis 2015-10-15 06:04:03 EDT
OK, so given Mario's comment and some further investigation the issue is that indexing of DRL related files (e.g. DRL rules, Guided Rules etc) fails a "null assertion" when trying to build the index as, in this specific case, 1_1 is not a valid rule identifier leading to a null rule name.

I have improved indexing of DRL related files to prevent the misleading null assertion error being logged. The real error is logged now.
Comment 6 Jiri Locker 2015-11-16 12:46:00 EST
org.drools.workbench.screens.drltext.backend.server.indexing.DrlFileIndexer logging has been improved when saving an invalid rule. It now logs the parse error instead of dumping the IllegalArgumentException.

Before:
Unable to index 'default://master@uf-playground/mortgages/src/main/resources/org/mortgages/Dummy%20rule.drl'.: java.lang.IllegalArgumentException: Parameter named 'ruleName' should be not null!

After:
Unable to parse DRL for 'default://master@uf-playground/mortgages/src/main/resources/org/mortgages/Dummy%20rule.drl'.
[ERR 102] Line 12:5 mismatched input '1' in rule

No change in UI. The parse error is visible in Messages panel.

Note You need to log in before you can comment on or make changes to this bug.