You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gora.apache.org by le...@apache.org on 2012/05/18 15:06:00 UTC

svn commit: r1340088 - in /gora/trunk: CHANGES.txt gora-core/src/main/java/org/apache/gora/persistency/ListGenericArray.java gora-core/src/test/java/org/apache/gora/persistency/TestListGenericArray.java

Author: lewismc
Date: Fri May 18 13:06:00 2012
New Revision: 1340088

URL: http://svn.apache.org/viewvc?rev=1340088&view=rev
Log:
commit to address GORA-134 and update to CHANGES.txt

Added:
    gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/TestListGenericArray.java
Modified:
    gora/trunk/CHANGES.txt
    gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/ListGenericArray.java

Modified: gora/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/gora/trunk/CHANGES.txt?rev=1340088&r1=1340087&r2=1340088&view=diff
==============================================================================
--- gora/trunk/CHANGES.txt (original)
+++ gora/trunk/CHANGES.txt Fri May 18 13:06:00 2012
@@ -6,6 +6,8 @@ Gora Change Log
 
 0.3 (trunk) Current Development:
 
+* GORA-134 ListGenericArray's hashCode causes StackOverflowError (Kazuomi Kashii via lewismc)
+
 * GORA-95 Catch incorrect mapping configurations and implement sufficient logging in CassandraMapping. (lewismc)
 
 * GORA-** Commit to fix classloading for CLI execution (lewismc)

Modified: gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/ListGenericArray.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/ListGenericArray.java?rev=1340088&r1=1340087&r2=1340088&view=diff
==============================================================================
--- gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/ListGenericArray.java (original)
+++ gora/trunk/gora-core/src/main/java/org/apache/gora/persistency/ListGenericArray.java Fri May 18 13:06:00 2012
@@ -83,7 +83,7 @@ public class ListGenericArray<T> impleme
 
   @Override
   public int hashCode() {
-    return GenericData.get().hashCode(this, schema);
+    return this.list.hashCode();
   }
 
   @SuppressWarnings({ "unchecked", "rawtypes" })

Added: gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/TestListGenericArray.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/TestListGenericArray.java?rev=1340088&view=auto
==============================================================================
--- gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/TestListGenericArray.java (added)
+++ gora/trunk/gora-core/src/test/java/org/apache/gora/persistency/TestListGenericArray.java Fri May 18 13:06:00 2012
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gora.persistency;
+
+import org.apache.avro.Schema; 
+import org.apache.avro.util.Utf8;
+import org.apache.gora.persistency.ListGenericArray; 
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Testcase for ListGenericArray class
+ */
+public class TestListGenericArray {
+  
+  @Test
+  public void testHashCode() {
+    ListGenericArray array = new ListGenericArray(Schema.create(Schema.Type.STRING)); 
+    boolean stackOverflowError = false;
+    array.add(new Utf8("array test")); 
+    try {
+      int hashCode = array.hashCode();
+    }
+    catch (StackOverflowError e) {
+      stackOverflowError = true;
+    }
+    Assert.assertFalse(stackOverflowError);
+  }
+}