jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1406128 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
Date Tue, 06 Nov 2012 13:29:45 GMT
Author: thomasm
Date: Tue Nov  6 13:29:45 2012
New Revision: 1406128

URL: http://svn.apache.org/viewvc?rev=1406128&view=rev
Log:
OAK-423 Query: org.apache.jackrabbit.oak.spi.query.Cursor.currentRow called too late (prevent
future bugs)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java?rev=1406128&r1=1406127&r2=1406128&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
Tue Nov  6 13:29:45 2012
@@ -121,6 +121,8 @@ public class Cursors {
 
         private long readCount;
 
+        private boolean closed;
+
         public TraversingCursor(String statement, Filter filter, NodeState root) {
             this.statement = statement;
             this.filter = filter;
@@ -170,6 +172,9 @@ public class Cursors {
 
         @Override
         public IndexRow currentRow() {
+            if (closed) {
+                throw new IllegalStateException("This cursor is closed");
+            }
             return new IndexRowImpl(currentPath);
         }
 
@@ -204,6 +209,7 @@ public class Cursors {
                 }
             }
             currentPath = null;
+            closed = true;
             return false;
         }
 



Mime
View raw message