]
Toshiya Kobayashi updated DROOLS-3805:
--------------------------------------
Git Pull Request:
All line separators in RHS in spreadsheet are escaped
-----------------------------------------------------
Key: DROOLS-3805
URL:
https://issues.jboss.org/browse/DROOLS-3805
Project: Drools
Issue Type: Bug
Components: decision tables
Affects Versions: 7.18.0.Final, 7.19.0.Final
Reporter: Toshiya Kobayashi
Assignee: Mario Fusco
Priority: Major
Labels: support
By DROOLS-3396, line separators in RHS are now escaped.
https://github.com/kiegroup/drools/blob/7.18.0.Final/drools-decisiontable...
However, it affects entire RHS so if you have multiple lines in ACTION, the result would
be like this.
Output from SpreadSheetCompiler:
{noformat}
rule "multiple lines in action_12"
when
$fact:Person(name == "John")
then
modify($fact){\n setAge(30),\n setAlive(false)\n}
/* DEBUG */\nSystem.out.println(" ** " +drools.getRule().getName() +
", $fact = " + $fact);
end
{noformat}
Error when building:
{noformat}
line 1:15 no viable alternative at character '\'
line 1:29 no viable alternative at character '\'
line 1:47 no viable alternative at character '\'
line 2:13 no viable alternative at character '\'
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.63 s
<<< FAILURE! - in org.drools.decisiontable.LineBreakXLSTest
[ERROR] testMultipleLinesInAction(org.drools.decisiontable.LineBreakXLSTest) Time
elapsed: 0.257 s <<< ERROR!
java.lang.NullPointerException
at java.lang.String.indexOf(String.java:1718)
at
org.drools.compiler.rule.builder.dialect.DialectUtil.rewriteModifyDescr(DialectUtil.java:631)
at
org.drools.compiler.rule.builder.dialect.DialectUtil.rewriteDescr(DialectUtil.java:580)
at
org.drools.compiler.rule.builder.dialect.DialectUtil.fixBlockDescr(DialectUtil.java:161)
at
org.drools.compiler.rule.builder.dialect.DialectUtil.fixBlockDescr(DialectUtil.java:119)
at
org.drools.compiler.rule.builder.dialect.asm.AbstractASMConsequenceBuilder.consequenceContext(AbstractASMConsequenceBuilder.java:57)
at
org.drools.compiler.rule.builder.dialect.asm.AbstractASMConsequenceBuilder.build(AbstractASMConsequenceBuilder.java:33)
at org.drools.compiler.rule.builder.RuleBuilder.build(RuleBuilder.java:126)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.internalAddRule(KnowledgeBuilderImpl.java:1204)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addRule(KnowledgeBuilderImpl.java:1195)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileRulesLevel(KnowledgeBuilderImpl.java:1173)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileRules(KnowledgeBuilderImpl.java:1121)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileKnowledgePackages(KnowledgeBuilderImpl.java:946)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackage(KnowledgeBuilderImpl.java:937)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addPackageFromDecisionTable(KnowledgeBuilderImpl.java:371)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addKnowledgeResource(KnowledgeBuilderImpl.java:759)
at
org.drools.compiler.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:2288)
at
org.drools.decisiontable.LineBreakXLSTest.testMultipleLinesInAction(LineBreakXLSTest.java:53)
...
{noformat}
Escaping should be done only for literal String?