hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r431426 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/io/Text.java src/test/org/apache/hadoop/io/TestText.java
Date Mon, 14 Aug 2006 20:11:49 GMT
Author: cutting
Date: Mon Aug 14 13:11:49 2006
New Revision: 431426

URL: http://svn.apache.org/viewvc?rev=431426&view=rev
Log:
HADOOP-453.  Fix a bug in Text.setCapacity().  Contributed by Sami Siren.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/io/Text.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/io/TestText.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=431426&r1=431425&r2=431426&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Mon Aug 14 13:11:49 2006
@@ -22,6 +22,8 @@
  5. HADOOP-434.  Change smallJobsBenchmark to use standard Hadoop
     scripts.  (Sanjay Dahiya via cutting)
 
+ 6. HADOOP-453.  Fix a bug in Text.setCapacity().  (siren via cutting)
+
 
 Release 0.5.0 - 2006-08-04
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/io/Text.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/io/Text.java?rev=431426&r1=431425&r2=431426&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/io/Text.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/io/Text.java Mon Aug 14 13:11:49 2006
@@ -198,8 +198,8 @@
    * (if any) are deleted.
    */
   private void setCapacity( int len ) {
-    if (bytes == null || bytes.length < length)
-      bytes = new byte[length];      
+    if (bytes == null || bytes.length < len)
+      bytes = new byte[len];      
   }
    
   /** 

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/io/TestText.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/io/TestText.java?rev=431426&r1=431425&r2=431426&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/io/TestText.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/io/TestText.java Mon Aug 14 13:11:49 2006
@@ -19,6 +19,7 @@
 import junit.framework.TestCase;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.CharacterCodingException;
 import java.util.Random;
 
 import org.apache.commons.logging.Log;
@@ -199,6 +200,14 @@
       int length = text.getLength();
       Text.validateUTF(utf8, 0, length);
   }
+
+  public void testTextText() throws CharacterCodingException {
+    Text a=new Text("abc");
+    Text b=new Text("a");
+    b.set(a);
+    assertEquals("abc",b.toString());
+  }
+
   public static void main(String[] args)  throws Exception
   {
     TestText test = new TestText("main");



Mime
View raw message