jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meteata...@apache.org
Subject svn commit: r1420934 - in /jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl: MongoMicroKernel.java json/JsopParser.java
Date Wed, 12 Dec 2012 19:49:56 GMT
Author: meteatamel
Date: Wed Dec 12 19:49:54 2012
New Revision: 1420934

URL: http://svn.apache.org/viewvc?rev=1420934&view=rev
Log:
OAK-503 - Microkernel.commit throws AssertionError

Merge the fix to MongoMK

Modified:
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
    jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java?rev=1420934&r1=1420933&r2=1420934&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/MongoMicroKernel.java
Wed Dec 12 19:49:54 2012
@@ -31,6 +31,7 @@ import org.apache.jackrabbit.mongomk.imp
 import org.apache.jackrabbit.mongomk.impl.model.CommitBuilder;
 import org.apache.jackrabbit.mongomk.impl.model.MongoCommit;
 import org.apache.jackrabbit.mongomk.impl.model.tree.MongoNodeState;
+import org.apache.jackrabbit.oak.commons.PathUtils;
 
 /**
  * The {@code MongoDB} implementation of the {@link MicroKernel}.
@@ -97,7 +98,15 @@ public class MongoMicroKernel implements
     }
 
     @Override
-    public String commit(String path, String jsonDiff, String revisionId, String message)
throws MicroKernelException {
+    public String commit(String path, String jsonDiff, String revisionId, String message)
+            throws MicroKernelException {
+        if (path.length() > 0 && !PathUtils.isAbsolute(path)) {
+            throw new IllegalArgumentException("Absolute path expected: " + path);
+        }
+        if (jsonDiff == null || jsonDiff.length() == 0) {
+            return getHeadRevision();
+        }
+
         try {
             Commit commit = CommitBuilder.build(path, jsonDiff, revisionId, message);
             return nodeStore.commit(commit);

Modified: jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java?rev=1420934&r1=1420933&r2=1420934&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java
(original)
+++ jackrabbit/oak/trunk/oak-mongomk/src/main/java/org/apache/jackrabbit/mongomk/impl/json/JsopParser.java
Wed Dec 12 19:49:54 2012
@@ -93,7 +93,7 @@ public class JsopParser {
                     break;
                 }
                 default:
-                    throw new IllegalStateException("Unknown operation: " + (char) token);
+                    throw new IllegalArgumentException("Illegal token '" + (char)token);
             }
         }
     }



Mime
View raw message