From c5af92b644de1afa4b2659f5e3b96cdbc5688ea9 Mon Sep 17 00:00:00 2001 From: Guanghao Date: Thu, 18 Jul 2019 08:20:36 +0800 Subject: [PATCH] HBASE-22704 Avoid NPE when access table.jsp and snapshot.jsp but master not finish initialization (#389) --- .../main/resources/hbase-webapps/master/snapshot.jsp | 11 +++++++++-- .../src/main/resources/hbase-webapps/master/table.jsp | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp b/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp index 6e1c9eb4cfb..1ea2b40a4e5 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/snapshot.jsp @@ -36,7 +36,7 @@ SnapshotInfo.SnapshotStats stats = null; TableName snapshotTable = null; boolean tableExists = false; - if(snapshotName != null) { + if(snapshotName != null && master.isInitialized()) { try (Admin admin = master.getConnection().getAdmin()) { for (SnapshotDescription snapshotDesc: admin.listSnapshots()) { if (snapshotName.equals(snapshotDesc.getName())) { @@ -66,7 +66,14 @@
-<% if (snapshot == null) { %> +<% if (!master.isInitialized()) { %> +
+ +
+ +<% } else if (snapshot == null) { %>
<% } } - else { // handle the case for fqtn is null with error message + redirect + else { // handle the case for fqtn is null or master is not initialized with error message + redirect %>