Index: hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java (revision 1571830) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide3.java (working copy) @@ -268,6 +268,30 @@ } @Test + public void testHTableBatchWithEmptyPut() throws Exception { + HTable table = TEST_UTIL.createTable( + Bytes.toBytes("testHTableBatchWithEmptyPut"), new byte[][] { FAMILY }); + try { + List actions = (List) new ArrayList(); + Object[] results = new Object[2]; + // create an empty Put + Put put1 = new Put(ROW); + actions.add(put1); + + Put put2 = new Put(ANOTHERROW); + put2.add(FAMILY, QUALIFIER, VALUE); + actions.add(put2); + + table.batch(actions, results); + fail("Empty Put should have failed the batch call"); + } catch (IllegalArgumentException iae) { + + } finally { + table.close(); + } + } + + @Test public void testHTableExistsMethodSingleRegionSingleGet() throws Exception { // Test with a single region table. Index: hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java (revision 1571830) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncProcess.java (working copy) @@ -479,11 +479,19 @@ // The position will be used by the processBatch to match the object array returned. int posInList = -1; NonceGenerator ng = this.hConnection.getNonceGenerator(); + int i = 0; for (Row r : rows) { + if (r instanceof Put) { + Put put = (Put) r; + if (put.isEmpty()) { + throw new IllegalArgumentException("No columns to insert for #" + (i+1) + " item"); + } + } posInList++; Action action = new Action(r, posInList); setNonce(ng, r, action); actions.add(action); + i++; } AsyncRequestFutureImpl ars = createAsyncRequestFuture( tableName, actions, ng.getNonceGroup(), getPool(pool), callback, results, results != null);