jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r538843 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
Date Thu, 17 May 2007 09:01:42 GMT
Author: jukka
Date: Thu May 17 02:01:40 2007
New Revision: 538843

URL: http://svn.apache.org/viewvc?view=rev&rev=538843
Log:
JCR-928: Return false for unknown prefixes in hasNodeType(String)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java?view=diff&rev=538843&r1=538842&r2=538843
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeManagerImpl.java
Thu May 17 02:01:40 2007
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.name.NameFormat;
+import org.apache.jackrabbit.name.UnknownPrefixException;
 import org.apache.jackrabbit.util.IteratorHelper;
 import org.apache.jackrabbit.util.name.NamespaceMapping;
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
@@ -476,14 +477,21 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Checks whether a node type with the given name exists.
+     *
+     * @param name node type name
+     * @return <code>true</code> if the named node type exists,
+     *         <code>false</code> otherwise
+     * @throws RepositoryException if the name format is invalid
      */
     public boolean hasNodeType(String name) throws RepositoryException {
         try {
             QName qname = NameFormat.parse(name, nsResolver);
             return getNodeTypeRegistry().isRegistered(qname);
+        } catch (UnknownPrefixException e) {
+            return false;
         } catch (NameException e) {
-           throw new RepositoryException();
+           throw new RepositoryException("Invalid name: " + name, e);
         }
     }
 



Mime
View raw message