You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/01/13 18:02:37 UTC

svn commit: r125084 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java

Author: stefan
Date: Thu Jan 13 09:02:35 2005
New Revision: 125084

URL: http://svn.apache.org/viewcvs?view=rev&rev=125084
Log:
prevent registration of namespace prefixes matching xml*
Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java?view=diff&rev=125084&p1=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java&r1=125083&p2=incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java&r2=125084
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java	Thu Jan 13 09:02:35 2005
@@ -205,7 +205,7 @@
      * @return a unique prefix
      */
     public String getUniquePrefix(String uriHint) {
-        // @todo smarter prefix generation
+        // @todo smarter unique prefix generation
 /*
         int number;
         if (uriHint == null || uriHint.length() == 0) {
@@ -238,6 +238,11 @@
             throw new NamespaceException("failed to register namespace "
                     + prefix + " -> " + uri + ": reserved prefix");
         }
+        // special case: prefixes xml*
+        if (prefix.startsWith(NS_XML_PREFIX)) {
+            throw new NamespaceException("failed to register namespace "
+                    + prefix + " -> " + uri + ": reserved prefix");
+        }
 
         String oldPrefix = (String) uriToPrefix.get(uri);
         if (oldPrefix != null) {
@@ -252,10 +257,12 @@
         }
 
         if (prefixToURI.containsKey(prefix)) {
-            // prevent remapping of existing prefixes because this would in effect
-            // remove the previously assigned namespace;
-            // as we can't guarantee that there are no references to this namespace
-            // (in names of nodes/properties/node types etc.) we simply don't allow it.
+            /**
+             * prevent remapping of existing prefixes because this would in effect
+             * remove the previously assigned namespace;
+             * as we can't guarantee that there are no references to this namespace
+             * (in names of nodes/properties/node types etc.) we simply don't allow it.
+             */
             throw new NamespaceException("failed to register namespace "
                     + prefix + " -> " + uri + ": remapping existing prefixes is not supported.");
         }
@@ -278,9 +285,11 @@
         if (!prefixToURI.containsKey(prefix)) {
             throw new NamespaceException("unknown prefix: " + prefix);
         }
-        // as we can't guarantee that there are no references to the specified
-        // namespace (in names of nodes/properties/node types etc.) we simply
-        // don't allow it.
+        /**
+         * as we can't guarantee that there are no references to the specified
+         * namespace (in names of nodes/properties/node types etc.) we simply
+         * don't allow it.
+         */
         throw new NamespaceException("unregistering namespaces is not supported.");
     }