2019-04-09 09:46:08.063 [main] ERROR org.flowable.dmn.engine.impl.RuleEngineExecutorImpl -
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
decision table execution failed
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
org.flowable.common.engine.api.FlowableException: Error parsing '#{input1 == >19 }': syntax error at position 13, encountered '>', expected <IDENTIFIER>|<STRING>|<FLOAT>|<INTEGER>|'true'|'false'|'null'|'-'|'!'|'not'|'empty'|'('
at com.asiainfo.cloud.service.FirstDmn.main(FirstDmn.java:38)
at org.flowable.dmn.engine.impl.RuleEngineExecutorImpl.executeRule(RuleEngineExecutorImpl.java:237)
at org.flowable.dmn.engine.impl.RuleEngineExecutorImpl.evaluateDecisionTable(RuleEngineExecutorImpl.java:153)
at org.flowable.dmn.engine.impl.RuleEngineExecutorImpl.execute(RuleEngineExecutorImpl.java:94)
at org.flowable.dmn.engine.impl.cmd.ExecuteDecisionCmd.execute(ExecuteDecisionCmd.java:63)
at org.flowable.dmn.engine.impl.cmd.ExecuteDecisionCmd.execute(ExecuteDecisionCmd.java:31)
at org.flowable.common.engine.impl.interceptor.DefaultCommandInvoker.execute(DefaultCommandInvoker.java:22)
at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53)
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71)
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51)
at org.flowable.dmn.engine.impl.DmnRuleServiceImpl.executeDecisionByKey(DmnRuleServiceImpl.java:40)
at com.asiainfo.cloud.service.FirstDmn.main(FirstDmn.java:37)
Caused by: org.flowable.common.engine.impl.de.odysseus.el.tree.TreeBuilderException: Error parsing '#{input1 == >19 }': syntax error at position 13, encountered '>', expected <IDENTIFIER>|<STRING>|<FLOAT>|<INTEGER>|'true'|'false'|'null'|'-'|'!'|'not'|'empty'|'('
at org.flowable.common.engine.impl.de.odysseus.el.tree.impl.Builder.build(Builder.java:110)
at org.flowable.common.engine.impl.de.odysseus.el.tree.TreeStore.get(TreeStore.java:61)
at org.flowable.common.engine.impl.de.odysseus.el.TreeValueExpression.<init>(TreeValueExpression.java:70)
at org.flowable.common.engine.impl.de.odysseus.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:444)
at org.flowable.common.engine.impl.de.odysseus.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:77)
at org.flowable.common.engine.impl.el.DefaultExpressionManager.createExpression(DefaultExpressionManager.java:88)
at org.flowable.dmn.engine.impl.el.ELExpressionExecutor.executeInputExpression(ELExpressionExecutor.java:52)
at org.flowable.dmn.engine.impl.RuleEngineExecutorImpl.executeInputExpressionEvaluation(RuleEngineExecutorImpl.java:259)
at org.flowable.dmn.engine.impl.RuleEngineExecutorImpl.executeRule(RuleEngineExecutorImpl.java:219)
... 12 common frames omitted
解决:
看org.flowable.dmn.engine.impl.el.ELInputEntryExpressionPreParser.java
protected static String[] OPERATORS = new String[]{"==", "!=", "<", ">", ">=", "<="};
protected static String parseSegmentWithOperator(String expression) {
String parsedExpressionSegment;
if (expression.length() < 2 || !StringUtils.startsWithAny(expression, OPERATORS)) {
parsedExpressionSegment = " == " + expression;
} else {
parsedExpressionSegment = " " + expression;
}
return parsedExpressionSegment;
}
activiti6的:
public static String parse(String expression, String inputVariable) {
String parsedExpression = inputVariable;
if (expression.startsWith(".")) {
parsedExpression += expression;
} else {
parsedExpression += " " + expression;
}
return parsedExpression;
}
不能以空格开头,必须>这些符号。感觉是bug,应该加trim()
。
注:activiti6.0.0的
MvelExpressionExecutor
对应的是(改为了)flowable6.4.1的ELExpressionExecutor
MvelConditionExpressionPreParser
对应ELInputEntryExpressionPreParser
,因此activiti6不会报错。
来源:oschina
链接:https://my.oschina.net/u/2464371/blog/3036822