You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by cu...@apache.org on 2009/08/28 00:24:55 UTC

svn commit: r808668 - in /hadoop/avro/trunk: CHANGES.txt src/java/org/apache/avro/Protocol.java src/java/org/apache/avro/Schema.java

Author: cutting
Date: Thu Aug 27 22:24:54 2009
New Revision: 808668

URL: http://svn.apache.org/viewvc?rev=808668&view=rev
Log:
AVRO-107.  Fix minor problems with equals() and hashCode() in Schema and Protocol.

Modified:
    hadoop/avro/trunk/CHANGES.txt
    hadoop/avro/trunk/src/java/org/apache/avro/Protocol.java
    hadoop/avro/trunk/src/java/org/apache/avro/Schema.java

Modified: hadoop/avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/CHANGES.txt?rev=808668&r1=808667&r2=808668&view=diff
==============================================================================
--- hadoop/avro/trunk/CHANGES.txt (original)
+++ hadoop/avro/trunk/CHANGES.txt Thu Aug 27 22:24:54 2009
@@ -67,6 +67,11 @@
 
     AVRO-100.  In spec, remove warning about blocking being draft. (cutting)
 
+    AVRO-107.  Fix Protocol#equals() and Protocol#hashCode() to
+    consider the protocol's types, and also fix Schema#equals() to not
+    throw ClassCastException when a fixed schema is compared to
+    non-fixed. (cutting)
+
 Avro 1.0.0 -- 9 July 2009
 
   INCOMPATIBLE CHANGES

Modified: hadoop/avro/trunk/src/java/org/apache/avro/Protocol.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/java/org/apache/avro/Protocol.java?rev=808668&r1=808667&r2=808668&view=diff
==============================================================================
--- hadoop/avro/trunk/src/java/org/apache/avro/Protocol.java (original)
+++ hadoop/avro/trunk/src/java/org/apache/avro/Protocol.java Thu Aug 27 22:24:54 2009
@@ -173,11 +173,13 @@
     Protocol that = (Protocol)o;
     return this.name.equals(that.name)
       && this.namespace.equals(that.namespace)
+      && this.types.equals(that.types)
       && this.messages.equals(that.messages);
   }
   
   public int hashCode() {
-    return name.hashCode() + namespace.hashCode() + messages.hashCode();
+    return name.hashCode() + namespace.hashCode()
+      + types.hashCode() + messages.hashCode();
   }
 
   public String toString() {

Modified: hadoop/avro/trunk/src/java/org/apache/avro/Schema.java
URL: http://svn.apache.org/viewvc/hadoop/avro/trunk/src/java/org/apache/avro/Schema.java?rev=808668&r1=808667&r2=808668&view=diff
==============================================================================
--- hadoop/avro/trunk/src/java/org/apache/avro/Schema.java (original)
+++ hadoop/avro/trunk/src/java/org/apache/avro/Schema.java Thu Aug 27 22:24:54 2009
@@ -506,6 +506,7 @@
     public int getFixedSize() { return size; }
     public boolean equals(Object o) {
       if (o == this) return true;
+      if (!(o instanceof FixedSchema)) return false;
       FixedSchema that = (FixedSchema)o;
       return equalNames(that) && size == that.size;
     }