Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1269366

Summary: Indexing DRL related files logs null error instead of real cause
Product: [Retired] JBoss BRMS Platform 6 Reporter: Hisao Furuichi <hfuruich>
Component: Business CentralAssignee: manstis
Status: CLOSED EOL QA Contact: Jiri Locker <jlocker>
Severity: high Docs Contact:
Priority: high    
Version: 6.1.0CC: kverlaen
Target Milestone: ER5   
Target Release: 6.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 19:12:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hisao Furuichi 2015-10-07 06:19:46 UTC
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 10:27:27 UTC
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 14:30:26 UTC
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 10:04:03 UTC
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 17:46:00 UTC
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.