Skip to content

Commit 4b0a8d8

Browse files
committed
HBASE-29955 HMaster getting aborted due to NPE while creating snapshot for invalid table name (review comment fix)
1 parent 0ac1019 commit 4b0a8d8

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

hbase-server/src/test/java/org/apache/hadoop/hbase/client/SnapshotWithAclTestBase.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,10 @@ public void testCreateSnapshotWithNonExistingTable() throws Exception {
330330
String snapshotName = tableName.getNameAsString() + "snap1";
331331

332332
try {
333-
try {
334-
// Create snapshot without creating table
335-
TEST_UTIL.getAdmin().snapshot(snapshotName, tableName);
336-
fail("Snapshot operation should fail, table doesn't exist");
337-
} catch (Exception e) {
338-
assertTrue(e instanceof SnapshotCreationException);
339-
}
333+
// Create snapshot without creating table
334+
assertThrows("Snapshot operation should fail, table doesn't exist",
335+
SnapshotCreationException.class,
336+
() -> TEST_UTIL.getAdmin().snapshot(snapshotName, tableName));
340337

341338
// Create the table
342339
TableDescriptor htd = TableDescriptorBuilder.newBuilder(tableName).build();

0 commit comments

Comments
 (0)