You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2015/09/04 13:51:26 UTC

svn commit: r1701224 [2/2] - in /jackrabbit/oak/branches/1.0: ./ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/lock/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/ oak-jcr/...

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/NodeImpl.java Fri Sep  4 11:51:25 2015
@@ -34,6 +34,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Binary;
@@ -109,8 +110,9 @@ public class NodeImpl<T extends NodeDele
      */
     private static final Logger LOG = LoggerFactory.getLogger(NodeImpl.class);
 
+    @CheckForNull
     public static NodeImpl<? extends NodeDelegate> createNodeOrNull(
-            NodeDelegate delegate, SessionContext context)
+            @CheckForNull NodeDelegate delegate, @Nonnull SessionContext context)
             throws RepositoryException {
         if (delegate != null) {
             return createNode(delegate, context);
@@ -119,8 +121,9 @@ public class NodeImpl<T extends NodeDele
         }
     }
 
+    @Nonnull
     public static NodeImpl<? extends NodeDelegate> createNode(
-                NodeDelegate delegate, SessionContext context)
+                @Nonnull NodeDelegate delegate, @Nonnull SessionContext context)
                 throws RepositoryException {
         PropertyDelegate pd = delegate.getPropertyOrNull(JCR_PRIMARYTYPE);
         String type = pd != null ? pd.getString() : null;
@@ -158,6 +161,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public Node getParent() throws RepositoryException {
         return perform(new NodeOperation<Node>(dlg, "getParent") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 if (node.isRoot()) {
@@ -178,7 +182,8 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public boolean isNew() {
-        return safePerform(new NodeOperation<Boolean>(dlg, "isNew") {
+        return sessionDelegate.safePerform(new NodeOperation<Boolean>(dlg, "isNew") {
+            @Nonnull
             @Override
             public Boolean perform() {
                 return node.exists() && node.getStatus() == Status.NEW;
@@ -191,7 +196,8 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public boolean isModified() {
-        return safePerform(new NodeOperation<Boolean>(dlg, "isModified") {
+        return sessionDelegate.safePerform(new NodeOperation<Boolean>(dlg, "isModified") {
+            @Nonnull
             @Override
             public Boolean perform() {
                 return node.exists() && node.getStatus() == Status.MODIFIED;
@@ -204,15 +210,14 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public void remove() throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("remove") {
+        sessionDelegate.performVoid(new ItemWriteOperation("remove") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 if (dlg.isRoot()) {
                     throw new RepositoryException("Cannot remove the root node");
                 }
 
                 dlg.remove();
-                return null;
             }
 
             @Override
@@ -251,6 +256,7 @@ public class NodeImpl<T extends NodeDele
 
         SessionImpl.checkIndexOnName(sessionContext, relPath);
         return perform(new ItemWriteOperation<Node>("addNode") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 String oakName = PathUtils.getName(oakPath);
@@ -299,9 +305,9 @@ public class NodeImpl<T extends NodeDele
 
     @Override
     public void orderBefore(final String srcChildRelPath, final String destChildRelPath) throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("orderBefore") {
+        sessionDelegate.performVoid(new ItemWriteOperation("orderBefore") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 getEffectiveNodeType().checkOrderableChildNodes();
                 String oakSrcChildRelPath = getOakPathOrThrowNotFound(srcChildRelPath);
                 String oakDestChildRelPath = null;
@@ -309,7 +315,7 @@ public class NodeImpl<T extends NodeDele
                     oakDestChildRelPath = getOakPathOrThrowNotFound(destChildRelPath);
                 }
                 dlg.orderBefore(oakSrcChildRelPath, oakDestChildRelPath);
-                return null;
+
             }
         });
     }
@@ -522,6 +528,7 @@ public class NodeImpl<T extends NodeDele
     public Node getNode(String relPath) throws RepositoryException {
         final String oakPath = getOakPathOrThrowNotFound(relPath);
         return perform(new NodeOperation<Node>(dlg, "getNode") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 NodeDelegate nd = node.getChild(oakPath);
@@ -538,6 +545,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public NodeIterator getNodes() throws RepositoryException {
         return perform(new NodeOperation<NodeIterator>(dlg, "getNodes") {
+            @Nonnull
             @Override
             public NodeIterator perform() throws RepositoryException {
                 Iterator<NodeDelegate> children = node.getChildren();
@@ -568,6 +576,7 @@ public class NodeImpl<T extends NodeDele
     public NodeIterator getNodes(final String namePattern)
             throws RepositoryException {
         return perform(new NodeOperation<NodeIterator>(dlg, "getNodes") {
+            @Nonnull
             @Override
             public NodeIterator perform() throws RepositoryException {
                 Iterator<NodeDelegate> children = Iterators.filter(
@@ -588,6 +597,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public NodeIterator getNodes(final String[] nameGlobs) throws RepositoryException {
         return perform(new NodeOperation<NodeIterator>(dlg, "getNodes") {
+            @Nonnull
             @Override
             public NodeIterator perform() throws RepositoryException {
                 Iterator<NodeDelegate> children = Iterators.filter(
@@ -609,6 +619,7 @@ public class NodeImpl<T extends NodeDele
     public Property getProperty(String relPath) throws RepositoryException {
         final String oakPath = getOakPathOrThrowNotFound(relPath);
         return perform(new NodeOperation<PropertyImpl>(dlg, "getProperty") {
+            @Nonnull
             @Override
             public PropertyImpl perform() throws RepositoryException {
                 PropertyDelegate pd = node.getPropertyOrNull(oakPath);
@@ -626,6 +637,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public PropertyIterator getProperties() throws RepositoryException {
         return perform(new NodeOperation<PropertyIterator>(dlg, "getProperties") {
+            @Nonnull
             @Override
             public PropertyIterator perform() throws RepositoryException {
                 Iterator<PropertyDelegate> properties = node.getProperties();
@@ -640,6 +652,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public PropertyIterator getProperties(final String namePattern) throws RepositoryException {
         return perform(new NodeOperation<PropertyIterator>(dlg, "getProperties") {
+            @Nonnull
             @Override
             public PropertyIterator perform() throws RepositoryException {
                 Iterator<PropertyDelegate> properties = Iterators.filter(
@@ -660,6 +673,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public PropertyIterator getProperties(final String[] nameGlobs) throws RepositoryException {
         return perform(new NodeOperation<PropertyIterator>(dlg, "getProperties") {
+            @Nonnull
             @Override
             public PropertyIterator perform() throws RepositoryException {
                 Iterator<PropertyDelegate> propertyNames = Iterators.filter(
@@ -683,6 +697,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public Item getPrimaryItem() throws RepositoryException {
         return perform(new NodeOperation<Item>(dlg, "getPrimaryItem") {
+            @Nonnull
             @Override
             public Item perform() throws RepositoryException {
                 // TODO: avoid nested calls
@@ -711,6 +726,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public String getUUID() throws RepositoryException {
         return perform(new NodeOperation<String>(dlg, "getUUID") {
+            @Nonnull
             @Override
             public String perform() throws RepositoryException {
                 // TODO: avoid nested calls
@@ -727,6 +743,7 @@ public class NodeImpl<T extends NodeDele
     public String getIdentifier() throws RepositoryException {
         // TODO: name mapping for path identifiers
         return perform(new NodeOperation<String>(dlg, "getIdentifier") {
+            @Nonnull
             @Override
             public String perform() throws RepositoryException {
                 return node.getIdentifier();
@@ -742,6 +759,7 @@ public class NodeImpl<T extends NodeDele
 
     private PropertyIterator internalGetReferences(final String name, final boolean weak) throws RepositoryException {
         return perform(new NodeOperation<PropertyIterator>(dlg, "internalGetReferences") {
+            @Nonnull
             @Override
             public PropertyIterator perform() throws InvalidItemStateException {
                 IdentifierManager idManager = sessionDelegate.getIdManager();
@@ -798,6 +816,7 @@ public class NodeImpl<T extends NodeDele
         try {
             final String oakPath = getOakPathOrThrow(relPath);
             return perform(new NodeOperation<Boolean>(dlg, "hasNode") {
+                @Nonnull
                 @Override
                 public Boolean perform() throws RepositoryException {
                     return node.getChild(oakPath) != null;
@@ -813,6 +832,7 @@ public class NodeImpl<T extends NodeDele
         try {
             final String oakPath = getOakPathOrThrow(relPath);
             return perform(new NodeOperation<Boolean>(dlg, "hasProperty") {
+                @Nonnull
                 @Override
                 public Boolean perform() throws RepositoryException {
                     return node.getPropertyOrNull(oakPath) != null;
@@ -831,6 +851,7 @@ public class NodeImpl<T extends NodeDele
     @Override
     public boolean hasProperties() throws RepositoryException {
         return perform(new NodeOperation<Boolean>(dlg, "hasProperties") {
+            @Nonnull
             @Override
             public Boolean perform() throws RepositoryException {
                 return node.getPropertyCount() != 0;
@@ -845,6 +866,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public NodeType getPrimaryNodeType() throws RepositoryException {
         return perform(new NodeOperation<NodeType>(dlg, "getPrimaryNodeType") {
+            @Nonnull
             @Override
             public NodeType perform() throws RepositoryException {
                 // TODO: avoid nested calls
@@ -866,6 +888,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public NodeType[] getMixinNodeTypes() throws RepositoryException {
         return perform(new NodeOperation<NodeType[]>(dlg, "getMixinNodeTypes") {
+            @Nonnull
             @Override
             public NodeType[] perform() throws RepositoryException {
                 // TODO: avoid nested calls
@@ -889,6 +912,7 @@ public class NodeImpl<T extends NodeDele
     public boolean isNodeType(String nodeTypeName) throws RepositoryException {
         final String oakName = getOakName(nodeTypeName);
         return perform(new NodeOperation<Boolean>(dlg, "isNodeType") {
+            @Nonnull
             @Override
             public Boolean perform() throws RepositoryException {
                 return getNodeTypeManager().isNodeType(node.getTree(), oakName);
@@ -898,7 +922,7 @@ public class NodeImpl<T extends NodeDele
 
     @Override
     public void setPrimaryType(final String nodeTypeName) throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("setPrimaryType") {
+        sessionDelegate.performVoid(new ItemWriteOperation("setPrimaryType") {
             @Override
             public void checkPreconditions() throws RepositoryException {
                 super.checkPreconditions();
@@ -908,9 +932,8 @@ public class NodeImpl<T extends NodeDele
             }
 
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 internalSetPrimaryType(nodeTypeName);
-                return null;
             }
         });
     }
@@ -918,7 +941,7 @@ public class NodeImpl<T extends NodeDele
     @Override
     public void addMixin(String mixinName) throws RepositoryException {
         final String oakTypeName = getOakName(checkNotNull(mixinName));
-        perform(new ItemWriteOperation<Void>("addMixin") {
+        sessionDelegate.performVoid(new ItemWriteOperation("addMixin") {
             @Override
             public void checkPreconditions() throws RepositoryException {
                 super.checkPreconditions();
@@ -928,9 +951,8 @@ public class NodeImpl<T extends NodeDele
                 }
             }
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 dlg.addMixin(oakTypeName);
-                return null;
             }
         });
     }
@@ -938,7 +960,7 @@ public class NodeImpl<T extends NodeDele
     @Override
     public void removeMixin(final String mixinName) throws RepositoryException {
         final String oakTypeName = getOakName(checkNotNull(mixinName));
-        perform(new ItemWriteOperation<Void>("removeMixin") {
+        sessionDelegate.performVoid(new ItemWriteOperation("removeMixin") {
             @Override
             public void checkPreconditions() throws RepositoryException {
                 super.checkPreconditions();
@@ -958,9 +980,8 @@ public class NodeImpl<T extends NodeDele
                 }
             }
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 dlg.removeMixin(oakTypeName);
-                return null;
             }
         });
     }
@@ -969,6 +990,7 @@ public class NodeImpl<T extends NodeDele
     public boolean canAddMixin(String mixinName) throws RepositoryException {
         final String oakTypeName = getOakName(mixinName);
         return perform(new NodeOperation<Boolean>(dlg, "canAddMixin") {
+            @Nonnull
             @Override
             public Boolean perform() throws RepositoryException {
                 PropertyState prop = PropertyStates.createProperty(JCR_MIXINTYPES, singleton(oakTypeName), NAMES);
@@ -985,6 +1007,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public NodeDefinition getDefinition() throws RepositoryException {
         return perform(new NodeOperation<NodeDefinition>(dlg, "getDefinition") {
+            @Nonnull
             @Override
             public NodeDefinition perform() throws RepositoryException {
                 NodeDelegate parent = node.getParent();
@@ -1002,6 +1025,7 @@ public class NodeImpl<T extends NodeDele
     @Nonnull
     public String getCorrespondingNodePath(final String workspaceName) throws RepositoryException {
         return toJcrPath(perform(new ItemOperation<String>(dlg, "getCorrespondingNodePath") {
+            @Nonnull
             @Override
             public String perform() throws RepositoryException {
                 checkValidWorkspace(workspaceName);
@@ -1017,9 +1041,9 @@ public class NodeImpl<T extends NodeDele
 
     @Override
     public void update(final String srcWorkspace) throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("update") {
+        sessionDelegate.performVoid(new ItemWriteOperation("update") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 checkValidWorkspace(srcWorkspace);
 
                 // check for pending changes
@@ -1032,7 +1056,6 @@ public class NodeImpl<T extends NodeDele
                 if (!srcWorkspace.equals(sessionDelegate.getWorkspaceName())) {
                     throw new UnsupportedRepositoryOperationException("OAK-118: Node.update");
                 }
-                return null;
             }
         });
     }
@@ -1200,15 +1223,14 @@ public class NodeImpl<T extends NodeDele
 
     @Override
     public void removeSharedSet() throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("removeSharedSet") {
+        sessionDelegate.performVoid(new ItemWriteOperation("removeSharedSet") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 // TODO: avoid nested calls
                 NodeIterator sharedSet = getSharedSet();
                 while (sharedSet.hasNext()) {
                     sharedSet.nextNode().removeShare();
                 }
-                return null;
             }
         });
     }
@@ -1303,6 +1325,7 @@ public class NodeImpl<T extends NodeDele
                             "Cannot set property. Node is checked in.");
                 }
             }
+            @Nonnull
             @Override
             public Property perform() throws RepositoryException {
                 return new PropertyImpl(
@@ -1338,6 +1361,7 @@ public class NodeImpl<T extends NodeDele
                             "Cannot set property. Node is checked in.");
                 }
             }
+            @Nonnull
             @Override
             public Property perform() throws RepositoryException {
                 return new PropertyImpl(
@@ -1373,6 +1397,7 @@ public class NodeImpl<T extends NodeDele
             throws RepositoryException {
         final String oakName = getOakName(checkNotNull(jcrName));
         return perform(new ItemWriteOperation<Property>("internalRemoveProperty") {
+            @Nonnull
             @Override
             public Property perform() throws RepositoryException {
                 PropertyDelegate property = dlg.getPropertyOrNull(oakName);
@@ -1422,9 +1447,9 @@ public class NodeImpl<T extends NodeDele
             return;
         }
 
-        perform(new ItemWriteOperation<Void>("rename") {
+        sessionDelegate.performVoid(new ItemWriteOperation("rename") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 Node parent = getParent();
                 String beforeName = null;
 
@@ -1454,7 +1479,6 @@ public class NodeImpl<T extends NodeDele
                     // restore position within siblings
                     parent.orderBefore(newName, beforeName);
                 }
-                return null;
             }
         });
     }
@@ -1490,7 +1514,7 @@ public class NodeImpl<T extends NodeDele
         for (String mixinName : mixinNames) {
             oakTypeNames.add(getOakName(checkNotNull(mixinName)));
         }
-        perform(new ItemWriteOperation<Void>("setMixins") {
+        sessionDelegate.performVoid(new ItemWriteOperation("setMixins") {
             @Override
             public void checkPreconditions() throws RepositoryException {
                 super.checkPreconditions();
@@ -1508,9 +1532,8 @@ public class NodeImpl<T extends NodeDele
                 }
             }
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 dlg.setMixins(oakTypeNames);
-                return null;
             }
         });
     }

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/PropertyImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/PropertyImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/PropertyImpl.java Fri Sep  4 11:51:25 2015
@@ -71,6 +71,7 @@ public class PropertyImpl extends ItemIm
     @Nonnull
     public Node getParent() throws RepositoryException {
         return perform(new PropertyOperation<Node>(dlg, "getParent") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 NodeDelegate parent = property.getParent();
@@ -85,7 +86,8 @@ public class PropertyImpl extends ItemIm
 
     @Override
     public boolean isNew() {
-        return safePerform(new PropertyOperation<Boolean>(dlg, "isNew") {
+        return sessionDelegate.safePerform(new PropertyOperation<Boolean>(dlg, "isNew") {
+            @Nonnull
             @Override
             public Boolean perform() {
                 return property.getStatus() == Status.NEW;
@@ -95,7 +97,8 @@ public class PropertyImpl extends ItemIm
 
     @Override
     public boolean isModified() {
-        return safePerform(new PropertyOperation<Boolean>(dlg, "isModified") {
+        return sessionDelegate.safePerform(new PropertyOperation<Boolean>(dlg, "isModified") {
+            @Nonnull
             @Override
             public Boolean perform() {
                 return property.getStatus() == Status.MODIFIED;
@@ -105,11 +108,10 @@ public class PropertyImpl extends ItemIm
 
     @Override
     public void remove() throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("remove") {
+        sessionDelegate.performVoid(new ItemWriteOperation("remove") {
             @Override
-            public Void perform() {
+            public void performVoid() {
                 dlg.remove();
-                return null;
             }
 
             @Override
@@ -233,6 +235,7 @@ public class PropertyImpl extends ItemIm
     @Nonnull
     public Value getValue() throws RepositoryException {
         return perform(new PropertyOperation<Value>(dlg, "getValue") {
+            @Nonnull
             @Override
             public Value perform() throws RepositoryException {
                 return ValueFactoryImpl.createValue(
@@ -245,6 +248,7 @@ public class PropertyImpl extends ItemIm
     @Nonnull
     public Value[] getValues() throws RepositoryException {
         return perform(new PropertyOperation<List<Value>>(dlg, "getValues") {
+            @Nonnull
             @Override
             public List<Value> perform() throws RepositoryException {
                 return ValueFactoryImpl.createValues(
@@ -303,6 +307,7 @@ public class PropertyImpl extends ItemIm
     @Nonnull
     public Node getNode() throws RepositoryException {
         return perform(new PropertyOperation<Node>(dlg, "getNode") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 // TODO: avoid nested calls
@@ -356,6 +361,7 @@ public class PropertyImpl extends ItemIm
     @Nonnull
     public Property getProperty() throws RepositoryException {
         return perform(new PropertyOperation<Property>(dlg, "getProperty") {
+            @Nonnull
             @Override
             public Property perform() throws RepositoryException {
                 // TODO: avoid nested calls
@@ -392,6 +398,7 @@ public class PropertyImpl extends ItemIm
     @Nonnull
     public PropertyDefinition getDefinition() throws RepositoryException {
         return perform(new PropertyOperation<PropertyDefinition>(dlg, "getDefinition") {
+            @Nonnull
             @Override
             public PropertyDefinition perform() throws RepositoryException {
                 return getNodeTypeManager().getDefinition(
@@ -404,6 +411,7 @@ public class PropertyImpl extends ItemIm
     @Override
     public int getType() throws RepositoryException {
         return perform(new PropertyOperation<Integer>(dlg, "getType") {
+            @Nonnull
             @Override
             public Integer perform() throws RepositoryException {
                 return property.getPropertyState().getType().tag();
@@ -414,6 +422,7 @@ public class PropertyImpl extends ItemIm
     @Override
     public boolean isMultiple() throws RepositoryException {
         return perform(new PropertyOperation<Boolean>(dlg, "isMultiple") {
+            @Nonnull
             @Override
             public Boolean perform() throws RepositoryException {
                 return property.getPropertyState().isArray();
@@ -440,9 +449,9 @@ public class PropertyImpl extends ItemIm
 
     private void internalSetValue(@Nonnull final Value value)
             throws RepositoryException {
-        perform(new ItemWriteOperation<Void>("internalSetValue") {
+        sessionDelegate.performVoid(new ItemWriteOperation("internalSetValue") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 Type<?> type = dlg.getPropertyState().getType();
                 if (type.isArray()) {
                     throw new ValueFormatException(
@@ -452,7 +461,6 @@ public class PropertyImpl extends ItemIm
                 Value converted = ValueHelper.convert(
                         value, type.tag(), getValueFactory());
                 dlg.setState(createSingleState(dlg.getName(), converted, type));
-                return null;
             }
 
             @Override
@@ -468,9 +476,9 @@ public class PropertyImpl extends ItemIm
             LOG.warn("Large multi valued property [{}] detected ({} values).",dlg.getPath(), values.length);
         }
 
-        perform(new ItemWriteOperation<Void>("internalSetValue") {
+        sessionDelegate.performVoid(new ItemWriteOperation("internalSetValue") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 Type<?> type = dlg.getPropertyState().getType();
                 if (!type.isArray()) {
                     throw new ValueFormatException(
@@ -486,7 +494,6 @@ public class PropertyImpl extends ItemIm
                     }
                 }
                 dlg.setState(createMultiState(dlg.getName(), converted, type));
-                return null;
             }
 
             @Override

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionContext.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionContext.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionContext.java Fri Sep  4 11:51:25 2015
@@ -394,9 +394,9 @@ public class SessionContext implements N
      */
     // TODO: should this be in SessionImpl?
     private void unlockAllSessionScopedLocks() throws RepositoryException {
-        delegate.perform(new SessionOperation<Void>("unlockAllSessionScopedLocks") {
+        delegate.performVoid(new SessionOperation("unlockAllSessionScopedLocks") {
             @Override
-            public Void perform() {
+            public void performVoid() {
                 Iterator<String> iterator = sessionScopedLocks.iterator();
                 while (iterator.hasNext()) {
                     NodeDelegate node = delegate.getNode(iterator.next());
@@ -409,7 +409,6 @@ public class SessionContext implements N
                     }
                     iterator.remove();
                 }
-                return null;
             }
         });
     }

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java Fri Sep  4 11:51:25 2015
@@ -122,16 +122,6 @@ public class SessionImpl implements Jack
         }
     }
 
-    @CheckForNull
-    private <T> T perform(@Nonnull SessionOperation<T> op) throws RepositoryException {
-        return sd.perform(op);
-    }
-
-    @CheckForNull
-    private <T> T safePerform(@Nonnull SessionOperation<T> op) {
-        return sd.safePerform(op);
-    }
-
     @Nonnull
     private String getOakPathOrThrow(String absPath) throws RepositoryException {
         String p = sessionContext.getOakPathOrThrow(absPath);
@@ -169,9 +159,9 @@ public class SessionImpl implements Jack
      */
     @CheckForNull
     public Node getNodeOrNull(final String absPath) throws RepositoryException {
-        return perform(new ReadOperation<Node>("getNodeOrNull") {
+        return sd.performNullable(new ReadOperation<Node>("getNodeOrNull") {
             @Override
-            public Node perform() throws RepositoryException {
+            public Node performNullable() throws RepositoryException {
                 try {
                     return NodeImpl.createNodeOrNull(sd.getNode(getOakPathOrThrow(absPath)), sessionContext);
                 } catch (PathNotFoundException e) {
@@ -200,9 +190,9 @@ public class SessionImpl implements Jack
             } catch (PathNotFoundException e) {
                 return null;
             }
-            return perform(new ReadOperation<Property>("getPropertyOrNull") {
+            return sd.performNullable(new ReadOperation<Property>("getPropertyOrNull") {
                 @Override
-                public Property perform() throws RepositoryException {
+                public Property performNullable() {
                     PropertyDelegate pd = sd.getProperty(oakPath);
                     if (pd != null) {
                         return new PropertyImpl(pd, sessionContext);
@@ -225,9 +215,9 @@ public class SessionImpl implements Jack
      */
     @CheckForNull
     public Item getItemOrNull(final String absPath) throws RepositoryException {
-        return perform(new ReadOperation<Item>("getItemOrNull") {
+        return sd.performNullable(new ReadOperation<Item>("getItemOrNull") {
             @Override
-            public Item perform() throws RepositoryException {
+            public Item performNullable() throws RepositoryException {
                 return getItemInternal(getOakPathOrThrow(absPath));
             }
         });
@@ -286,14 +276,15 @@ public class SessionImpl implements Jack
     @Override
     @Nonnull
     public Node getRootNode() throws RepositoryException {
-        return perform(new ReadOperation<Node>("getRootNode") {
+        return sd.perform(new ReadOperation<Node>("getRootNode") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 NodeDelegate nd = sd.getRootNode();
                 if (nd == null) {
                     throw new AccessDeniedException("Root node is not accessible.");
                 }
-                return NodeImpl.createNodeOrNull(nd, sessionContext);
+                return NodeImpl.createNode(nd, sessionContext);
             }
         });
     }
@@ -314,14 +305,15 @@ public class SessionImpl implements Jack
 
     @Nonnull
     private Node getNodeById(final String id) throws RepositoryException {
-        return perform(new ReadOperation<Node>("getNodeById") {
+        return sd.perform(new ReadOperation<Node>("getNodeById") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
                 NodeDelegate nd = sd.getNodeByIdentifier(id);
                 if (nd == null) {
                     throw new ItemNotFoundException("Node with id " + id + " does not exist.");
                 }
-                return NodeImpl.createNodeOrNull(nd, sessionContext);
+                return NodeImpl.createNode(nd, sessionContext);
             }
         });
     }
@@ -371,7 +363,7 @@ public class SessionImpl implements Jack
         checkIndexOnName(sessionContext, destAbsPath);
         final String srcOakPath = getOakPathOrThrowNotFound(srcAbsPath);
         final String destOakPath = getOakPathOrThrowNotFound(destAbsPath);
-        sd.perform(new WriteOperation<Void>("move") {
+        sd.performVoid(new WriteOperation("move") {
             @Override
             public void checkPreconditions() throws RepositoryException {
                 super.checkPreconditions();
@@ -380,9 +372,8 @@ public class SessionImpl implements Jack
             }
 
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 sd.move(srcOakPath, destOakPath, true);
-                return null;
             }
         });
     }
@@ -390,18 +381,16 @@ public class SessionImpl implements Jack
     @Override
     public void removeItem(final String absPath) throws RepositoryException {
         final String oakPath = getOakPathOrThrowNotFound(absPath);
-        perform(new WriteOperation<Void>("removeItem") {
+        sd.performVoid(new WriteOperation("removeItem") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 ItemDelegate item = sd.getItem(oakPath);
                 if (item == null) {
                     throw new PathNotFoundException(absPath);
                 } else if (item.isProtected()) {
                     throw new ConstraintViolationException(
                             item.getPath() + " is protected");
-                } else if (item.remove()) {
-                    return null;
-                } else {
+                } else if (!item.remove()) {
                     throw new RepositoryException(
                             item.getPath() + " could not be removed");
                 }
@@ -411,11 +400,10 @@ public class SessionImpl implements Jack
 
     @Override
     public void save() throws RepositoryException {
-        perform(new WriteOperation<Void>("save") {
+        sd.performVoid(new WriteOperation("save") {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 sd.save(null);
-                return null;
             }
 
             @Override
@@ -427,11 +415,10 @@ public class SessionImpl implements Jack
 
     @Override
     public void refresh(final boolean keepChanges) throws RepositoryException {
-        perform(new WriteOperation<Void>("refresh") {
+        sd.performVoid(new WriteOperation("refresh") {
             @Override
-            public Void perform() {
+            public void performVoid() {
                 sd.refresh(keepChanges);
-                return null;
             }
 
             @Override
@@ -457,19 +444,22 @@ public class SessionImpl implements Jack
     public void logout() {
         if (sd.isAlive()) {
             sessionCounter.decrementAndGet();
-            safePerform(new SessionOperation<Void>("logout") {
-                @Override
-                public Void perform() {
-                    sessionContext.dispose();
-                    sd.logout();
-                    return null;
-                }
+            try {
+                sd.performVoid(new SessionOperation("logout") {
+                    @Override
+                    public void performVoid() {
+                        sessionContext.dispose();
+                        sd.logout();
+                    }
 
-                @Override
-                public boolean isLogout() {
-                    return true;
-                }
-            });
+                    @Override
+                    public boolean isLogout() {
+                        return true;
+                    }
+                });
+            } catch (RepositoryException e) {
+                throw new RuntimeException("Unexpected exception thrown by operation 'logout'", e);
+            }
         }
     }
 
@@ -603,7 +593,8 @@ public class SessionImpl implements Jack
     @Override
     public boolean hasPermission(String absPath, final String actions) throws RepositoryException {
         final String oakPath = getOakPathOrThrow(absPath);
-        return perform(new ReadOperation<Boolean>("hasPermission") {
+        return sd.perform(new ReadOperation<Boolean>("hasPermission") {
+            @Nonnull
             @Override
             public Boolean perform() throws RepositoryException {
                 return sessionContext.getAccessManager().hasPermissions(oakPath, actions);

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/WorkspaceImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/WorkspaceImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/WorkspaceImpl.java Fri Sep  4 11:51:25 2015
@@ -137,7 +137,7 @@ public class WorkspaceImpl implements Ja
             throw new UnsupportedRepositoryOperationException("Not implemented.");
         }
 
-        sessionDelegate.perform(new SessionOperation<Object>("copy", true) {
+        sessionDelegate.performVoid(new SessionOperation("copy", true) {
             @Override
             public void checkPreconditions() throws RepositoryException {
                 super.checkPreconditions();
@@ -145,14 +145,13 @@ public class WorkspaceImpl implements Ja
             }
 
             @Override
-            public Object perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 sessionDelegate.checkProtectedNode(getParentPath(srcOakPath));
                 sessionDelegate.checkProtectedNode(getParentPath(destOakPath));
 
                 SessionImpl.checkIndexOnName(sessionContext, destAbsPath);
 
                 workspaceDelegate.copy(srcOakPath, destOakPath);
-                return null;
             }
         });
 
@@ -163,7 +162,7 @@ public class WorkspaceImpl implements Ja
         final String srcOakPath = getOakPathOrThrowNotFound(srcAbsPath);
         final String destOakPath = getOakPathOrThrowNotFound(destAbsPath);
 
-        sessionDelegate.perform(new SessionOperation<Object>("clone", true) {
+        sessionDelegate.performVoid(new SessionOperation("clone", true) {
 
             @Override
             public void checkPreconditions() throws RepositoryException {
@@ -172,7 +171,7 @@ public class WorkspaceImpl implements Ja
             }
 
             @Override
-            public Object perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 sessionDelegate.checkProtectedNode(getParentPath(srcOakPath));
                 sessionDelegate.checkProtectedNode(getParentPath(destOakPath));
                 throw new UnsupportedRepositoryOperationException("Not implemented.");

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java Fri Sep  4 11:51:25 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.jackrabbit.oak.jcr.session.operation;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import javax.jcr.RepositoryException;
 
 /**
@@ -28,12 +30,12 @@ public abstract class SessionOperation<T
     private final String name;
     private final boolean update;
 
-    protected SessionOperation(String name, boolean update) {
+    protected SessionOperation(@Nonnull String name, boolean update) {
         this.name = name;
         this.update = update;
     }
 
-    protected SessionOperation(String name) {
+    protected SessionOperation(@Nonnull String name) {
         this(name, false);
     }
 
@@ -62,7 +64,19 @@ public abstract class SessionOperation<T
     public void checkPreconditions() throws RepositoryException {
     }
 
-    public abstract T perform() throws RepositoryException;
+    @Nonnull
+    public T perform() throws RepositoryException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Nullable
+    public T performNullable() throws RepositoryException {
+        throw new UnsupportedOperationException();
+    }
+
+    public void performVoid() throws RepositoryException {
+        throw new UnsupportedOperationException();
+    }
 
     /**
      * Provide details about the operation being performed.

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionHistoryImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionHistoryImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionHistoryImpl.java Fri Sep  4 11:51:25 2015
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
 import javax.jcr.NodeIterator;
 import javax.jcr.ReferentialIntegrityException;
@@ -61,6 +62,7 @@ public class VersionHistoryImpl extends
     @Override
     public String getVersionableIdentifier() throws RepositoryException {
         return perform(new SessionOperation<String>("getVersionableIdentifier") {
+            @Nonnull
             @Override
             public String perform() throws RepositoryException {
                 return dlg.getVersionableIdentifier();
@@ -71,6 +73,7 @@ public class VersionHistoryImpl extends
     @Override
     public Version getRootVersion() throws RepositoryException {
         return perform(new SessionOperation<Version>("getRootVersion") {
+            @Nonnull
             @Override
             public Version perform() throws RepositoryException {
                 return new VersionImpl(dlg.getRootVersion(), sessionContext);
@@ -81,6 +84,7 @@ public class VersionHistoryImpl extends
     @Override
     public VersionIterator getAllLinearVersions() throws RepositoryException {
         return perform(new SessionOperation<VersionIterator>("getAllLinearVersions") {
+            @Nonnull
             @Override
             public VersionIterator perform() throws RepositoryException {
                 Iterator<Version> versions = transform(dlg.getAllLinearVersions(),
@@ -98,6 +102,7 @@ public class VersionHistoryImpl extends
     @Override
     public VersionIterator getAllVersions() throws RepositoryException {
         return perform(new SessionOperation<VersionIterator>("getAllVersions") {
+            @Nonnull
             @Override
             public VersionIterator perform() throws RepositoryException {
                 Iterator<Version> versions = transform(dlg.getAllVersions(),
@@ -126,6 +131,7 @@ public class VersionHistoryImpl extends
     public Version getVersion(final String versionName)
             throws VersionException, RepositoryException {
         return perform(new SessionOperation<Version>("getVersion") {
+            @Nonnull
             @Override
             public Version perform() throws RepositoryException {
                 return new VersionImpl(dlg.getVersion(versionName), sessionContext);
@@ -137,6 +143,7 @@ public class VersionHistoryImpl extends
     public Version getVersionByLabel(final String label)
             throws VersionException, RepositoryException {
         return perform(new SessionOperation<Version>("getVersionByLabel") {
+            @Nonnull
             @Override
             public Version perform() throws RepositoryException {
                 String oakLabel = sessionContext.getOakName(label);
@@ -151,14 +158,13 @@ public class VersionHistoryImpl extends
                                 final boolean moveLabel)
             throws LabelExistsVersionException, VersionException,
             RepositoryException {
-        perform(new SessionOperation<Void>("addVersionLabel", true) {
+        sessionDelegate.performVoid(new SessionOperation("addVersionLabel", true) {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 String oakLabel = sessionContext.getOakName(label);
                 // will throw VersionException if version does not exist
                 VersionDelegate version = dlg.getVersion(versionName);
                 dlg.addVersionLabel(version, oakLabel, moveLabel);
-                return null;
             }
         });
     }
@@ -166,12 +172,11 @@ public class VersionHistoryImpl extends
     @Override
     public void removeVersionLabel(final String label)
             throws VersionException, RepositoryException {
-        perform(new SessionOperation<Void>("removeVersionLabel", true) {
+        sessionDelegate.performVoid(new SessionOperation("removeVersionLabel", true) {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 String oakLabel = sessionContext.getOakName(label);
                 dlg.removeVersionLabel(oakLabel);
-                return null;
             }
         });
     }
@@ -190,6 +195,7 @@ public class VersionHistoryImpl extends
     @Override
     public String[] getVersionLabels() throws RepositoryException {
         return perform(new SessionOperation<String[]>("getVersionLabels") {
+            @Nonnull
             @Override
             public String[] perform() throws RepositoryException {
                 List<String> labels = new ArrayList<String>();
@@ -209,6 +215,7 @@ public class VersionHistoryImpl extends
                     "VersionHistory");
         }
         return perform(new SessionOperation<String[]>("getVersionLabels") {
+            @Nonnull
             @Override
             public String[] perform() throws RepositoryException {
                 List<String> labels = new ArrayList<String>();
@@ -226,12 +233,11 @@ public class VersionHistoryImpl extends
             UnsupportedRepositoryOperationException, VersionException,
             RepositoryException {
 
-        perform(new SessionOperation<Void>("removeVersion", true) {
+        sessionDelegate.performVoid(new SessionOperation("removeVersion", true) {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 String oakName = sessionContext.getOakName(versionName);
                 dlg.removeVersion(oakName);
-                return null;
             }
         });
     }

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionImpl.java Fri Sep  4 11:51:25 2015
@@ -33,6 +33,7 @@ import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 
 import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
 import org.apache.jackrabbit.oak.jcr.session.NodeImpl;
 import org.apache.jackrabbit.oak.jcr.session.SessionContext;
 import org.apache.jackrabbit.oak.jcr.delegate.PropertyDelegate;
@@ -52,6 +53,7 @@ public class VersionImpl extends NodeImp
     @Override
     public VersionHistory getContainingHistory() throws RepositoryException {
         return perform(new SessionOperation<VersionHistory>("getContainingHistory") {
+            @Nonnull
             @Override
             public VersionHistory perform() throws RepositoryException {
                 return new VersionHistoryImpl(
@@ -64,6 +66,7 @@ public class VersionImpl extends NodeImp
     @Override
     public Calendar getCreated() throws RepositoryException {
         return sessionDelegate.perform(new SessionOperation<Calendar>("getCreated") {
+            @Nonnull
             @Override
             public Calendar perform() throws RepositoryException {
                 PropertyDelegate dlg = getPropertyOrThrow(JcrConstants.JCR_CREATED);
@@ -74,9 +77,9 @@ public class VersionImpl extends NodeImp
 
     @Override
     public Version getLinearPredecessor() throws RepositoryException {
-        return perform(new SessionOperation<Version>("getLinearPredecessor") {
+        return sessionDelegate.performNullable(new SessionOperation<Version>("getLinearPredecessor") {
             @Override
-            public Version perform() throws RepositoryException {
+            public Version performNullable() throws RepositoryException {
                 VersionDelegate predecessor = dlg.getLinearPredecessor();
                 if (predecessor == null) {
                     return null;
@@ -89,9 +92,9 @@ public class VersionImpl extends NodeImp
 
     @Override
     public Version getLinearSuccessor() throws RepositoryException {
-        return perform(new SessionOperation<Version>("getLinearSuccessor") {
+        return sessionDelegate.performNullable(new SessionOperation<Version>("getLinearSuccessor") {
             @Override
-            public Version perform() throws RepositoryException {
+            public Version performNullable() throws RepositoryException {
                 VersionHistoryDelegate vHistory = getVersionManagerDelegate()
                         .createVersionHistory(dlg.getParent());
                 Iterator<VersionDelegate> it = vHistory.getAllLinearVersions();
@@ -117,6 +120,7 @@ public class VersionImpl extends NodeImp
     @Override
     public Version[] getPredecessors() throws RepositoryException {
         return perform(new SessionOperation<Version[]>("getPredecessors") {
+            @Nonnull
             @Override
             public Version[] perform() throws RepositoryException {
                 List<Version> predecessors = new ArrayList<Version>();
@@ -131,6 +135,7 @@ public class VersionImpl extends NodeImp
     @Override
     public Version[] getSuccessors() throws RepositoryException {
         return perform(new SessionOperation<Version[]>("getSuccessors") {
+            @Nonnull
             @Override
             public Version[] perform() throws RepositoryException {
                 PropertyDelegate p = getPropertyOrThrow(VersionConstants.JCR_SUCCESSORS);
@@ -148,10 +153,15 @@ public class VersionImpl extends NodeImp
     @Override
     public Node getFrozenNode() throws RepositoryException {
         return perform(new SessionOperation<Node>("getFrozenNode") {
+            @Nonnull
             @Override
             public Node perform() throws RepositoryException {
-                return NodeImpl.createNodeOrNull(
-                        dlg.getChild(VersionConstants.JCR_FROZENNODE),
+                NodeDelegate frozenNode = dlg.getChild(VersionConstants.JCR_FROZENNODE);
+                if (frozenNode == null) {
+                    throw new IllegalStateException("Version without frozen node.");
+                }
+                return NodeImpl.createNode(
+                        frozenNode,
                         sessionContext);
             }
         });

Modified: jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java?rev=1701224&r1=1701223&r2=1701224&view=diff
==============================================================================
--- jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java (original)
+++ jackrabbit/oak/branches/1.0/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java Fri Sep  4 11:51:25 2015
@@ -81,9 +81,9 @@ public class VersionManagerImpl implemen
                         final boolean removeExisting)
             throws RepositoryException {
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
-        sessionDelegate.perform(new SessionOperation<Void>("restore", true) {
+        sessionDelegate.performVoid(new SessionOperation("restore", true) {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate != null) {
@@ -132,7 +132,6 @@ public class VersionManagerImpl implemen
                         sessionDelegate.refresh(false);
                     }
                 }
-                return null;
             }
         });
     }
@@ -168,9 +167,9 @@ public class VersionManagerImpl implemen
             throw new VersionException("Restore of root version not possible");
         }
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
-        sessionDelegate.perform(new SessionOperation<Void>("restore", true) {
+        sessionDelegate.performVoid(new SessionOperation("restore", true) {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 // check for pending changes
                 checkPendingChangesForRestore(sessionDelegate);
                 NodeDelegate n = sessionDelegate.getNodeByIdentifier(versionableId);
@@ -199,10 +198,8 @@ public class VersionManagerImpl implemen
                         }
                     }
                     // ready for restore
-                    VersionDelegate vd = versionManagerDelegate.getVersionByIdentifier(
-                            version.getIdentifier());
-                    versionManagerDelegate.restore(
-                            n.getParent(), n.getName(), vd);
+                    VersionDelegate vd = versionManagerDelegate.getVersionByIdentifier(version.getIdentifier());
+                    versionManagerDelegate.restore(n.getParent(), n.getName(), vd);
                     sessionDelegate.commit();
                     success = true;
                 } catch (CommitFailedException e) {
@@ -213,7 +210,6 @@ public class VersionManagerImpl implemen
                         sessionDelegate.refresh(false);
                     }
                 }
-                return null;
             }
         });
     }
@@ -255,6 +251,7 @@ public class VersionManagerImpl implemen
     public boolean isCheckedOut(final String absPath) throws RepositoryException {
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<Boolean>("isCheckoutOut") {
+            @Nonnull
             @Override
             public Boolean perform() throws RepositoryException {
                 String oakPath = getOakPathOrThrowNotFound(absPath);
@@ -272,6 +269,7 @@ public class VersionManagerImpl implemen
             throws RepositoryException {
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<VersionHistory>("getVersionHistory") {
+            @Nonnull
             @Override
             public VersionHistory perform() throws RepositoryException {
                 return new VersionHistoryImpl(
@@ -284,6 +282,7 @@ public class VersionManagerImpl implemen
     public Version getBaseVersion(final String absPath) throws RepositoryException {
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<Version>("getBaseVersion") {
+            @Nonnull
             @Override
             public Version perform() throws RepositoryException {
                 String oakPath = getOakPathOrThrowNotFound(absPath);
@@ -329,9 +328,9 @@ public class VersionManagerImpl implemen
     @Override
     public void checkout(final String absPath) throws RepositoryException {
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
-        sessionDelegate.perform(new SessionOperation<Void>("checkout", true) {
+        sessionDelegate.performVoid(new SessionOperation("checkout", true) {
             @Override
-            public Void perform() throws RepositoryException {
+            public void performVoid() throws RepositoryException {
                 String oakPath = getOakPathOrThrowNotFound(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
@@ -339,7 +338,6 @@ public class VersionManagerImpl implemen
                 }
                 checkNotLocked(absPath);
                 versionManagerDelegate.checkout(nodeDelegate);
-                return null;
             }
         });
     }
@@ -348,6 +346,7 @@ public class VersionManagerImpl implemen
     public Version checkin(final String absPath) throws RepositoryException {
         final SessionDelegate sessionDelegate = sessionContext.getSessionDelegate();
         return sessionDelegate.perform(new SessionOperation<Version>("checkin", true) {
+            @Nonnull
             @Override
             public Version perform() throws RepositoryException {
                 String oakPath = getOakPathOrThrowNotFound(absPath);