gitgabrio opened a new issue, #7039:
URL: https://github.com/apache/incubator-kie/issues/7039

   Inside 
   
   ```java
   DMNFEELHelper#compileFeelExpression(DMNCompilerContext, String, 
DMNModelImpl, DMNElement, Msg.Message, Object...) {
   ...
           CompiledExpression ce = feel.compile( expression, feelctx );
           processEvents( model, element, errorMsg, msgParams );
           return ce;
   }
   ```
   a CompiledExpression is returned even in presence of Syntax errors, that are 
simply sent to MsgUtil.
   Then, the calling code
   
   ```java
   DMNEvaluatorCompiler#compileLiteralExpression(DMNCompilerContext, 
DMNModelImpl, DMNBaseNode, String, LiteralExpression) {
   ...
   CompiledExpression compiledExpression = 
ctx.getFeelHelper().compileFeelExpression(ctx,
                                                                                
           exprText,
                                                                                
           model,
                                                                                
           expression,
                                                                                
       Msg.ERR_COMPILING_FEEL_EXPR_FOR_NAME_ON_NODE,
                                                                                
           exprText,
                                                                                
           exprName,
                                                                                
           node.getIdentifierString() );
                       evaluator = new 
DMNLiteralExpressionEvaluator(compiledExpression, expression, 
ctx.getFeelHelper().newFEELInstance());
   ...
   ```
   
   ignores the error messages, set the evaluator, and uses it to evaluate the 
model.
   The result of all that is inconsistent, since
   
   1.  on one side, the expression has syntax errors, so it should be 
completely discarded
   2.  but on the other side, an evaluator is instantiated and fired, leading 
to some kind of result.
   
   
   This is demonstrated by the attached 
[DMN-Invalid.txt](https://github.com/user-attachments/files/17751196/DMN-Invalid.txt)
 and the following snippet:
   
   ```java
   File modelFile = FileUtils.getFile("DMN-Invalid.dmn");
   Resource modelResource = ResourceFactory.newFileResource(modelFile);
   DMNRuntime dmnRuntime = DMNRuntimeBuilder.fromDefaults().buildConfiguration()
                   
.fromResources(Collections.singletonList(modelResource)).getOrElseThrow(RuntimeException::new);
   String nameSpace = 
"https://kie.org/dmn/_C41C5BB7-C6D3-44AC-AA11-8C6669A1067C";;
   final DMNModel dmnModel = dmnRuntime.getModel(
                   nameSpace,
                   "DMN_9A35369C-E843-446F-A720-2A41B827FB8D");
   final DMNContext context = DMNFactory.newContext();
   context.set( "Person Age", 24 );
   final DMNResult dmnResult = dmnRuntime.evaluateAll(dmnModel, context );
   ```
   
   Result
   
   ```
   DMNResultImpl{
   context={
       Person Age: 24
       Can Drive?: true
      }
   }
   ```
   
   @baldimir @yesamer
   
   


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

Reply via email to