hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r592551 - in /lucene/hadoop/trunk/src/contrib/hbase: CHANGES.txt src/java/org/apache/hadoop/hbase/HBaseAdmin.java src/java/org/apache/hadoop/hbase/HTableDescriptor.java src/test/org/apache/hadoop/hbase/TestMasterAdmin.java
Date Tue, 06 Nov 2007 20:48:28 GMT
Author: stack
Date: Tue Nov  6 12:48:27 2007
New Revision: 592551

URL: http://svn.apache.org/viewvc?rev=592551&view=rev
Log:
HADOOP-2156 BufferUnderflowException for un-named HTableDescriptors

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HBaseAdmin.java
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestMasterAdmin.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?rev=592551&r1=592550&r2=592551&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Tue Nov  6 12:48:27 2007
@@ -27,6 +27,7 @@
                the test more deterministic and getting META reassigned was
                problematic.
    HADOOP-2155 Method expecting HBaseConfiguration throws NPE when given Configuration
+   HADOOP-2156 BufferUnderflowException for un-named HTableDescriptors
 
   IMPROVEMENTS
     HADOOP-2401 Add convenience put method that takes writable

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HBaseAdmin.java?rev=592551&r1=592550&r2=592551&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HBaseAdmin.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HBaseAdmin.java
Tue Nov  6 12:48:27 2007
@@ -112,7 +112,6 @@
    */
   public void createTable(HTableDescriptor desc)
   throws IOException {
-    
     createTableAsync(desc);
 
     // Wait for new table to come on-line
@@ -134,15 +133,12 @@
    */
   public void createTableAsync(HTableDescriptor desc)
   throws IOException {
-    
     if (this.master == null) {
       throw new MasterNotRunningException("master has been shut down");
     }
-    
     checkReservedTableName(desc.getName());
     try {
       this.master.createTable(desc);
-
     } catch (RemoteException e) {
       throw RemoteExceptionHandler.decodeRemoteException(e);
     }
@@ -492,10 +488,12 @@
    * @throws IllegalArgumentException - if the table name is reserved
    */
   protected void checkReservedTableName(Text tableName) {
+    if (tableName == null || tableName.getLength() <= 0) {
+      throw new IllegalArgumentException("Null or empty table name");
+    }
     if(tableName.charAt(0) == '-' ||
         tableName.charAt(0) == '.' ||
         tableName.find(",") != -1) {
-      
       throw new IllegalArgumentException(tableName + " is a reserved table name");
     }
   }
@@ -507,4 +505,4 @@
     return metaservers.get((metaservers.containsKey(tableName)) ?
         tableName : metaservers.headMap(tableName).lastKey());
   }
-}
+}
\ No newline at end of file

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTableDescriptor.java?rev=592551&r1=592550&r2=592551&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HTableDescriptor.java
Tue Nov  6 12:48:27 2007
@@ -74,7 +74,11 @@
     families.put(family.getName(), family);
   }
 
-  /** Constructs an empty object */
+  /**
+   * Constructs an empty object.
+   * For deserializing an HTableDescriptor instance only.
+   * @see #HTableDescriptor(String)
+   */
   public HTableDescriptor() {
     this.name = new Text();
     this.families = new TreeMap<Text, HColumnDescriptor>();

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestMasterAdmin.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestMasterAdmin.java?rev=592551&r1=592550&r2=592551&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestMasterAdmin.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/TestMasterAdmin.java
Tue Nov  6 12:48:27 2007
@@ -41,6 +41,15 @@
   /** @throws Exception */
   public void testMasterAdmin() throws Exception {
     admin = new HBaseAdmin(conf);
+    // Add test that exception is thrown if descriptor is without a table name.
+    // HADOOP-2156.
+    boolean exception = false;
+    try {
+      admin.createTable(new HTableDescriptor());
+    } catch (IllegalArgumentException e) {
+      exception = true;
+    }
+    assertTrue(exception);
     admin.createTable(testDesc);
     admin.disableTable(testDesc.getName());
 
@@ -68,4 +77,4 @@
     admin.deleteColumn(testDesc.getName(), new Text("col2:"));
     admin.deleteTable(testDesc.getName());
   }
-}
+}
\ No newline at end of file



Mime
View raw message