You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Christopher Lenz <cm...@gmx.de> on 2001/07/23 21:55:06 UTC

Possible Bug in LockImpl ?

Howdy,

I've stumbled over something while playing with LockImpl.isLocked().

Let's assume the object "/foo/bar" is locked by "/users/john" with 
type "/actions/write". Now I perform the following check, where the 
node variable is of type ObjectNode and represents /foo/bar.

[...]
lock.isLocked(slideToken, node, new SubjectNode("/"),
              new ActionNode("/"), false);
[...]

I want to check for any kind of lock, not just locks of type 
/actions/write, which I assumed should work just fine with the above 
code. However, this check will always return false.

I *think* I've located the problem in the isCompatible() method of 
LockImpl, line 606ff:

  // The two lock types are the same
  boolean condition3 = token1.getTypeUri()
    .startsWith(token2.getTypeUri());

This condition is evaluated to false, because
token1:
  subject "/"
  on object "/foo/bar"
  for action "/"
token2 (the actual lock):
  subject "/users/john"
  on object "/foo/bar"
  for action "/actions/write"

so... "/" doesn't start with "/actions/write", but of course the 
opposite is quite true, so it might be the wrong way around.

is this a bug or am I missing something ?

-chris
________________________________________________________________
cmlenz@gmx.de