remm        01/07/17 00:58:48

  Modified:    src/share/org/apache/slide/store StandardStore.java
  Log:
  - Correctly initialize the cache by calling enumeratePermissions when doing a
    grantPermission first.
    Patch submitted by Christopher Lenz <cmlenz at gmx.de>
  
  Revision  Changes    Path
  1.13      +16 -6     
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- StandardStore.java        2001/05/16 12:06:50     1.12
  +++ StandardStore.java        2001/07/17 07:58:46     1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.12 
2001/05/16 12:06:50 juergen Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/05/16 12:06:50 $
  + * $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 $
    *
    * ====================================================================
    *
  @@ -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.12 $
  + * @version $Revision: 1.13 $
    */
   public class StandardStore extends AbstractStore {
       
  @@ -241,8 +241,18 @@
               Object value = permissionsCache.get(uri.toString());
               Vector permissionsVector = null;
               if (value == null) {
  -                permissionsVector = new Vector();
  -                permissionsCache.put(uri.toString(), permissionsVector);
  +                // populate the cache with the existing entries
  +                enumeratePermissions(uri);
  +                // and see 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;
  +                }
               } else {
                   permissionsVector = (Vector) value;
               }
  
  
  

Reply via email to