hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1043218 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/KeyValue.java
Date Tue, 07 Dec 2010 22:36:06 GMT
Author: stack
Date: Tue Dec  7 22:36:06 2010
New Revision: 1043218

URL: http://svn.apache.org/viewvc?rev=1043218&view=rev
Log:
HBASE-1888 KeyValue methods throw NullPointerException instead of IllegalArgumentException
during parameter sanity check

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1043218&r1=1043217&r2=1043218&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Tue Dec  7 22:36:06 2010
@@ -17,6 +17,8 @@ Release 0.91.0 - Unreleased
                the HBase shell (Igor Ranitovic via Stack)
    HBASE-3317  Javadoc and Throws Declaration for Bytes.incrementBytes() is
                Wrong (Ed Kohlwey via Stack)
+   HBASE-1888  KeyValue methods throw NullPointerException instead of
+               IllegalArgumentException during parameter sanity check
 
   IMPROVEMENTS
    HBASE-2001  Coprocessors: Colocate user code with regions (Mingjie Lai via

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java?rev=1043218&r1=1043217&r2=1043218&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/KeyValue.java Tue Dec  7 22:36:06 2010
@@ -36,35 +36,35 @@ import org.apache.hadoop.io.RawComparato
 import org.apache.hadoop.io.Writable;
 
 /**
- * An HBase Key/Value.
+ * An HBase Key/Value.  This is the fundamental HBase Type.
  *
  * <p>If being used client-side, the primary methods to access individual fields
  * are {@link #getRow()}, {@link #getFamily()}, {@link #getQualifier()},
  * {@link #getTimestamp()}, and {@link #getValue()}.  These methods allocate new
- * byte arrays and return copies so they should be avoided server-side.
+ * byte arrays and return copies. Avoid their use server-side.
  *
- * <p>Instances of this class are immutable.  They are not
- * comparable but Comparators are provided.  Comparators change with context,
- * whether user table or a catalog table comparison context.  Its
- * important that you use the appropriate comparator comparing rows in
- * particular.  There are Comparators for KeyValue instances and then for
- * just the Key portion of a KeyValue used mostly in {@link HFile}.
+ * <p>Instances of this class are immutable.  They do not implement Comparable
+ * but Comparators are provided.  Comparators change with context,
+ * whether user table or a catalog table comparison.  Its critical you use the
+ * appropriate comparator.  There are Comparators for KeyValue instances and
+ * then for just the Key portion of a KeyValue used mostly by {@link HFile}.
  *
- * <p>KeyValue wraps a byte array and has offset and length for passed array
- * at where to start interpreting the content as a KeyValue blob.  The KeyValue
- * blob format inside the byte array is:
+ * <p>KeyValue wraps a byte array and takes offsets and lengths into passed
+ * array at where to start interpreting the content as KeyValue.  The KeyValue
+ * format inside a byte array is:
  * <code>&lt;keylength> &lt;valuelength> &lt;key> &lt;value></code>
- * Key is decomposed as:
+ * Key is further decomposed as:
  * <code>&lt;rowlength> &lt;row> &lt;columnfamilylength> &lt;columnfamily>
&lt;columnqualifier> &lt;timestamp> &lt;keytype></code>
- * Rowlength maximum is Short.MAX_SIZE, column family length maximum is
- * Byte.MAX_SIZE, and column qualifier + key length must be < Integer.MAX_SIZE.
- * The column does not contain the family/qualifier delimiter.
- *
- * <p>TODO: Group Key-only comparators and operations into a Key class, just
- * for neatness sake, if can figure what to call it.
+ * The <code>rowlength</code> maximum is <code>Short.MAX_SIZE</code>,
+ * column family length maximum is
+ * <code>Byte.MAX_SIZE</code>, and column qualifier + key length must
+ * be < <code>Integer.MAX_SIZE</code>.
+ * The column does not contain the family/qualifier delimiter, {@link #COLUMN_FAMILY_DELIMITER}
  */
 public class KeyValue implements Writable, HeapSize {
   static final Log LOG = LogFactory.getLog(KeyValue.class);
+  // TODO: Group Key-only comparators and operations into a Key class, just
+  // for neatness sake, if can figure what to call it.
 
   /**
    * Colon character in UTF-8
@@ -1293,7 +1293,7 @@ public class KeyValue implements Writabl
   public static int getDelimiter(final byte [] b, int offset, final int length,
       final int delimiter) {
     if (b == null) {
-      throw new NullPointerException();
+      throw new IllegalArgumentException("Passed buffer is null");
     }
     int result = -1;
     for (int i = offset; i < length + offset; i++) {
@@ -1314,7 +1314,7 @@ public class KeyValue implements Writabl
   public static int getDelimiterInReverse(final byte [] b, final int offset,
       final int length, final int delimiter) {
     if (b == null) {
-      throw new NullPointerException();
+      throw new IllegalArgumentException("Passed buffer is null");
     }
     int result = -1;
     for (int i = (offset + length) - 1; i >= offset; i--) {



Mime
View raw message