jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1466404 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java
Date Wed, 10 Apr 2013 09:35:43 GMT
Author: angela
Date: Wed Apr 10 09:35:42 2013
New Revision: 1466404

URL: http://svn.apache.org/r1466404
Log:
OAK-527: permissions (ReadWriteNodeTypeManager throws RepositoryException when AccessDeniedException
is expected)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java?rev=1466404&r1=1466403&r2=1466404&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/ReadWriteNodeTypeManager.java
Wed Apr 10 09:35:42 2013
@@ -16,14 +16,10 @@
  */
 package org.apache.jackrabbit.oak.plugins.nodetype.write;
 
-import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
-
 import java.util.ArrayList;
 import java.util.List;
-
 import javax.annotation.Nonnull;
+import javax.jcr.AccessDeniedException;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -40,6 +36,10 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
 
+import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.NODE_TYPES_PATH;
+
 /**
  * {@code ReadWriteNodeTypeManager} extends the {@link ReadOnlyNodeTypeManager}
  * with support for operations that modify node types.
@@ -154,7 +154,12 @@ public abstract class ReadWriteNodeTypeM
             }
             return new NodeTypeIteratorAdapter(types);
         } catch (CommitFailedException e) {
-            throw new RepositoryException(e);
+            String message = "Failed to register node types.";
+            if (e.isAccessViolation()) {
+                throw new AccessDeniedException(message, e);
+            } else {
+                throw new RepositoryException(message, e);
+            }
         }
     }
 
@@ -187,7 +192,12 @@ public abstract class ReadWriteNodeTypeM
             root.commit();
             refresh();
         } catch (CommitFailedException e) {
-            throw new RepositoryException("Failed to unregister node type " + name, e);
+            String message = "Failed to unregister node type " + name;
+            if (e.isAccessViolation()) {
+                throw new AccessDeniedException(message, e);
+            } else {
+                throw new RepositoryException(message, e);
+            }
         }
     }
 
@@ -210,7 +220,12 @@ public abstract class ReadWriteNodeTypeM
             root.commit();
             refresh();
         } catch (CommitFailedException e) {
-            throw new RepositoryException("Failed to unregister node types", e);
+            String message = "Failed to unregister node types.";
+            if (e.isAccessViolation()) {
+                throw new AccessDeniedException(message, e);
+            } else {
+                throw new RepositoryException(message, e);
+            }
         }
     }
 }



Mime
View raw message