Second attempt to fix FELIX-2685 Wrong Element name when XML namespace contains ':'


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1033171 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
index 77dceff..1acbfe1 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java
@@ -544,9 +544,9 @@
                     	elem = new Element(n, null);
                     } else {
                     	// The namespace ends on the first ':'
-                    	int index = n.indexOf(':');
-                    	String ns = n.substring(0, index);
-                    	String name = n.substring(index + 1);
+                    	int last = n.lastIndexOf(':');
+                    	String ns = n.substring(0, last);
+                    	String name = n.substring(last + 1);
                     	elem = new Element(name.toString(), ns.toString());
                     }
 
diff --git a/ipojo/core/src/test/java/org/apache/felix/ipojo/util/ManifestMetadataParserTest.java b/ipojo/core/src/test/java/org/apache/felix/ipojo/util/ManifestMetadataParserTest.java
index 8feb9d0..eaaae70 100644
--- a/ipojo/core/src/test/java/org/apache/felix/ipojo/util/ManifestMetadataParserTest.java
+++ b/ipojo/core/src/test/java/org/apache/felix/ipojo/util/ManifestMetadataParserTest.java
@@ -38,11 +38,11 @@
 	 */
 	public void testNameWithColumn() throws ParseException {
 		// Create a test element
-		String header = "mynamespace://jasmine.ow2.org/rules/1.0.0:configuration {}";
+		String header = "http://jasmine.ow2.org/rules/1.0.0:configuration {}";
 		Element elem = ManifestMetadataParser.parse(header);
 
-		Assert.assertEquals("mynamespace", elem.getNameSpace());
-		Assert.assertEquals("//jasmine.ow2.org/rules/1.0.0:configuration", elem.getName());
+		Assert.assertEquals("http://jasmine.ow2.org/rules/1.0.0", elem.getNameSpace());
+		Assert.assertEquals("configuration", elem.getName());
 	}
 
 	/**