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
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.
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.
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.
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.