Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2654

Copy operation doesn't work well if copied elements are locked

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 5.1.0.Final, 5.2.0.Final, 5.3.0.Final
    • Fix Version/s: 5.4.0.Final
    • Component/s: JCR
    • Labels:
      None
    • Environment:

      Modeshape 5.1 and WildFly.10.0.0.Final.
      It was possible to reproduce this defect on latest version of modeshape, so I think 5.2 affected also.

    • Steps to Reproduce:
      Hide

      1) Start transaction
      2) Create parent node
      3) Add child node to parent and add mixin "mix:lockable" to child node
      4) Commit transaction
      5) Start new transaction and new session
      6) Lock child node
      7) Copy parent node to new location
      8) Commit transaction
      9) Start new transaction and new session
      10)
      if you try to unlock new copy of child node, you will get exception

      javax.jcr.lock.LockException: The node at location '/newPath/child' is not locked
      
      	at org.modeshape.jcr.RepositoryLockManager.unlock(RepositoryLockManager.java:445)
      	at org.modeshape.jcr.JcrLockManager.unlock(JcrLockManager.java:305)
      	at org.modeshape.jcr.JcrLockManager.unlock(JcrLockManager.java:283) 
      

      If you try to lock new copy of child node, you will get exception:

      javax.jcr.lock.LockException: The node at '/newPath/child' is already locked
      
      	at org.modeshape.jcr.RepositoryLockManager.lock(RepositoryLockManager.java:392)
      	at org.modeshape.jcr.JcrLockManager.lock(JcrLockManager.java:273)
      	at org.modeshape.jcr.JcrLockManager.lock(JcrLockManager.java:237) 
      
      Show
      1) Start transaction 2) Create parent node 3) Add child node to parent and add mixin "mix:lockable" to child node 4) Commit transaction 5) Start new transaction and new session 6) Lock child node 7) Copy parent node to new location 8) Commit transaction 9) Start new transaction and new session 10) if you try to unlock new copy of child node, you will get exception javax.jcr.lock.LockException: The node at location '/newPath/child' is not locked at org.modeshape.jcr.RepositoryLockManager.unlock(RepositoryLockManager.java:445) at org.modeshape.jcr.JcrLockManager.unlock(JcrLockManager.java:305) at org.modeshape.jcr.JcrLockManager.unlock(JcrLockManager.java:283) If you try to lock new copy of child node, you will get exception: javax.jcr.lock.LockException: The node at '/newPath/child' is already locked at org.modeshape.jcr.RepositoryLockManager.lock(RepositoryLockManager.java:392) at org.modeshape.jcr.JcrLockManager.lock(JcrLockManager.java:273) at org.modeshape.jcr.JcrLockManager.lock(JcrLockManager.java:237)

      Description

      When you have a parent node with locked child node and then you copy parent node, you will be not able to lock or unlock new copy of child node.

      I was able to reproduce this defect with unit tests. Please find them in the attachments.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                hot Ostap Shtabura
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: