jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1524089 - in /jackrabbit/oak/trunk/oak-jcr: pom.xml src/main/java/org/apache/jackrabbit/oak/jcr/session/ItemImpl.java
Date Tue, 17 Sep 2013 15:03:56 GMT
Author: jukka
Date: Tue Sep 17 15:03:55 2013
New Revision: 1524089

URL: http://svn.apache.org/r1524089
Log:
OAK-141: issues related to Node.refresh() as opposed to Session.refresh()

Item.refresh() should throw InvalidItemStateException when the item gets lost due to the refresh

Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/ItemImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1524089&r1=1524088&r2=1524089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Tue Sep 17 15:03:55 2013
@@ -38,7 +38,6 @@
       org.apache.jackrabbit.test.api.SessionTest#testMoveConstraintViolationExceptionDest
             <!-- OAK-132 -->
       org.apache.jackrabbit.test.api.SessionTest#testMoveLockException
       org.apache.jackrabbit.test.api.SessionUUIDTest#testSaveReferentialIntegrityException
            <!-- OAK-66 -->
-      org.apache.jackrabbit.test.api.NodeTest#testRefreshInvalidItemStateException      
              <!-- OAK-141 -->
       org.apache.jackrabbit.test.api.NodeTest#testRemoveNodeLockedItself
       org.apache.jackrabbit.test.api.NodeTest#testRemoveNodeParentLocked
       org.apache.jackrabbit.test.api.NodeUUIDTest#testSaveReferentialIntegrityException 
              <!-- OAK-66 -->

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/ItemImpl.java?rev=1524089&r1=1524088&r2=1524089&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/ItemImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/ItemImpl.java
Tue Sep 17 15:03:55 2013
@@ -31,6 +31,7 @@ import java.util.List;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
 import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
@@ -287,9 +288,27 @@ abstract class ItemImpl<T extends ItemDe
      * @see Item#refresh(boolean)
      */
     @Override
-    public void refresh(boolean keepChanges) throws RepositoryException {
+    public void refresh(final boolean keepChanges) throws RepositoryException {
         log.warn("Item#refresh is no longer supported. Please use Session#refresh");
-        getSession().refresh(keepChanges);
+        perform(new SessionOperation<Void>() {
+            @Override
+            public Void perform() throws InvalidItemStateException {
+                sessionDelegate.refresh(keepChanges);
+                if (!dlg.exists()) {
+                    throw new InvalidItemStateException(
+                            "This item no longer exists");
+                }
+                return null;
+            }
+            @Override
+            public boolean isUpdate() {
+                return true;
+            }
+            @Override
+            public boolean isRefresh() {
+                return true;
+            }
+        });
     }
 
     @Override



Mime
View raw message