jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1499053 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate: NodeDelegate.java PropertyDelegate.java
Date Tue, 02 Jul 2013 18:43:39 GMT
Author: jukka
Date: Tue Jul  2 18:43:39 2013
New Revision: 1499053

URL: http://svn.apache.org/r1499053
Log:
OAK-663: oak-jcr performance optimization

Tree.hasProperty(*) implies !parent.hasProperty(*), so there's no need to check for both.
Also, guard against the potential null Tree returned by NodeDelegate.getTree()

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java?rev=1499053&r1=1499052&r2=1499053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
Tue Jul  2 18:43:39 2013
@@ -268,8 +268,12 @@ public class NodeDelegate extends ItemDe
     @CheckForNull
     public PropertyDelegate getPropertyOrNull(String relPath) throws RepositoryException
{
         Tree parent = getTree(PathUtils.getParentPath(relPath));
-        String name = PathUtils.getName(relPath);
-        return PropertyDelegate.create(sessionDelegate, parent, name);
+        if (parent != null) {
+            String name = PathUtils.getName(relPath);
+            return PropertyDelegate.create(sessionDelegate, parent, name);
+        } else {
+            return null;
+        }
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java?rev=1499053&r1=1499052&r2=1499053&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/PropertyDelegate.java
Tue Jul  2 18:43:39 2013
@@ -52,7 +52,7 @@ public class PropertyDelegate extends It
      */
     @CheckForNull
     static PropertyDelegate create(SessionDelegate sessionDelegate, Tree parent, String name)
{
-        return parent.exists() && parent.hasProperty(name)
+        return parent.hasProperty(name)
             ? new PropertyDelegate(sessionDelegate, parent, name)
             : null;
     }



Mime
View raw message