jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r762348 - in /jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi: client/iterator/ClientIterator.java remote/ArrayIterator.java server/iterator/ServerIterator.java
Date Mon, 06 Apr 2009 14:07:09 GMT
Author: jukka
Date: Mon Apr  6 14:07:09 2009
New Revision: 762348

URL: http://svn.apache.org/viewvc?rev=762348&view=rev
Log:
JCRRMI-17: Multiple TCK test failures

Improved handling of RangeIterator.skip() corner cases.

Modified:
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java?rev=762348&r1=762347&r2=762348&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/iterator/ClientIterator.java
Mon Apr  6 14:07:09 2009
@@ -125,7 +125,7 @@
             throw new IllegalArgumentException("Negative skip is not allowed");
         } else if (buffer == null && skipNum > 0) {
             throw new NoSuchElementException("Skipped past the last element");
-        } else if (positionInBuffer + skipNum < buffer.length) {
+        } else if (positionInBuffer + skipNum <= buffer.length) {
             positionInBuffer += skipNum;
         } else {
             try {

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java?rev=762348&r1=762347&r2=762348&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/ArrayIterator.java
Mon Apr  6 14:07:09 2009
@@ -73,6 +73,9 @@
             throw new IllegalArgumentException("Negative skip is not allowed");
         } else if (elements == null || items > elements.length) {
             throw new NoSuchElementException("Skipped past the last element");
+        } else if (items == elements.length) {
+            position = elements.length;
+            elements = null;
         } else {
             Object[] tmp = new Object[elements.length - (int) items];
             System.arraycopy(elements, (int) items, tmp, 0, tmp.length);

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java?rev=762348&r1=762347&r2=762348&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java
Mon Apr  6 14:07:09 2009
@@ -126,17 +126,15 @@
      * @see java.util.Iterator#next()
      */
     public Object[] nextObjects() throws RemoteException {
-        if (!iterator.hasNext()) {
-            return null;
+        ArrayList items = new ArrayList();
+        while (items.size() < maxBufferSize && iterator.hasNext()) {
+            items.add(getRemoteObject(iterator.next()));
+        }
+        if (items.size() > 0) {
+            return items.toArray(new Object[items.size()]);
         } else {
-            ArrayList items = new ArrayList();
-            while (items.size() < maxBufferSize && iterator.hasNext()) {
-                items.add(getRemoteObject(iterator.next()));
-            }
-            if (!iterator.hasNext()) {
-                size = iterator.getPosition();
-            }
-            return items.toArray();
+            size = iterator.getPosition();
+            return null;
         }
     }
 



Mime
View raw message