You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2013/03/28 09:51:30 UTC

svn commit: r1461996 - /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java

Author: thomasm
Date: Thu Mar 28 08:51:30 2013
New Revision: 1461996

URL: http://svn.apache.org/r1461996
Log:
OAK-619 MongoMK: use Utils.getIdFromPath where possible

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java?rev=1461996&r1=1461995&r2=1461996&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java (original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/prototype/MongoMK.java Thu Mar 28 08:51:30 2013
@@ -349,18 +349,15 @@ public class MongoMK implements MicroKer
         // check commit root
         @SuppressWarnings("unchecked")
         Map<String, Integer> commitRoot = (Map<String, Integer>) nodeMap.get(UpdateOp.COMMIT_ROOT);
-        String commitRootId = null;
+        String commitRootPath = null;
         if (commitRoot != null) {
             Integer depth = commitRoot.get(rev.toString());
             if (depth != null) {
                 String p = Utils.getPathFromId((String) nodeMap.get(UpdateOp.ID));
-                StringBuilder sb = new StringBuilder();
-                sb.append(depth).append(":");
-                sb.append(PathUtils.getAncestorPath(p, PathUtils.getDepth(p) - depth));
-                commitRootId = sb.toString();
+                commitRootPath = PathUtils.getAncestorPath(p, PathUtils.getDepth(p) - depth);
             }
         }
-        if (commitRootId == null) {
+        if (commitRootPath == null) {
             // shouldn't happen, either node is commit root for a revision
             // or has a reference to the commit root
             log.warn("Node {} does not have commit root reference for revision {}",
@@ -369,7 +366,7 @@ public class MongoMK implements MicroKer
             return false;
         }
         // get root of commit
-        nodeMap = store.find(DocumentStore.Collection.NODES, commitRootId);
+        nodeMap = store.find(DocumentStore.Collection.NODES, Utils.getIdFromPath(commitRootPath));
         if (nodeMap == null) {
             return false;
         }