From: Maria Odea B. Ching Date: Fri, 20 Mar 2009 16:05:05 +0000 (+0000) Subject: [MRM-1136] X-Git-Tag: archiva-1.2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9bd751e3d523d5be4fc2691958715c0f34c6e413;p=archiva.git [MRM-1136] o remove namespaces before getting child nodes of metadata o added test case git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@756559 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java index b1639aac1..a6fc50b82 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java @@ -50,7 +50,9 @@ public class RepositoryMetadataReader try { XMLReader xml = new XMLReader( "metadata", metadataFile ); - + // invoke this to remove namespaces, see MRM-1136 + xml.removeNamespaces(); + ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata(); metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) ); diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/examples/maven-metadata-codehaus-snapshots.xml b/archiva-modules/archiva-base/archiva-xml-tools/src/test/examples/maven-metadata-codehaus-snapshots.xml new file mode 100644 index 000000000..f101ae619 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/examples/maven-metadata-codehaus-snapshots.xml @@ -0,0 +1,14 @@ + + + org.codehaus.mojo + idlj-maven-plugin + 1.1-SNAPSHOT + + + 20090312.163710 + 16 + + 20090312163712 + + diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java index 1fb12fba8..86a30530f 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java @@ -89,5 +89,18 @@ public class XMLReaderTest List names = reader.getElementList( "//basic/names/name" ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } ); } + + // MRM-1136 + public void testProxiedMetadataRead() + throws XMLException + { + File xmlFile = getExampleXml( "maven-metadata-codehaus-snapshots.xml" ); + XMLReader reader = new XMLReader( "metadata", xmlFile ); + reader.removeNamespaces(); + + Element groupId = reader.getElement( "//metadata/groupId" ); + assertNotNull( groupId ); + assertEquals( "org.codehaus.mojo", groupId.getTextTrim() ); + } }