Bug 1269366 - Indexing DRL related files logs null error instead of real cause
Summary: Indexing DRL related files logs null error instead of real cause
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss BRMS Platform 6
Classification: Retired
Component: Business Central
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER5
: 6.2.0
Assignee: manstis
QA Contact: Jiri Locker
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-07 06:19 UTC by Hisao Furuichi
Modified: 2020-03-27 19:12 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-03-27 19:12:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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.


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