You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Roland Kofler <ro...@systemone.at> on 2005/11/30 16:58:31 UTC

Locking/ unlocking of same name siblings not deterministic

Hi, I found that locking two same name siblings and unlocking one 
results in an unlocked other.
Is this a known bug? For better insight see the following code.

Thank you very much!!
Roland Kofler


public void testLocking() throws RepositoryException {
        Session jcrSession = ((S1SessionImpl) session).getSession();
        Node rootNode = jcrSession.getRootNode();

        Node n1 = rootNode.addNode("path");
        n1.addMixin("mix:lockable");
        Node n2 = rootNode.addNode("path");
        n2.addMixin("mix:lockable");

        jcrSession.save();

        n1.lock(true, true);
        n2.lock(true, true);

        System.out.println("n1.isLocked() = " + n1.isLocked());
        System.out.println("n2.isLocked() = " + n2.isLocked());
        assertTrue(n1.isLocked());
        assertTrue(n2.isLocked());

        n1.save();
        n1.unlock();

        System.out.println("n1.isLocked() = " + n1.isLocked());
        System.out.println("n2.isLocked() = " + n2.isLocked());
        assertFalse(n1.isLocked());
        assertTrue(n2.isLocked());
    }

Results in:

n1.isLocked() = true
n2.isLocked() = true
n1.isLocked() = true
n2.isLocked() = false


Re: Locking/ unlocking of same name siblings not deterministic

Posted by Roland Kofler <ro...@systemone.at>.
Dominique Pfister schrieb:

>I fixed this locking issue and added your code as a test unit:
>
>  org.apache.jackrabbit.test.api.lock.LockTest#testUnlockSameNameSibling
>
>Once again, thanks for reporting!
>  
>
de nada :-)
ro

>Cheers
>Dominique
>
>On 11/30/05, Dominique Pfister <do...@day.com> wrote:
>  
>
>>Hi Roland,
>>
>>yes, this is a bug, and no, it wasn't known. I created a JIRA issue:
>>
>> http://issues.apache.org/jira/browse/JCR-284
>>
>>Thank you for reporting it! I will fix it asap.
>>
>>Cheers
>>Dominique
>>
>>On 11/30/05, Roland Kofler <ro...@systemone.at> wrote:
>>    
>>
>>>Hi, I found that locking two same name siblings and unlocking one
>>>results in an unlocked other.
>>>Is this a known bug? For better insight see the following code.
>>>
>>>Thank you very much!!
>>>Roland Kofler
>>>
>>>
>>>public void testLocking() throws RepositoryException {
>>>        Session jcrSession = ((S1SessionImpl) session).getSession();
>>>        Node rootNode = jcrSession.getRootNode();
>>>
>>>        Node n1 = rootNode.addNode("path");
>>>        n1.addMixin("mix:lockable");
>>>        Node n2 = rootNode.addNode("path");
>>>        n2.addMixin("mix:lockable");
>>>
>>>        jcrSession.save();
>>>
>>>        n1.lock(true, true);
>>>        n2.lock(true, true);
>>>
>>>        System.out.println("n1.isLocked() = " + n1.isLocked());
>>>        System.out.println("n2.isLocked() = " + n2.isLocked());
>>>        assertTrue(n1.isLocked());
>>>        assertTrue(n2.isLocked());
>>>
>>>        n1.save();
>>>        n1.unlock();
>>>
>>>        System.out.println("n1.isLocked() = " + n1.isLocked());
>>>        System.out.println("n2.isLocked() = " + n2.isLocked());
>>>        assertFalse(n1.isLocked());
>>>        assertTrue(n2.isLocked());
>>>    }
>>>
>>>Results in:
>>>
>>>n1.isLocked() = true
>>>n2.isLocked() = true
>>>n1.isLocked() = true
>>>n2.isLocked() = false
>>>
>>>
>>>      
>>>
>
>  
>


Re: Locking/ unlocking of same name siblings not deterministic

Posted by Dominique Pfister <do...@day.com>.
I fixed this locking issue and added your code as a test unit:

  org.apache.jackrabbit.test.api.lock.LockTest#testUnlockSameNameSibling

Once again, thanks for reporting!

Cheers
Dominique

On 11/30/05, Dominique Pfister <do...@day.com> wrote:
> Hi Roland,
>
> yes, this is a bug, and no, it wasn't known. I created a JIRA issue:
>
>  http://issues.apache.org/jira/browse/JCR-284
>
> Thank you for reporting it! I will fix it asap.
>
> Cheers
> Dominique
>
> On 11/30/05, Roland Kofler <ro...@systemone.at> wrote:
> > Hi, I found that locking two same name siblings and unlocking one
> > results in an unlocked other.
> > Is this a known bug? For better insight see the following code.
> >
> > Thank you very much!!
> > Roland Kofler
> >
> >
> > public void testLocking() throws RepositoryException {
> >         Session jcrSession = ((S1SessionImpl) session).getSession();
> >         Node rootNode = jcrSession.getRootNode();
> >
> >         Node n1 = rootNode.addNode("path");
> >         n1.addMixin("mix:lockable");
> >         Node n2 = rootNode.addNode("path");
> >         n2.addMixin("mix:lockable");
> >
> >         jcrSession.save();
> >
> >         n1.lock(true, true);
> >         n2.lock(true, true);
> >
> >         System.out.println("n1.isLocked() = " + n1.isLocked());
> >         System.out.println("n2.isLocked() = " + n2.isLocked());
> >         assertTrue(n1.isLocked());
> >         assertTrue(n2.isLocked());
> >
> >         n1.save();
> >         n1.unlock();
> >
> >         System.out.println("n1.isLocked() = " + n1.isLocked());
> >         System.out.println("n2.isLocked() = " + n2.isLocked());
> >         assertFalse(n1.isLocked());
> >         assertTrue(n2.isLocked());
> >     }
> >
> > Results in:
> >
> > n1.isLocked() = true
> > n2.isLocked() = true
> > n1.isLocked() = true
> > n2.isLocked() = false
> >
> >
>

Re: Locking/ unlocking of same name siblings not deterministic

Posted by Dominique Pfister <do...@day.com>.
Hi Roland,

yes, this is a bug, and no, it wasn't known. I created a JIRA issue:

 http://issues.apache.org/jira/browse/JCR-284

Thank you for reporting it! I will fix it asap.

Cheers
Dominique

On 11/30/05, Roland Kofler <ro...@systemone.at> wrote:
> Hi, I found that locking two same name siblings and unlocking one
> results in an unlocked other.
> Is this a known bug? For better insight see the following code.
>
> Thank you very much!!
> Roland Kofler
>
>
> public void testLocking() throws RepositoryException {
>         Session jcrSession = ((S1SessionImpl) session).getSession();
>         Node rootNode = jcrSession.getRootNode();
>
>         Node n1 = rootNode.addNode("path");
>         n1.addMixin("mix:lockable");
>         Node n2 = rootNode.addNode("path");
>         n2.addMixin("mix:lockable");
>
>         jcrSession.save();
>
>         n1.lock(true, true);
>         n2.lock(true, true);
>
>         System.out.println("n1.isLocked() = " + n1.isLocked());
>         System.out.println("n2.isLocked() = " + n2.isLocked());
>         assertTrue(n1.isLocked());
>         assertTrue(n2.isLocked());
>
>         n1.save();
>         n1.unlock();
>
>         System.out.println("n1.isLocked() = " + n1.isLocked());
>         System.out.println("n2.isLocked() = " + n2.isLocked());
>         assertFalse(n1.isLocked());
>         assertTrue(n2.isLocked());
>     }
>
> Results in:
>
> n1.isLocked() = true
> n2.isLocked() = true
> n1.isLocked() = true
> n2.isLocked() = false
>
>