You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by br...@apache.org on 2012/04/13 15:05:12 UTC

svn commit: r1325748 - /ace/trunk/ace-client-repository-helper-configuration/src/main/java/org/apache/ace/client/repository/helper/configuration/impl/ConfigurationHelperImpl.java

Author: bramk
Date: Fri Apr 13 13:05:12 2012
New Revision: 1325748

URL: http://svn.apache.org/viewvc?rev=1325748&view=rev
Log:
ACE-259 Accept all valid metatype namespaces

Modified:
    ace/trunk/ace-client-repository-helper-configuration/src/main/java/org/apache/ace/client/repository/helper/configuration/impl/ConfigurationHelperImpl.java

Modified: ace/trunk/ace-client-repository-helper-configuration/src/main/java/org/apache/ace/client/repository/helper/configuration/impl/ConfigurationHelperImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/ace-client-repository-helper-configuration/src/main/java/org/apache/ace/client/repository/helper/configuration/impl/ConfigurationHelperImpl.java?rev=1325748&r1=1325747&r2=1325748&view=diff
==============================================================================
--- ace/trunk/ace-client-repository-helper-configuration/src/main/java/org/apache/ace/client/repository/helper/configuration/impl/ConfigurationHelperImpl.java (original)
+++ ace/trunk/ace-client-repository-helper-configuration/src/main/java/org/apache/ace/client/repository/helper/configuration/impl/ConfigurationHelperImpl.java Fri Apr 13 13:05:12 2012
@@ -24,7 +24,9 @@ import java.net.URL;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.xml.parsers.DocumentBuilderFactory;
+
 import org.apache.ace.client.repository.helper.ArtifactPreprocessor;
 import org.apache.ace.client.repository.helper.ArtifactRecognizer;
 import org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor;
@@ -36,6 +38,11 @@ import org.w3c.dom.Node;
 
 public class ConfigurationHelperImpl implements ArtifactRecognizer, ConfigurationHelper {
 
+    // known valid metatype namespaces
+    private static final String NAMESPACE_1_0 = "http://www.osgi.org/xmlns/metatype/v1.0.0";
+    private static final String NAMESPACE_1_1 = "http://www.osgi.org/xmlns/metatype/v1.1.0";
+    private static final String NAMESPACE_1_2 = "http://www.osgi.org/xmlns/metatype/v1.2.0";
+    
     public boolean canHandle(String mimetype) {
         return MIMETYPE.equals(mimetype);
     }
@@ -63,7 +70,11 @@ public class ConfigurationHelperImpl imp
             Node first = doc.getFirstChild();
             NamedNodeMap attributes = first.getAttributes();
             Node metatype = attributes.getNamedItem("xmlns:metatype");
-            if (new String("http://www.osgi.org/xmlns/metatype/v1.0.0").equals(metatype.getTextContent())) {
+            String namespace = metatype.getTextContent();
+            if (namespace != null
+                && (namespace.equals(NAMESPACE_1_0)
+                    || namespace.equals(NAMESPACE_1_1)
+                    || namespace.equals(NAMESPACE_1_2))) {
                 return MIMETYPE;
             }
         }