gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hsapu...@apache.org
Subject svn commit: r1559929 - in /gora/trunk: CHANGES.txt gora-core/src/main/java/org/apache/gora/persistency/StatefulHashMap.java gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
Date Tue, 21 Jan 2014 07:29:25 GMT
Author: hsaputra
Date: Tue Jan 21 07:29:24 2014
New Revision: 1559929

URL: http://svn.apache.org/r1559929
Log:
GORA-290 StatefulHashMap removes the entry when put with same value. Thanks Alparslan.

Modified:
    gora/trunk/CHANGES.txt
    gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/StatefulHashMap.java
    gora/trunk/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java

Modified: gora/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/gora/trunk/CHANGES.txt?rev=1559929&r1=1559928&r2=1559929&view=diff
==============================================================================
--- gora/trunk/CHANGES.txt (original)
+++ gora/trunk/CHANGES.txt Tue Jan 21 07:29:24 2014
@@ -4,6 +4,8 @@
 
 Gora Change Log
 
+* GORA-290 StatefulHashMap removes the entry when put with same value (Alparslan Avci via
hsaputra)
+
 * GORA-231 Provide better error handling in AccumuloStore.readMapping when file does not
exist (Apostolos Giannakidis)
 
 * GORA-283 Specify field name for types not being considered in gora-cassandra (lewismc)

Modified: gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/StatefulHashMap.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/StatefulHashMap.java?rev=1559929&r1=1559928&r2=1559929&view=diff
==============================================================================
--- gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/StatefulHashMap.java (original)
+++ gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/StatefulHashMap.java Tue
Jan 21 07:29:24 2014
@@ -55,10 +55,10 @@ public class StatefulHashMap<K, V> exten
   
   @Override
   public V put(K key, V value) {
-    keyStates.remove(key);
     V old = super.put(key, value);
     //if old value is different or null, set state to dirty
     if (!value.equals(old)) {
+      keyStates.remove(key);
       keyStates.put(key, State.DIRTY);
     }
     return old;

Modified: gora/trunk/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java?rev=1559929&r1=1559928&r2=1559929&view=diff
==============================================================================
--- gora/trunk/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java (original)
+++ gora/trunk/gora-core/src/test/java/org/apache/gora/store/DataStoreTestUtil.java Tue Jan
21 07:29:24 2014
@@ -380,6 +380,10 @@ public class DataStoreTestUtil {
       for (int j = 1; j < urls.length; j += 2) {
         webPage.putToOutlinks(new Utf8(anchor + j), new Utf8(urls[j]));
       }
+      //test for double put of same entries
+      for (int j = 1; j < urls.length; j += 2) {
+        webPage.putToOutlinks(new Utf8(anchor + j), new Utf8(urls[j]));
+      }
       dataStore.put(webPage.getUrl().toString(), webPage);
     }
 



Mime
View raw message