Updated Branches: refs/heads/master 71f030ee4 -> c942c28d9
tweak kv test to trigger NPE when test is run with Scala 2.8.1. Validate that patch fixes the bug. Add brackets in if else in cached store for style. Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/4ec463b3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/4ec463b3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/4ec463b3 Branch: refs/heads/master Commit: 4ec463b35e71f470e5b296f1ec65bb5866f495c4 Parents: 39cf91e Author: Chris Riccomini <[email protected]> Authored: Wed Aug 28 10:14:03 2013 -0700 Committer: Chris Riccomini <[email protected]> Committed: Wed Aug 28 12:47:05 2013 -0700 ---------------------------------------------------------------------- .../src/main/scala/org/apache/samza/storage/kv/CachedStore.scala | 4 ++-- .../scala/org/apache/samza/storage/kv/TestKeyValueStores.scala | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/4ec463b3/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala ---------------------------------------------------------------------- diff --git a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala index 8938b89..81e33b8 100644 --- a/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala +++ b/samza-kv/src/main/scala/org/apache/samza/storage/kv/CachedStore.scala @@ -90,9 +90,9 @@ class CachedStore[K, V](val store: KeyValueStore[K, V], def put(key: K, value: V) { // add the key to the front of the dirty list (and remove any prior occurrences to dedupe) val found = cache.get(key) - if (found == null || found.dirty == null) + if (found == null || found.dirty == null) { this.dirtyCount += 1 - else { + } else { // If we are removing the head of the list, move the head to the next element. if(found.dirty.prev == null) { this.dirty = found.dirty.next http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/4ec463b3/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 5f9d66c..0be0722 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 @@ -79,7 +79,8 @@ class TestKeyValueStores(cache: Boolean) { val k = b("k2") store.put(k, b("v1")) store.put(k, b("v2")) - assertTrue(Arrays.equals(b("v2"), store.get(k))) + store.put(k, b("v3")) + assertTrue(Arrays.equals(b("v3"), store.get(k))) } @Test
