Index: src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (revision 1197197) +++ src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (working copy) @@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.InvalidFamilyOperationException; import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.NotServingRegionException; import org.apache.hadoop.hbase.RegionException; @@ -932,6 +933,20 @@ throws IOException { deleteColumn(Bytes.toBytes(tableName), Bytes.toBytes(columnName)); } + + /** + * If table doesn't exist, throw TableNotFoundException + * + * @param tableName name of table + */ + private void checkTableExistence(final byte [] tableName) throws IOException { + HTableDescriptor htd = getTableDescriptor(tableName); + if (htd == null) { + throw new TableNotFoundException("Table modification could not be " + + "completed as HTableDescritor is missing for table = " + + Bytes.toString(tableName)); + } + } /** * Delete a column from a table. @@ -944,6 +959,13 @@ public void deleteColumn(final byte [] tableName, final byte [] columnName) throws IOException { try { + HTableDescriptor htd = getTableDescriptor(tableName); + checkTableExistence(tableName); + if(!htd.hasFamily(columnName)) { + throw new InvalidFamilyOperationException( + "Family '" + Bytes.toString(columnName) + "' does not exist so " + + "cannot be deleted"); + } getMaster().deleteColumn(tableName, columnName); } catch (RemoteException e) { throw RemoteExceptionHandler.decodeRemoteException(e);