jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1197118 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AccessControlImporter.java
Date Thu, 03 Nov 2011 13:48:40 GMT
Author: jukka
Date: Thu Nov  3 13:48:39 2011
New Revision: 1197118

URL: http://svn.apache.org/viewvc?rev=1197118&view=rev
Log:
JCR-97: Improve Checkstyle conformance

Restore original if sequence in AccessControlImporter, but add explicit status quo statements
to avoid triggering empty if warnings.
Also add static imports for constants.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AccessControlImporter.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AccessControlImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AccessControlImporter.java?rev=1197118&r1=1197117&r2=1197118&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AccessControlImporter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/AccessControlImporter.java
Thu Nov  3 13:48:39 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.core.xml;
 
+import static org.apache.jackrabbit.core.security.authorization.AccessControlConstants.NT_REP_ACCESS_CONTROL;
+import static org.apache.jackrabbit.core.security.authorization.AccessControlConstants.NT_REP_PRINCIPAL_ACCESS_CONTROL;
+
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -223,20 +226,26 @@ public class AccessControlImporter exten
         } else {
             switch (status) {
                 case STATUS_AC_FOLDER:
-                    if (AccessControlConstants.NT_REP_PRINCIPAL_ACCESS_CONTROL.equals(ntName))
{
+                    if (NT_REP_ACCESS_CONTROL.equals(ntName)) {
+                        // yet another intermediate node -> keep status
+                        status = STATUS_AC_FOLDER;
+                    } else if (NT_REP_PRINCIPAL_ACCESS_CONTROL.equals(ntName)) {
                         // the start of a principal-based acl
                         status = STATUS_PRINCIPAL_AC;
-                    } else if (!AccessControlConstants.NT_REP_ACCESS_CONTROL.equals(ntName))
{
-                        // illegal node type.
+                    } else {
+                        // illegal node type -> throw exception
                         throw new ConstraintViolationException("Unexpected node type " +
ntName + ". Should be rep:AccessControl or rep:PrincipalAccessControl.");
                     }
                     checkIdMixins(childInfo);
                     break;
                 case STATUS_PRINCIPAL_AC:
-                    if (AccessControlConstants.NT_REP_ACCESS_CONTROL.equals(ntName)) {
+                    if (NT_REP_ACCESS_CONTROL.equals(ntName)) {
                         // some intermediate path between principal paths.
                         status = STATUS_AC_FOLDER;
-                    } else if (!AccessControlConstants.NT_REP_PRINCIPAL_ACCESS_CONTROL.equals(ntName))
{
+                    } else if (NT_REP_PRINCIPAL_ACCESS_CONTROL.equals(ntName)) {
+                        // principal-based ac node underneath another one -> keep status
+                        status = STATUS_PRINCIPAL_AC;
+                    } else {
                         // the start the acl definition itself
                         checkDefinition(childInfo, AccessControlConstants.N_POLICY, AccessControlConstants.NT_REP_ACL);
                         status = STATUS_ACL;



Mime
View raw message