hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r650332 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/io/BytesWritable.java
Date Tue, 22 Apr 2008 00:36:01 GMT
Author: shv
Date: Mon Apr 21 17:35:59 2008
New Revision: 650332

URL: http://svn.apache.org/viewvc?rev=650332&view=rev
Log:
HADOOP-3274. The default constructor of BytesWritable creates empty byte array. Contributed
by Tsz Wo (Nicholas), SZE.

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

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=650332&r1=650331&r2=650332&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Mon Apr 21 17:35:59 2008
@@ -33,6 +33,9 @@
 
   OPTIMIZATIONS
 
+    HADOOP-3274. The default constructor of BytesWritable creates empty 
+    byte array. (Tsz Wo (Nicholas), SZE via shv)
+
   BUG FIXES
 
     HADOOP-2905. 'fsck -move' triggers NPE in NameNode. 

Modified: hadoop/core/trunk/src/java/org/apache/hadoop/io/BytesWritable.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/io/BytesWritable.java?rev=650332&r1=650331&r2=650332&view=diff
==============================================================================
--- hadoop/core/trunk/src/java/org/apache/hadoop/io/BytesWritable.java (original)
+++ hadoop/core/trunk/src/java/org/apache/hadoop/io/BytesWritable.java Mon Apr 21 17:35:59
2008
@@ -30,16 +30,15 @@
  */
 public class BytesWritable implements WritableComparable {
   private static final int LENGTH_BYTES = 4;
+  private static final byte[] EMPTY_BYTES = {};
+
   private int size;
   private byte[] bytes;
   
   /**
    * Create a zero-size sequence.
    */
-  public BytesWritable() {
-    size = 0;
-    bytes = new byte[100];
-  }
+  public BytesWritable() {this(EMPTY_BYTES);}
   
   /**
    * Create a BytesWritable using the byte array as the initial value.



Mime
View raw message