hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r706348 - in /hadoop/hbase/trunk: CHANGES.txt src/java/org/apache/hadoop/hbase/HStoreKey.java src/test/org/apache/hadoop/hbase/TestCompare.java
Date Mon, 20 Oct 2008 17:43:54 GMT
Author: stack
Date: Mon Oct 20 10:43:54 2008
New Revision: 706348

URL: http://svn.apache.org/viewvc?rev=706348&view=rev
Log:
HBASE-939 NPE in HStoreKey

Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HStoreKey.java
    hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestCompare.java

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=706348&r1=706347&r2=706348&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Mon Oct 20 10:43:54 2008
@@ -35,6 +35,7 @@
                they are using HTable
                With J-D's one line patch, test cases now appear to work and
                PerformanceEvaluation works as before.
+   HBASE-939   NPE in HStoreKey
 
   IMPROVEMENTS
    HBASE-901   Add a limit to key length, check key and value length on client side

Modified: hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HStoreKey.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HStoreKey.java?rev=706348&r1=706347&r2=706348&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HStoreKey.java (original)
+++ hadoop/hbase/trunk/src/java/org/apache/hadoop/hbase/HStoreKey.java Mon Oct 20 10:43:54
2008
@@ -351,6 +351,11 @@
   
   static int compareTo(final HRegionInfo hri, final HStoreKey left,
       final HStoreKey right) {
+    // We can be passed null
+    if (left == null && right == null) return 0;
+    if (left == null) return -1;
+    if (right == null) return 1;
+    
     int result = compareTwoRowKeys(hri, left.getRow(), right.getRow());
     if (result != 0) {
       return result;

Modified: hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestCompare.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestCompare.java?rev=706348&r1=706347&r2=706348&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestCompare.java (original)
+++ hadoop/hbase/trunk/src/test/org/apache/hadoop/hbase/TestCompare.java Mon Oct 20 10:43:54
2008
@@ -51,6 +51,11 @@
     nocolumn = new HStoreKey(a, HConstants.LATEST_TIMESTAMP);
     withcolumn = new HStoreKey(a, a, timestamp);
     assertTrue(nocolumn.compareTo(withcolumn) < 0);
+    // Test null keys.
+    HStoreKey normal = new HStoreKey("a", "b");
+    assertTrue(normal.compareTo(null) > 0);
+    assertTrue(HStoreKey.compareTo(null, null, null) == 0);
+    assertTrue(HStoreKey.compareTo(null, null, normal) < 0);
   }
   
   /**



Mime
View raw message