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 2013/08/28 19:21:51 UTC

[2/4] git commit: 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.

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/c587a351
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/c587a351
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/c587a351

Branch: refs/heads/master
Commit: c587a3513947c4c8c31176a99debff16cc436b18
Parents: f59be90
Author: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Authored: Wed Aug 28 10:14:03 2013 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Wed Aug 28 10:14:03 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/c587a351/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/c587a351/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