jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r537641 - in /jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src: main/java/org/apache/jackrabbit/ocm/persistence/impl/ test/java/org/apache/jackrabbit/ocm/persistence/lock/
Date Sun, 13 May 2007 19:04:38 GMT
Author: clombart
Date: Sun May 13 12:04:37 2007
New Revision: 537641

URL: http://svn.apache.org/viewvc?view=rev&rev=537641
Log:
Bug fix for JCR-909. Now, we check if the lock owner is the current session user.
Modify unit test for locks

Modified:
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java
    jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/lock/PersistenceManagerLockTest.java

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java?view=diff&rev=537641&r1=537640&r2=537641
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java
Sun May 13 12:04:37 2007
@@ -1000,8 +1000,12 @@
         if (node.isLocked()) {
             Lock lock = node.getLock();
             String lockOwner = lock.getLockOwner();
-            final String path = lock.getNode().getPath();
-            throw new LockedException(lockOwner, path);
+            
+            if (! session.getUserID().equals(lockOwner))
+            {
+                final String path = lock.getNode().getPath();
+                throw new LockedException(lockOwner, path);
+            }
         }
     }
 

Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/lock/PersistenceManagerLockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/lock/PersistenceManagerLockTest.java?view=diff&rev=537641&r1=537640&r2=537641
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/lock/PersistenceManagerLockTest.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/test/java/org/apache/jackrabbit/ocm/persistence/lock/PersistenceManagerLockTest.java
Sun May 13 12:04:37 2007
@@ -139,6 +139,17 @@
             // Check if the object is locked
             // --------------------------------------------------------------------------------
             assertFalse("the object is locked", persistenceManager.isLocked("/test"));
+
+            // --------------------------------------------------------------------------------
+            // Lock & update 
+            // --------------------------------------------------------------------------------
+            lockToken = persistenceManager.lock("/test", true, false);
+            a = (A) persistenceManager.getObject("/test");
+            a.setA1("new a1 Value");
+            persistenceManager.update(a);
+            persistenceManager.save();
+            persistenceManager.unlock("/test", lockToken);
+            
             
             // --------------------------------------------------------------------------------
             // Remove the object



Mime
View raw message