hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r616914 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/io/Text.java
Date Wed, 30 Jan 2008 21:51:16 GMT
Author: jimk
Date: Wed Jan 30 13:51:14 2008
New Revision: 616914

URL: http://svn.apache.org/viewvc?rev=616914&view=rev
Log:
HADOOP-2738 Text is not subclassable because set(Text) and compareTo(Object) access the other
instance's private members directly.

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/java/org/apache/hadoop/io/Text.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=616914&r1=616913&r2=616914&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Wed Jan 30 13:51:14 2008
@@ -11,6 +11,9 @@
 
   BUG FIXES
 
+    HADOOP-2738 Text is not subclassable because set(Text) and compareTo(Object)
+    access the other instance's private members directly.
+
 Release 0.16.0 - 2008-02-04
 
   INCOMPATIBLE CHANGES

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/io/Text.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/io/Text.java?rev=616914&r1=616913&r2=616914&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/io/Text.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/io/Text.java Wed Jan 30 13:51:14 2008
@@ -178,7 +178,7 @@
   
   /** copy a text. */
   public void set(Text other) {
-    set(other.bytes, 0, other.length);
+    set(other.getBytes(), 0, other.getLength());
   }
 
   /**
@@ -275,8 +275,9 @@
     if (this == that)
       return 0;
     else
-      return WritableComparator.compareBytes(bytes, 0, length,
-                                             that.bytes, 0, that.length);
+      return
+        WritableComparator.compareBytes(bytes, 0, length,
+                                        that.getBytes(), 0, that.getLength());
   }
 
   /** Returns true iff <code>o</code> is a Text with the same contents.  */
@@ -289,8 +290,7 @@
     else if (this.length != that.length)
       return false;
     else
-      return WritableComparator.compareBytes(bytes, 0, length,
-                                             that.bytes, 0, that.length) == 0;
+      return compareTo(o) == 0;
   }
 
   /** hash function */



Mime
View raw message