jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1520006 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java test/java/org/apache/jackrabbit/oak/jcr/version/VersionTest.java
Date Wed, 04 Sep 2013 13:11:21 GMT
Author: mreutegg
Date: Wed Sep  4 13:11:21 2013
New Revision: 1520006

URL: http://svn.apache.org/r1520006
Log:
OAK-996: Incorrect types for version result nodes

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java?rev=1520006&r1=1520005&r2=1520006&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryResultImpl.java
Wed Sep  4 13:11:21 2013
@@ -39,12 +39,16 @@ import org.apache.jackrabbit.oak.jcr.Ses
 import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
 import org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate;
 import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The implementation of the corresponding JCR interface.
  */
 public class QueryResultImpl implements QueryResult {
-    
+
+    private static final Logger log = LoggerFactory.getLogger(QueryResultImpl.class);
+
     /**
      * The minimum number of rows / nodes to pre-fetch.
      */ 
@@ -157,12 +161,12 @@ public class QueryResultImpl implements 
     }
 
     @CheckForNull
-    NodeImpl<NodeDelegate> getNode(String path) {
+    NodeImpl<? extends NodeDelegate> getNode(String path) throws RepositoryException
{
         if (path == null) {
             return null;
         }
         NodeDelegate d = sessionDelegate.getNode(path);
-        return d == null ? null : new NodeImpl<NodeDelegate>(d, sessionContext);
+        return d == null ? null : NodeImpl.createNode(d, sessionContext);
     }
 
     String getLocalPath(String path) {
@@ -184,10 +188,10 @@ public class QueryResultImpl implements 
         }
         // use the last selector
         final String selectorName = selectorNames[selectorNames.length - 1];
-        Iterator<NodeImpl<NodeDelegate>> nodeIterator = new Iterator<NodeImpl<NodeDelegate>>()
{
+        Iterator<NodeImpl<? extends NodeDelegate>> nodeIterator = new Iterator<NodeImpl<?
extends NodeDelegate>>() {
 
             private final Iterator<? extends ResultRow> it = result.getRows().iterator();
-            private NodeImpl<NodeDelegate> current;
+            private NodeImpl<? extends NodeDelegate> current;
 
             {
                 fetch();
@@ -199,8 +203,12 @@ public class QueryResultImpl implements 
                     ResultRow r = it.next();
                     String path = r.getPath(selectorName);
                     if (includeRow(path)) {
-                        current = getNode(getLocalPath(path));
-                        break;
+                        try {
+                            current = getNode(getLocalPath(path));
+                            break;
+                        } catch (RepositoryException e) {
+                            log.warn("Unable to fetch result node for path " + path, e);
+                        }
                     }
                 }
             }
@@ -211,11 +219,11 @@ public class QueryResultImpl implements 
             }
 
             @Override
-            public NodeImpl<NodeDelegate> next() {
+            public NodeImpl<? extends NodeDelegate> next() {
                 if (current == null) {
                     throw new NoSuchElementException();
                 }
-                NodeImpl<NodeDelegate> n = current;
+                NodeImpl<? extends NodeDelegate> n = current;
                 fetch();
                 return n;
             }
@@ -226,7 +234,7 @@ public class QueryResultImpl implements 
             }
 
         };
-        final PrefetchIterator<NodeImpl<NodeDelegate>> prefIt = new  PrefetchIterator<NodeImpl<NodeDelegate>>(
+        final PrefetchIterator<NodeImpl<? extends NodeDelegate>> prefIt = new
 PrefetchIterator<NodeImpl<? extends NodeDelegate>>(
                 nodeIterator, 
                 PREFETCH_MIN, PREFETCH_TIMEOUT, PREFETCH_MAX, 
                 result.getSize());

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionTest.java?rev=1520006&r1=1520005&r2=1520006&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionTest.java
Wed Sep  4 13:11:21 2013
@@ -56,9 +56,6 @@ public class VersionTest extends Abstrac
 
     public void testVersionFromQuery()
             throws RepositoryException, NotExecutableException {
-        if (true) {
-            throw new NotExecutableException("OAK-996");
-        }
         Node n = testRootNode.addNode(nodeName1, testNodeType);
         n.addMixin(mixVersionable);
         superuser.save();



Mime
View raw message