Copilot commented on code in PR #6325:
URL:
https://github.com/apache/incubator-kie-drools/pull/6325#discussion_r2063384044
##########
kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/ast/DMNConditionalEvaluator.java:
##########
@@ -101,8 +103,25 @@ static EvaluatorIdentifier
getEvaluatorIdentifier(Map<EvaluatorType, EvaluatorId
.orElseThrow(() -> new RuntimeException("Missing " + type + "
evaluator in evaluatorIdMap"));
}
- static String getDecisionName(DMNModelInstrumentedBase dmnElement) {
- return dmnElement instanceof Decision decision ? decision.getName() :
getDecisionName(dmnElement.getParentDRDElement());
+ /**
+ * Given a DMNModelInstrumentedBase element, it looks in the DMN hierarchy
the element related Decision node name or
+ * BusinessKnowledgeModel node name
+ * @param dmnElement
+ * @return
+ */
+ static String getDecisionOrBkmName(DMNModelInstrumentedBase dmnElement) {
+ if (dmnElement.getParentDRDElement() == null || dmnElement ==
dmnElement.getParentDRDElement()) {
+ logger.error("Root element reached. Can't find the related
Decision or BKM node name");
Review Comment:
[nitpick] While the current base condition prevents infinite recursion,
consider logging more context (such as the dmnElement's class or identifier) to
aid in debugging, should an unexpected input occur.
```suggestion
String elementInfo = String.format("Class: %s, ID: %s",
dmnElement.getClass().getSimpleName(),
dmnElement instanceof DMNModelInstrumentedBase ?
((DMNModelInstrumentedBase) dmnElement).getId() : "N/A");
logger.error("Root element reached. Can't find the related
Decision or BKM node name. Element info: {}", elementInfo);
```
--
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]