jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r484612 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Date Fri, 08 Dec 2006 14:04:06 GMT
Author: stefan
Date: Fri Dec  8 06:04:05 2006
New Revision: 484612

URL: http://svn.apache.org/viewvc?view=rev&rev=484612
Log:
minor performance improvement of Node.isNodeType()

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

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?view=diff&rev=484612&r1=484611&r2=484612
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Fri Dec  8 06:04:05 2006
@@ -2548,6 +2548,17 @@
      * {@inheritDoc}
      */
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
+
+        // try shortcut first (avoids parsing of name)...
+        try {
+            if (NameFormat.format(primaryTypeName, session.getNamespaceResolver())
+                    .equals(nodeTypeName)) {
+                return true;
+            }
+        } catch (NoPrefixDeclaredException npde) {
+            throw new RepositoryException("invalid node type name: " + nodeTypeName, npde);
+        }
+
         QName ntName;
         try {
             ntName = NameFormat.parse(nodeTypeName, session.getNamespaceResolver());



Mime
View raw message