diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 40cd64d..04180c7 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -29,7 +29,7 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
- server-id: ossrh
+ server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish to the Maven Central Repository
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b71fd51..d4632fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,12 +1,12 @@
-# eForms Core Library 1.4.0 Release Notes
+# eForms Core Library 1.5.0 Release Notes
The eForms Core Library is a collection of utilities that are used by our sample applications as well as the EFX Toolkit for Java Developers.
## In this release
-This release adds the option to indicate a qualifier for SDK components. If there are 2 or more classes that have an @SdkComponent annotation with the same version and component type, this allows you to differentiate them and load the component with the matching qualifier.
+This release fixes an issue in the XPathProcessor that could cause a redundant predicate production when contextualising XPaths with multiple predicates.
-The versions of various dependencies was updated: ANTLR 4.13.1, JAXB 4.0.4, logback 1.5.3, ph-genericode 7.1.1.
+The versions of various dependencies was updated: Apache Commons IO 2.19.0, Apache Commons Lang 3.18.0, Jackson 2.18.3, logback 1.5.18.
## Download
diff --git a/pom.xml b/pom.xml
index 8697b2a..2ec8943 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
eu.europa.ted.eforms
eforms-core-java
- 1.4.0
+ 1.5.0
eForms Core Library
API and tools for eForms applications.
@@ -32,23 +32,10 @@
https://github.com/OP-TED/eforms-core-java.git
-
-
- ossrh
- https://${sonatype.server.url}/content/repositories/snapshots
-
-
- ossrh
- https://${sonatype.server.url}/service/local/staging/deploy/maven2/
-
-
-
- 2024-08-02T09:11:15Z
+ 2024-08-02T09:50:45Z
UTF-8
- s01.oss.sonatype.org
-
11
${java.version}
@@ -57,13 +44,13 @@
4.13.1
3.2.2
- 2.11.0
- 3.12.0
- 2.15.1
+ 2.19.0
+ 3.18.0
+ 2.18.3
4.0.4
0.9.15
5.7.2
- 1.5.3
+ 1.5.18
3.8.6
11.1.3
7.1.1
@@ -83,7 +70,7 @@
3.2.1
3.3.0
3.2.5
- 1.6.7
+ 0.8.0
@@ -421,9 +408,9 @@
${version.japicmp.plugin}
- org.sonatype.plugins
- nexus-staging-maven-plugin
- ${version.nexus-staging.plugin}
+ org.sonatype.central
+ central-publishing-maven-plugin
+ ${version.central-publishing.plugin}
@@ -561,13 +548,12 @@
- org.sonatype.plugins
- nexus-staging-maven-plugin
+ org.sonatype.central
+ central-publishing-maven-plugin
true
- ossrh
- https://${sonatype.server.url}/
- true
+ central
+ true
diff --git a/src/main/java/eu/europa/ted/eforms/xpath/XPathProcessor.java b/src/main/java/eu/europa/ted/eforms/xpath/XPathProcessor.java
index e6e92be..fa6ef4b 100644
--- a/src/main/java/eu/europa/ted/eforms/xpath/XPathProcessor.java
+++ b/src/main/java/eu/europa/ted/eforms/xpath/XPathProcessor.java
@@ -76,17 +76,20 @@ private static String getContextualizedXpath(Queue contextQueue,
// we want to use a dot step with the predicate of the path.
if (!contextQueue.isEmpty() && !pathQueue.isEmpty()
&& pathQueue.peek().isSameAsOrNarrowerThan(contextQueue.peek())) {
- contextQueue.poll(); // consume the same step from the contextQueue
+ // Consume the same step from the contextQueue and get its predicates
+ List contextPredicates = contextQueue.poll().getPredicates();
+ // Keep only the predicates that are not in the context.
+ String pathPredicates = pathQueue.poll().getPredicates().stream().filter(p -> !contextPredicates.contains(p)).collect(Collectors.joining(""));
if (contextQueue.isEmpty()) {
// Since there are no more steps in the contextQueue, the relative xpath should
// start with a dot step to provide a context for the predicate.
- relativeXpath += "." + pathQueue.poll().getPredicateText();
+ relativeXpath += "." + pathPredicates;
} else {
// Since there are more steps in the contextQueue which we will need to navigate back to,
- // using back-steps, we will use a back-step to provide context of the predicate.
+ // using back-steps, we will use a back-step to provide context for the predicate.
// This avoids an output that looks like ../.[predicate] which is valid but silly.
contextQueue.poll(); // consume the step from the contextQueue
- relativeXpath += ".." + pathQueue.poll().getPredicateText();
+ relativeXpath += ".." + pathPredicates;
}
}
diff --git a/src/test/java/eu/europa/ted/eforms/xpath/XPathProcessorTest.java b/src/test/java/eu/europa/ted/eforms/xpath/XPathProcessorTest.java
index 0ea12c1..dd62236 100644
--- a/src/test/java/eu/europa/ted/eforms/xpath/XPathProcessorTest.java
+++ b/src/test/java/eu/europa/ted/eforms/xpath/XPathProcessorTest.java
@@ -65,7 +65,7 @@ void testIdentical() {
@Test
void testIdentical_WithPredicates() {
- assertEquals(".[d = e][f = g]", contextualize("/a/b/c[d = e]", "/a/b/c[d = e][f = g]"));
+ assertEquals(".[f = g]", contextualize("/a/b/c[d = e]", "/a/b/c[d = e][f = g]"));
}
@Test
@@ -181,7 +181,7 @@ void testPredicateDifferent() {
@Test
void testPredicateMoreInXpath() {
- assertEquals("..[e][f]/c/d", contextualize("/a/b[e]/c", "/a/b[e][f]/c/d"));
+ assertEquals("..[f]/c/d", contextualize("/a/b[e]/c", "/a/b[e][f]/c/d"));
}
@Test