Index: src/test/org/apache/hadoop/hbase/client/TestHTable.java =================================================================== --- src/test/org/apache/hadoop/hbase/client/TestHTable.java (revision 902025) +++ src/test/org/apache/hadoop/hbase/client/TestHTable.java (working copy) @@ -330,23 +330,38 @@ * For HADOOP-2579 */ public void testTableNotFoundExceptionWithATable() { - try { - HBaseAdmin admin = new HBaseAdmin(conf); - HTableDescriptor testTableADesc = - new HTableDescriptor("table"); - testTableADesc.addFamily(column); - admin.createTable(testTableADesc); + try { + HBaseAdmin admin = new HBaseAdmin(conf); + HTableDescriptor testTableADesc = + new HTableDescriptor("table"); + testTableADesc.addFamily(column); + admin.createTable(testTableADesc); - // This should throw a TableNotFoundException, it has not been created - new HTable(conf, "notATable"); - - fail("Should have thrown a TableNotFoundException"); - } catch (TableNotFoundException e) { - // expected - } catch (IOException e) { - e.printStackTrace(); - fail("Should have thrown a TableNotFoundException instead of a " + - e.getClass()); - } - } + // This should throw a TableNotFoundException, it has not been created + new HTable(conf, "notATable"); + + fail("Should have thrown a TableNotFoundException"); + } catch (TableNotFoundException e) { + // expected + } catch (IOException e) { + e.printStackTrace(); + fail("Should have thrown a TableNotFoundException instead of a " + + e.getClass()); + } + } + + public void testTableDoesntExistWithScan() throws Exception { + HBaseAdmin admin = new HBaseAdmin(conf); + HTableDescriptor testTableADesc = + new HTableDescriptor(tableAname); + testTableADesc.addFamily(column); + admin.createTable(testTableADesc); + HTable table = new HTable(conf, tableAname); + assertTrue(table.getConnection().tableExists(tableAname)); + Scan scan = new Scan(); + scan.addFamily(CATALOG_FAMILY); + scan.addColumn(CATALOG_FAMILY, row); + assertTrue(table.getConnection().tableExists(tableAname)); + } + } Index: src/java/org/apache/hadoop/hbase/client/Scan.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/Scan.java (revision 902025) +++ src/java/org/apache/hadoop/hbase/client/Scan.java (working copy) @@ -183,7 +183,7 @@ */ public Scan addColumn(byte [] family, byte [] qualifier) { NavigableSet set = familyMap.get(family); - if(set == null) { + if(set == null || set == EMPTY_NAVIGABLE_SET) { set = new TreeSet(Bytes.BYTES_COMPARATOR); } set.add(qualifier);