gitgabrio commented on code in PR #6556:
URL:
https://github.com/apache/incubator-kie-drools/pull/6556#discussion_r2711470210
##########
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java:
##########
@@ -168,16 +168,16 @@ public Object evaluate(CompiledExpression expr,
EvaluationContext ctx) {
/**
* Creates a new EvaluationContext using this FEEL instance classloader,
and the supplied parameters listeners and inputVariables
*/
- public EvaluationContextImpl
newEvaluationContext(Collection<FEELEventListener> listeners, Map<String,
Object> inputVariables) {
- return newEvaluationContext(this.classLoader, listeners,
inputVariables);
+ public EvaluationContextImpl
newEvaluationContext(Collection<FEELEventListener> listeners, Map<String,
Object> inputVariables, String runtimeMode ) {
+ return newEvaluationContext(this.classLoader, listeners,
inputVariables, runtimeMode);
Review Comment:
Hi @ChinchuAjith . I think it would be better to use the same boolean as per
EvaluationContext
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/DMNFEELHelper.java:
##########
@@ -333,7 +334,7 @@ public Queue<FEELEvent> getFeelEvents() {
}
public EvaluationContextImpl newEvaluationContext(
Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) {
- return (( FEELImpl ) feel).newEvaluationContext(listeners,
inputVariables);
+ return (( FEELImpl ) feel).newEvaluationContext(listeners,
inputVariables, null);
Review Comment:
Hi @ChinchuAjith , thanks for the PR, but I think it would be better to
avoid usage of `null`.
##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNDecisionTableHitPolicyTest.java:
##########
@@ -66,14 +66,15 @@ void simpleDecisionTableHitPolicyUniqueSatisfies(boolean
useExecModelCompiler) {
assertThat(dmnModel).isNotNull();
// Risk Category is constrained to "High", "Low", "Medium" and "ASD"
is not allowed
+ // In lenient mode (default), invalid input is set to null and
evaluation continues
final DMNContext context =
getSimpleTableContext(BigDecimal.valueOf(18), "ASD", false);
final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context);
final DMNContext result = dmnResult.getContext();
- assertThat(result.get("Approval Status")).isNull();
- assertThat(dmnResult.getMessages()).hasSizeGreaterThan(0);
- DMNMessage message = dmnResult.getMessages().iterator().next();
- assertThat(message.getText()).isEqualTo("DMN: RiskCategory='ASD' does
not match any of the valid values \"High\", \"Low\", \"Medium\" for decision
table '_0004-simpletable-U'. (DMN id: _0004-simpletable-U, FEEL expression
evaluation error) ");
+ // In lenient mode, the decision table evaluates with null parameter
and returns a result
+ assertThat(result.get("Approval Status")).isEqualTo("Declined");
+ // No error messages in lenient mode
+ assertThat(dmnResult.getMessages()).isEmpty();
Review Comment:
@ChinchuAjith please consider that comment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]