public static class TextOutput extends GenerationOutput {
private String value;
private final List<IceComTerm> entities = new ArrayList<>();
public TextOutput(String value) {
this.value = value;
}
public TextOutput(String value, List<IceComTerm> entities) {
this.value = value;
if (entities != null) {
this.entities.addAll(entities);
}
}
@Override
public IceComList getBugRepresentation() {
// ... some code I want all classes to be able to run
}
}
// Value is declared on text output, but here we add the @key annotation to ensure a constructor is generated
declare FeedbackOutput extends TextOutput
value: String @key
end
// .... Some rules ....
rule "Input seen"
dialect "mvel"
agenda-group "process input"
salience -1
when
$input: DMStudentInput()
then
insert(new FeedbackOutput("Oops: got unexpected input " + $input.toString() + ", type: " + $input.getType()))
retract($input)
end
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1871)
at org.mvel2.util.ErrorUtil.rewriteIfNeeded(ErrorUtil.java:17)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:952)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:373)
at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:159)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:115)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
at org.mvel2.compiler.CompiledExpression.getDirectValue(CompiledExpression.java:123)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:119)
at org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:113)
at org.mvel2.MVEL.executeExpression(MVEL.java:930)
at org.drools.core.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:107)
at org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1046)
at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:152)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:94)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:964)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1234)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1239)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1212)
at droolsdm.StandaloneDM.userInputLoop(StandaloneDM.java:113)
at droolsdm.StandaloneDM.main(StandaloneDM.java:134)
--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/00629e0a-d1d1-40cb-8760-888e57752ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
import droolsdm.GenerationOutput.TextOutput;
declare TextOutput
end
// Value is declared on text output, but here we add the @key annotation to ensure a constructor is generated
declare QuestionOutput extends TextOutput
value: String @key
end
....
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1871)
at org.mvel2.util.ErrorUtil.rewriteIfNeeded(ErrorUtil.java:17)
import droolsdm.GenerationOutput.TextOutput;
declare TextOutput
value: String
end
// Value is declared on text output, but here we add the @key annotation to ensure a constructor is generated
declare QuestionOutput extends TextOutput
value: String @key
end
....
New declaration of droolsdm.GenerationOutput$TextOutput can't declaredeclares a different set of fields
existing : {value=private java.lang.String droolsdm.GenerationOutput$TextOutput.value, hashCode=null, class=null, toString=null}
declared : {value=TypeField[ value : [Pattern: id=null; objectType=String] = null ]}
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/40732037-288c-46ae-a8d4-8a811de76b0c%40googlegroups.com.
Issue is fixed, it was a null pointer exception getting suppressed by drools framework. Thanks.