jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1547723 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
Date Wed, 04 Dec 2013 07:55:14 GMT
Author: angela
Date: Wed Dec  4 07:55:13 2013
New Revision: 1547723

URL: http://svn.apache.org/r1547723
Log:
OAK-1256 : Dead code in PrivilegeBitsProvider#getPrivilegeNames

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java?rev=1547723&r1=1547722&r2=1547723&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeBitsProvider.java
Wed Dec  4 07:55:13 2013
@@ -141,9 +141,12 @@ public final class PrivilegeBitsProvider
     public Set<String> getPrivilegeNames(PrivilegeBits privilegeBits) {
         if (privilegeBits == null || privilegeBits.isEmpty()) {
             return Collections.emptySet();
-        } else if (bitsToNames.containsKey(privilegeBits)) {
+        }
+
+        PrivilegeBits pb = privilegeBits.unmodifiable();
+        if (bitsToNames.containsKey(pb)) {
             // matches all built-in aggregates and single built-in privileges
-            return bitsToNames.get(privilegeBits);
+            return bitsToNames.get(pb);
         } else {
             Tree privilegesTree = getPrivilegesTree();
             if (!privilegesTree.exists()) {
@@ -157,14 +160,14 @@ public final class PrivilegeBitsProvider
             }
 
             Set<String> privilegeNames;
-            if (bitsToNames.containsKey(privilegeBits)) {
-                privilegeNames = bitsToNames.get(privilegeBits);
+            if (bitsToNames.containsKey(pb)) {
+                privilegeNames = bitsToNames.get(pb);
             } else {
                 privilegeNames = new HashSet<String>();
                 Set<String> aggregates = new HashSet<String>();
                 for (Tree child : privilegesTree.getChildren()) {
                     PrivilegeBits bits = PrivilegeBits.getInstance(child);
-                    if (privilegeBits.includes(bits)) {
+                    if (pb.includes(bits)) {
                         privilegeNames.add(child.getName());
                         if (child.hasProperty(REP_AGGREGATES)) {
                             aggregates.addAll(PrivilegeUtil.readDefinition(child).getDeclaredAggregateNames());
@@ -172,7 +175,7 @@ public final class PrivilegeBitsProvider
                     }
                 }
                 privilegeNames.removeAll(aggregates);
-                bitsToNames.put(privilegeBits.unmodifiable(), ImmutableSet.copyOf(privilegeNames));
+                bitsToNames.put(pb, ImmutableSet.copyOf(privilegeNames));
             }
             return privilegeNames;
         }



Mime
View raw message