This is an automated email from the ASF dual-hosted git repository.
yamer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 5109955c8b [incubator-kie-issues#1150] Improve Import Resolver error
messages to be more user friendly - Part II (#6025)
5109955c8b is described below
commit 5109955c8baf052c135b65db4fc97aa27059b16e
Author: Yeser Amer <[email protected]>
AuthorDate: Wed Jul 17 10:50:12 2024 +0200
[incubator-kie-issues#1150] Improve Import Resolver error messages to be
more user friendly - Part II (#6025)
---
.../dmn/core/compiler/ImportDMNResolverUtil.java | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
index be11db65f2..91b86b40ac 100644
---
a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
+++
b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/compiler/ImportDMNResolverUtil.java
@@ -21,7 +21,6 @@ package org.kie.dmn.core.compiler;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.xml.namespace.QName;
@@ -51,27 +50,27 @@ public class ImportDMNResolverUtil {
LOGGER.debug("Resolving an Import in DMN Model with name={} and
namespace={}. " +
"Importing a DMN model with namespace={} name={}
locationURI={}, modelName={}",
- importerDMNNamespace, importerDMNName, importNamespace,
importName, importLocationURI, importModelName);
+ importerDMNName, importerDMNNamespace, importNamespace,
importName, importLocationURI, importModelName);
List<T> matchingDMNList = dmns.stream()
.filter(m ->
idExtractor.apply(m).getNamespaceURI().equals(importNamespace))
- .collect(Collectors.toList());
+ .toList();
if (matchingDMNList.size() == 1) {
T located = matchingDMNList.get(0);
// Check if the located DMN Model in the NS, correspond for the
import `drools:modelName`.
if (importModelName == null ||
idExtractor.apply(located).getLocalPart().equals(importModelName)) {
LOGGER.debug("DMN Model with name={} and namespace={}
successfully imported a DMN " +
"with namespace={} name={} locationURI={},
modelName={}",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importLocationURI, importModelName);
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importLocationURI, importModelName);
return Either.ofRight(located);
} else {
LOGGER.error("DMN Model with name={} and namespace={} can't
import a DMN with namespace={}, name={}, modelName={}, " +
"located within namespace only {} but does not
match for the actual modelName",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importModelName, idExtractor.apply(located));
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importModelName, idExtractor.apply(located));
return Either.ofLeft(String.format(
"DMN Model with name=%s and namespace=%s can't import
a DMN with namespace=%s, name=%s, modelName=%s, " +
"located within namespace only %s but does not
match for the actual modelName",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importModelName, idExtractor.apply(located)));
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importModelName, idExtractor.apply(located)));
}
} else {
List<T> usingNSandName = matchingDMNList.stream()
@@ -80,22 +79,22 @@ public class ImportDMNResolverUtil {
if (usingNSandName.size() == 1) {
LOGGER.debug("DMN Model with name={} and namespace={}
successfully imported a DMN " +
"with namespace={} name={} locationURI={},
modelName={}",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importLocationURI, importModelName);
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importLocationURI, importModelName);
return Either.ofRight(usingNSandName.get(0));
} else if (usingNSandName.isEmpty()) {
LOGGER.error("DMN Model with name={} and namespace={} failed
to import a DMN with namespace={} name={} locationURI={}, modelName={}.",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importLocationURI, importModelName);
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importLocationURI, importModelName);
return Either.ofLeft(String.format(
"DMN Model with name=%s and namespace=%s failed to
import a DMN with namespace=%s name=%s locationURI=%s, modelName=%s. ",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importLocationURI, importModelName));
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importLocationURI, importModelName));
} else {
LOGGER.error("DMN Model with name={} and namespace={} detected
a collision ({} elements) trying to import a DMN with namespace={} name={}
locationURI={}, modelName={}",
- importerDMNNamespace, importerDMNName,
usingNSandName.size(), importNamespace, importName, importLocationURI,
importModelName);
+ importerDMNName, importerDMNNamespace,
usingNSandName.size(), importNamespace, importName, importLocationURI,
importModelName);
return Either.ofLeft(String.format(
"DMN Model with name=%s and namespace=%s detected a
collision trying to import a DMN with %s namespace, " +
"%s name and modelName %s. There are %s DMN
files with the same namespace in your project. " +
"Please change the DMN namespaces and make
them unique to fix this issue.",
- importerDMNNamespace, importerDMNName,
importNamespace, importName, importModelName, usingNSandName.size()));
+ importerDMNName, importerDMNNamespace,
importNamespace, importName, importModelName, usingNSandName.size()));
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]