From ade4e6bb551e1fa468fa80896e697a874ce30739 Mon Sep 17 00:00:00 2001 From: jomarko Date: Mon, 14 Aug 2023 14:25:59 +0200 Subject: [PATCH] kie-issues#270: DMN Runner execution identifies wrongly missing requirements Closes: https://github.com/kiegroup/kie-issues/issues/270 The problem was not in the DMN Runne rui component but in the engine that executes the validation. The mechanism for storing messages contained a bug. ``` @Override public DMNMessage addMessage(DMNMessage newMessage) { for( DMNMessage existingMessage : messages ) { if( isDuplicate( existingMessage, newMessage ) ) { return existingMessage; } } this.messages.add( newMessage ); return newMessage; } ``` `isDuplicate` didn't take into account all needed attributes of the `message` --- .../java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java index 0c30dfaed304..65154875c52b 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import org.kie.api.io.Resource; @@ -100,7 +101,8 @@ public DMNMessage addMessage(DMNMessage.Severity severity, String message, DMNMe private boolean isDuplicate(DMNMessage existingMsg, DMNMessage newMessage) { return existingMsg.getMessageType().equals( newMessage.getMessageType() ) && - existingMsg.getSourceReference() == newMessage.getSourceReference(); + existingMsg.getSourceReference() == newMessage.getSourceReference() && + Objects.equals(existingMsg.getText(), newMessage.getText()); } }