cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject git commit: honor the iterator.next() contract for exceptions
Date Wed, 05 Nov 2014 02:55:50 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk 87def12cb -> ea0cd4caa


honor the iterator.next() contract for exceptions


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ea0cd4ca
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ea0cd4ca
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ea0cd4ca

Branch: refs/heads/trunk
Commit: ea0cd4caadfb5e8f049376cf2dc1ecfbd7d7ab36
Parents: 87def12
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Tue Nov 4 21:55:10 2014 -0500
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Tue Nov 4 21:55:10 2014 -0500

----------------------------------------------------------------------
 .../cassandra/db/ArrayBackedSortedColumns.java  | 28 ++++++++++++++++----
 1 file changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ea0cd4ca/src/java/org/apache/cassandra/db/ArrayBackedSortedColumns.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ArrayBackedSortedColumns.java b/src/java/org/apache/cassandra/db/ArrayBackedSortedColumns.java
index 80c48aa..e239122 100644
--- a/src/java/org/apache/cassandra/db/ArrayBackedSortedColumns.java
+++ b/src/java/org/apache/cassandra/db/ArrayBackedSortedColumns.java
@@ -22,12 +22,12 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 import com.google.common.base.Function;
 import com.google.common.collect.AbstractIterator;
 import com.google.common.collect.Iterables;
 
-import net.nicoulaj.compilecommand.annotations.Inline;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.composites.CellName;
 import org.apache.cassandra.db.composites.Composite;
@@ -609,8 +609,17 @@ public class ArrayBackedSortedColumns extends ColumnFamily
 
         public Cell next()
         {
-            shouldCallNext = false;
-            return cells[idx--];
+        	try
+        	{
+                shouldCallNext = false;
+                return cells[idx--];
+        	}
+            catch (ArrayIndexOutOfBoundsException e)
+            {
+                NoSuchElementException ne = new NoSuchElementException(e.getMessage());
+                ne.initCause(e);
+                throw ne;
+        	}
         }
 
         public void remove()
@@ -642,8 +651,17 @@ public class ArrayBackedSortedColumns extends ColumnFamily
 
         public Cell next()
         {
-            shouldCallNext = false;
-            return cells[idx++];
+            try
+            {
+                shouldCallNext = false;
+                return cells[idx++];
+            }
+            catch (ArrayIndexOutOfBoundsException e)
+            {
+                NoSuchElementException ne = new NoSuchElementException(e.getMessage());
+                ne.initCause(e);
+                throw ne;
+            }
         }
 
         public void remove()


Mime
View raw message