jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1351327 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Mon, 18 Jun 2012 12:59:02 GMT
Author: mduerig
Date: Mon Jun 18 12:59:02 2012
New Revision: 1351327

URL: http://svn.apache.org/viewvc?rev=1351327&view=rev
Log:
OAK-89: Improve exception handling

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java?rev=1351327&r1=1351326&r2=1351327&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java Mon
Jun 18 12:59:02 2012
@@ -84,7 +84,7 @@ public interface Root {
      * instances must be obtained.
      *
      * @param conflictHandler  {@link ConflictHandler} for resolving conflicts.
-     * @throws CommitFailedException TODO: add description and clarify how JCR exception
can be generated from this generic exception
+     * @throws CommitFailedException
      */
     void commit(ConflictHandler conflictHandler) throws CommitFailedException;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java?rev=1351327&r1=1351326&r2=1351327&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
Mon Jun 18 12:59:02 2012
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.oak.plugins.type;
 
+import java.util.Collections;
+import java.util.Set;
+
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.CoreValue;
@@ -23,9 +28,6 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
-import java.util.Collections;
-import java.util.Set;
-
 class TypeValidator implements Validator {
 
     private final Set<String> types;
@@ -45,8 +47,8 @@ class TypeValidator implements Validator
         for (CoreValue cv : coreValues) {
             String value = cv.getString();
             if (!types.contains(value)) {
-                // TODO: make sure NodeSuchNodeTypeException can be extracted in oak-jcr
-                throw new CommitFailedException("Unknown node type: " + value);
+                throw new CommitFailedException(
+                    new NoSuchNodeTypeException("Unknown node type: " + value));
             }
             // TODO: make sure the specified node type isn't abstract
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1351327&r1=1351326&r2=1351327&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Mon Jun 18 12:59:02 2012
@@ -294,7 +294,7 @@ public class SessionDelegate {
             currentRoot.commit(DefaultConflictHandler.OURS);
         }
         catch (CommitFailedException e) {
-            throw new RepositoryException(e);
+            e.throwRepositoryException();
         }
     }
 
@@ -331,7 +331,7 @@ public class SessionDelegate {
             }
         }
         catch (CommitFailedException e) {
-            throw new RepositoryException(e);
+            e.throwRepositoryException();
         }
     }
 



Mime
View raw message