17.07.2001 01:53:17, Remy Maucherat <[EMAIL PROTECTED]> wrote:
[snip]
>Ok, it seems that something really bad happens here. I guess we could
>add a check in the standard store, but I don't like that solution too
>much (since it's supposed to be pluggable, I don't want people to
>have to remember that they have to check for this at that time.
>
>Maybe it's a cache problem as you mentioned but I'm not 100% sure.
after more investigation, the problem is definitely in the caching
done by StandardStore: if grantPermission() is called before
enumeratePermissions() was ever called for the same object, the cache
will only contain the newly granted permission. I've made a quick fix:
First call enumeratePermissions() from within grantPermission() if the
cache doesn't yet contain an entry for the object.
not totally elegant, but it works. patchfile attached.
the same problem might exist with caching of other objects (eg
properties), but I don't have the time to check that currently :P
-chris
________________________________________________________________
[EMAIL PROTECTED]
Index: src/share/org/apache/slide/store/StandardStore.java
===================================================================
RCS file:
/home/cvspublic/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v
retrieving revision 1.12
diff -u -r1.12 StandardStore.java
--- src/share/org/apache/slide/store/StandardStore.java 2001/05/16 12:06:50 1.12
+++ src/share/org/apache/slide/store/StandardStore.java 2001/07/17 06:38:07
@@ -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;
}