You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by cr...@apache.org on 2014/07/09 22:43:21 UTC
git commit: SAMZA-321; make next fail when going beyond range kv store
Repository: incubator-samza
Updated Branches:
refs/heads/master 9652e6412 -> 8edb3fed7
SAMZA-321; make next fail when going beyond range kv store
Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/8edb3fed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/8edb3fed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/8edb3fed
Branch: refs/heads/master
Commit: 8edb3fed7960808b154367666f370439df64b5ca
Parents: 9652e64
Author: Chinmay Soman <ch...@gmail.com>
Authored: Wed Jul 9 13:43:15 2014 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Wed Jul 9 13:43:15 2014 -0700
----------------------------------------------------------------------
.../scala/org/apache/samza/storage/kv/LevelDbKeyValueStore.scala | 4 ++++
.../scala/org/apache/samza/storage/kv/TestKeyValueStores.scala | 1 +
2 files changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/8edb3fed/samza-kv/src/main/scala/org/apache/samza/storage/kv/LevelDbKeyValueStore.scala
----------------------------------------------------------------------
diff --git a/samza-kv/src/main/scala/org/apache/samza/storage/kv/LevelDbKeyValueStore.scala b/samza-kv/src/main/scala/org/apache/samza/storage/kv/LevelDbKeyValueStore.scala
index dae3c2c..72562cf 100644
--- a/samza-kv/src/main/scala/org/apache/samza/storage/kv/LevelDbKeyValueStore.scala
+++ b/samza-kv/src/main/scala/org/apache/samza/storage/kv/LevelDbKeyValueStore.scala
@@ -182,6 +182,10 @@ class LevelDbKeyValueStore(
def remove() = iter.remove()
def hasNext() = iter.hasNext()
def next() = {
+ if (!hasNext()) {
+ throw new NoSuchElementException
+ }
+
val curr = iter.next
val key = curr.getKey
val value = curr.getValue
http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/8edb3fed/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
----------------------------------------------------------------------
diff --git a/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala b/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
index ec23567..4856be0 100644
--- a/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
+++ b/samza-kv/src/test/scala/org/apache/samza/storage/kv/TestKeyValueStores.scala
@@ -292,6 +292,7 @@ class TestKeyValueStores(typeOfStore: String) {
assertEquals(v, s(entry.getValue))
}
assertFalse(iter.hasNext)
+ intercept[NoSuchElementException] { iter.next() }
}
/**