remm        01/07/18 18:30:15

  Modified:    src/share/org/apache/slide/store StandardStore.java
  Log:
  - The recent change to the caching in StandardStore.grantPermission()
    would add the granted permission twice if enumeratePermissions() did
    actually populate the cache entry.
  - Patch submitted by Christopher Lenz <cmlenz at gmx.de>
  
  Revision  Changes    Path
  1.14      +12 -14    
jakarta-slide/src/share/org/apache/slide/store/StandardStore.java
  
  Index: StandardStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StandardStore.java        2001/07/17 07:58:46     1.13
  +++ StandardStore.java        2001/07/19 01:30:15     1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.13 
2001/07/17 07:58:46 remm Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/07/17 07:58:46 $
  + * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.14 
2001/07/19 01:30:15 remm Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/07/19 01:30:15 $
    *
    * ====================================================================
    *
  @@ -80,7 +80,7 @@
    * Abstract implementation of a store. Handles all caching operations.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
  - * @version $Revision: 1.13 $
  + * @version $Revision: 1.14 $
    */
   public class StandardStore extends AbstractStore {
       
  @@ -239,24 +239,22 @@
           if (securityStore.cacheResults()) {
               NodePermission tempPermission = permission.cloneObject();
               Object value = permissionsCache.get(uri.toString());
  -            Vector permissionsVector = null;
               if (value == null) {
                   // populate the cache with the existing entries
                   enumeratePermissions(uri);
  -                // and see if the cache contains a corresponding entry now
  +                // and check if the cache contains a corresponding entry now
                   value = permissionsCache.get(uri.toString());
                   if (value == null) {
  -                 // no permissions for the Uri in the cache, so create a new
  -                 // entry
  -                 permissionsVector = new Vector();
  -                 permissionsCache.put(uri.toString(), permissionsVector);
  -                } else {
  -                 permissionsVector = (Vector) value;
  +                    // no permissions for the Uri in the cache, so create a new
  +                    // entry
  +                    Vector permissionsVector = new Vector();
  +                    permissionsVector.addElement(tempPermission);
  +                    permissionsCache.put(uri.toString(), permissionsVector);
                   }
               } else {
  -                permissionsVector = (Vector) value;
  +                Vector permissionsVector = (Vector) value;
  +                permissionsVector.addElement(tempPermission);
               }
  -            permissionsVector.addElement(tempPermission);
           }
       }
       
  
  
  

Reply via email to