aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <pjfanning@users.noreply.github.com>2022-06-06 07:11:36 +0100
committerGitHub <noreply@github.com>2022-06-06 16:11:36 +1000
commita49b01fef6e78e4e566c75652aaacff54ac6a8ec (patch)
treea0b2bd556cb25581dc8cddbcceb87ff5d79cb050
parent85ff411b30d3127537dfae369eabcfc481510109 (diff)
downloadarchiva-a49b01fef6e78e4e566c75652aaacff54ac6a8ec.tar.gz
archiva-a49b01fef6e78e4e566c75652aaacff54ac6a8ec.zip
MRM-2051: upgrade dom4j (v2 branch) (#107)
* upgrade dom4j * compile issue * Update XMLReader.java * Update XMLReader.java * Update Maven2RepositoryMetadataResolverTest.java
-rw-r--r--archiva-modules/archiva-base/archiva-common/pom.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-scanner/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom4
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/pom.xml2
-rw-r--r--archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLReader.java32
-rw-r--r--archiva-modules/archiva-karaf/archiva-features/pom.xml2
-rw-r--r--archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva-common/1.2.1/archiva-common-1.2.1.pom4
-rw-r--r--archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom4
-rw-r--r--archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.2/archiva-1.2.2.pom4
-rw-r--r--archiva-modules/metadata/test-repository/src/main/resources/org/codehaus/plexus/plexus-spring/1.2/plexus-spring-1.2.pom4
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java6
-rw-r--r--archiva-modules/plugins/maven2-repository/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom4
-rwxr-xr-xarchiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom4
-rwxr-xr-xarchiva-modules/plugins/stage-repository-merge/src/test/resources/test-repository-with-conflict-artifacts/org/testng/testng/5.8/testng-5.8-jdk15.pom2
-rw-r--r--pom.xml5
14 files changed, 42 insertions, 37 deletions
diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml
index 978563b6a..34fcaa050 100644
--- a/archiva-modules/archiva-base/archiva-common/pom.xml
+++ b/archiva-modules/archiva-base/archiva-common/pom.xml
@@ -51,7 +51,7 @@
<artifactId>org.eclipse.sisu.plexus</artifactId>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<scope>test</scope>
</dependency>
diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom
index efa42d3f0..b45a5f3a5 100644
--- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom
+++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom
@@ -34,9 +34,9 @@
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml
index 1aae2ec50..0e4bf1450 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml
+++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml
@@ -42,7 +42,7 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLReader.java b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLReader.java
index d889e92d8..933510f2d 100644
--- a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLReader.java
+++ b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/XMLReader.java
@@ -40,6 +40,7 @@ import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -201,22 +202,25 @@ public class XMLReader
{
elem.setQName( QName.get( elem.getName(), Namespace.NO_NAMESPACE, elem.getQualifiedName() ) );
- Node n;
+ Element e;
+ Iterator<Element> elementIterator = elem.elementIterator();
+ while ( elementIterator.hasNext() )
+ {
+ e = elementIterator.next();
+ removeNamespaces(e);
+ }
- Iterator<Node> it = elem.elementIterator();
- while ( it.hasNext() )
+ Attribute attribute;
+ Iterator<Attribute> attributeIterator = elem.attributeIterator();
+ LinkedHashMap<String, String> newAttributes = new LinkedHashMap<>();
+ while ( attributeIterator.hasNext() )
{
- n = it.next();
-
- switch ( n.getNodeType() )
- {
- case Node.ATTRIBUTE_NODE:
- ( (Attribute) n ).setNamespace( Namespace.NO_NAMESPACE );
- break;
- case Node.ELEMENT_NODE:
- removeNamespaces( (Element) n );
- break;
- }
+ attribute = attributeIterator.next();
+ newAttributes.put(attribute.getName(), attribute.getValue());
+ }
+ elem.setAttributes(new ArrayList<Attribute>());
+ for (Map.Entry<String, String> entry : newAttributes.entrySet()) {
+ elem.addAttribute(entry.getKey(), entry.getValue());
}
}
diff --git a/archiva-modules/archiva-karaf/archiva-features/pom.xml b/archiva-modules/archiva-karaf/archiva-features/pom.xml
index 73beef629..f092b6bfc 100644
--- a/archiva-modules/archiva-karaf/archiva-features/pom.xml
+++ b/archiva-modules/archiva-karaf/archiva-features/pom.xml
@@ -39,7 +39,7 @@
<commons-httpclient.bundle.version>3.1_6</commons-httpclient.bundle.version>
<commons-jxpath.bundle.version>1.2_5</commons-jxpath.bundle.version>
<commons-validator.bundle.version>1.3.1_1-SNAPSHOT</commons-validator.bundle.version>
- <dom4j.bundle.version>1.6.1_4</dom4j.bundle.version>
+ <dom4j.bundle.version>2.1.3_1</dom4j.bundle.version>
<ehcache.bundle.version>2.4.3_1</ehcache.bundle.version>
<freemarker.bundle.version>2.3.18_1</freemarker.bundle.version>
<javassist.bundle.version>3.12.1.ga_1</javassist.bundle.version>
diff --git a/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva-common/1.2.1/archiva-common-1.2.1.pom b/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva-common/1.2.1/archiva-common-1.2.1.pom
index bddde3bb7..360cc46f9 100644
--- a/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva-common/1.2.1/archiva-common-1.2.1.pom
+++ b/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva-common/1.2.1/archiva-common-1.2.1.pom
@@ -61,9 +61,9 @@
<version>2.7.0</version>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom b/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom
index cccf51781..0bf4b0f6c 100644
--- a/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom
+++ b/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom
@@ -501,9 +501,9 @@
<version>10.1.3.1</version>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
diff --git a/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.2/archiva-1.2.2.pom b/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.2/archiva-1.2.2.pom
index cccf51781..0bf4b0f6c 100644
--- a/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.2/archiva-1.2.2.pom
+++ b/archiva-modules/metadata/test-repository/src/main/resources/org/apache/archiva/archiva/1.2.2/archiva-1.2.2.pom
@@ -501,9 +501,9 @@
<version>10.1.3.1</version>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
diff --git a/archiva-modules/metadata/test-repository/src/main/resources/org/codehaus/plexus/plexus-spring/1.2/plexus-spring-1.2.pom b/archiva-modules/metadata/test-repository/src/main/resources/org/codehaus/plexus/plexus-spring/1.2/plexus-spring-1.2.pom
index 1b13027c1..cc7397558 100644
--- a/archiva-modules/metadata/test-repository/src/main/resources/org/codehaus/plexus/plexus-spring/1.2/plexus-spring-1.2.pom
+++ b/archiva-modules/metadata/test-repository/src/main/resources/org/codehaus/plexus/plexus-spring/1.2/plexus-spring-1.2.pom
@@ -57,9 +57,9 @@
<version>1.0-alpha-22</version>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>com.opensymphony</groupId>
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
index 24e9b2609..dbc1f5f19 100644
--- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
+++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java
@@ -211,7 +211,7 @@ public class Maven2RepositoryMetadataResolverTest
assertDependency( dependencies.get( 3 ), "org.codehaus.plexus", "plexus-component-api", "1.0-alpha-22" );
assertDependency( dependencies.get( 4 ), "org.codehaus.plexus", "plexus-spring", "1.2", "test" );
assertDependency( dependencies.get( 5 ), "xalan", "xalan", "2.7.0" );
- assertDependency( dependencies.get( 6 ), "dom4j", "dom4j", "1.6.1", "test" );
+ assertDependency( dependencies.get( 6 ), "org.dom4j", "dom4j", "${dom4j.version}", "test" );
assertDependency( dependencies.get( 7 ), "junit", "junit", "3.8.1", "test" );
assertDependency( dependencies.get( 8 ), "easymock", "easymock", "1.2_Java1.3", "test" );
assertDependency( dependencies.get( 9 ), "easymock", "easymockclassextension", "1.2", "test" );
@@ -668,8 +668,8 @@ public class Maven2RepositoryMetadataResolverTest
assertArtifact( artifacts.get( 0 ), "plexus-spring-1.2-sources.jar", 0, EMPTY_SHA1, EMPTY_MD5 );
assertArtifact( artifacts.get( 1 ), "plexus-spring-1.2.jar", 0, EMPTY_SHA1, EMPTY_MD5 );
- assertArtifact( artifacts.get( 2 ), "plexus-spring-1.2.pom", 7407, "96b14cf880e384b2d15e8193c57b65c5420ca4c5",
- "f83aa25f016212a551a4b2249985effc" );
+ assertArtifact( artifacts.get( 2 ), "plexus-spring-1.2.pom", 7422, "28e86d3e2723e4894587e4b758231f76febce942",
+ "9f663d8e7adf6adff4133653b59d1e28" );
}
@Test
diff --git a/archiva-modules/plugins/maven2-repository/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom b/archiva-modules/plugins/maven2-repository/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom
index efa42d3f0..b45a5f3a5 100644
--- a/archiva-modules/plugins/maven2-repository/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom
+++ b/archiva-modules/plugins/maven2-repository/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-xml-tools/1.0-SNAPSHOT/archiva-xml-tools-1.0-SNAPSHOT.pom
@@ -34,9 +34,9 @@
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom
index cccf51781..0bf4b0f6c 100755
--- a/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom
+++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/target-repo/org/apache/archiva/archiva/1.2.1/archiva-1.2.1.pom
@@ -501,9 +501,9 @@
<version>10.1.3.1</version>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
diff --git a/archiva-modules/plugins/stage-repository-merge/src/test/resources/test-repository-with-conflict-artifacts/org/testng/testng/5.8/testng-5.8-jdk15.pom b/archiva-modules/plugins/stage-repository-merge/src/test/resources/test-repository-with-conflict-artifacts/org/testng/testng/5.8/testng-5.8-jdk15.pom
index 4e7b53b08..f5217b20e 100755
--- a/archiva-modules/plugins/stage-repository-merge/src/test/resources/test-repository-with-conflict-artifacts/org/testng/testng/5.8/testng-5.8-jdk15.pom
+++ b/archiva-modules/plugins/stage-repository-merge/src/test/resources/test-repository-with-conflict-artifacts/org/testng/testng/5.8/testng-5.8-jdk15.pom
@@ -44,7 +44,7 @@
<dependency>
<groupId>qdox</groupId>
<artifactId>qdox</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/pom.xml b/pom.xml
index 7dc7571a0..e70bef38f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,6 +57,7 @@
<commons-fileupload.version>1.4</commons-fileupload.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang.version>2.6</commons-lang.version>
+ <dom4j.version>2.1.3</dom4j.version>
<maven3x.version>3.0.5</maven3x.version>
<maven.version>2.0.8</maven.version>
@@ -706,9 +707,9 @@
<version>${derbyVersion}</version>
</dependency>
<dependency>
- <groupId>dom4j</groupId>
+ <groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6.1</version>
+ <version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>