]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1152]
authorMaria Odea B. Ching <oching@apache.org>
Wed, 1 Apr 2009 11:00:37 +0000 (11:00 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Wed, 1 Apr 2009 11:00:37 +0000 (11:00 +0000)
o merge -r756559 from trunk (fix for MRM-1136)

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.1.x@760853 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataReader.java
archiva-modules/archiva-base/archiva-xml-tools/src/test/examples/maven-metadata-codehaus-snapshots.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java

index 1e18caf86720b67945017b37251074f6e4cd6bcc..4cd85e8a0fb698fff31bfbb22be09f7f0687ed8c 100644 (file)
@@ -51,7 +51,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 (file)
index 0000000..f101ae6
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xsi:schemaLocation="http://maven.apache.org/METADATA/1.0.0 http://maven.apache.org/xsd/metadata-1.0.0.xsd" xmlns="http://maven.apache.org/METADATA/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <groupId>org.codehaus.mojo</groupId>
+  <artifactId>idlj-maven-plugin</artifactId>
+  <version>1.1-SNAPSHOT</version>
+  <versioning>
+    <snapshot>
+      <timestamp>20090312.163710</timestamp>
+      <buildNumber>16</buildNumber>
+    </snapshot>
+    <lastUpdated>20090312163712</lastUpdated>
+  </versioning>
+</metadata>
index bda872a8be159dd05c45e503a640add085f238d1..7d4ec82ec60b18f317b49393da29fee3487287ae 100644 (file)
@@ -92,5 +92,18 @@ public class XMLReaderTest
         List names = reader.getElementList( "//basic/names/name" );
         assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
     }
+    
+    // MRM-1136 or MRM-1152
+    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() );   
+    }
 
 }