You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zg...@apache.org on 2019/07/18 01:05:50 UTC
[hbase] branch branch-2.1 updated: HBASE-22704 Avoid NPE when
access table.jsp and snapshot.jsp but master not finish initialization
(#389)
This is an automated email from the ASF dual-hosted git repository.
zghao pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new c5af92b HBASE-22704 Avoid NPE when access table.jsp and snapshot.jsp but master not finish initialization (#389)
c5af92b is described below
commit c5af92b644de1afa4b2659f5e3b96cdbc5688ea9
Author: Guanghao <zg...@apache.org>
AuthorDate: Thu Jul 18 08:20:36 2019 +0800
HBASE-22704 Avoid NPE when access table.jsp and snapshot.jsp but master not finish initialization (#389)
---
.../src/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 6e1c9eb..1ea2b40 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 @@
</jsp:include>
<div class="container-fluid content">
-<% if (snapshot == null) { %>
+<% if (!master.isInitialized()) { %>
+ <div class="row inner_header">
+ <div class="page-header">
+ <h1>Master is not initialized</h1>
+ </div>
+ </div>
+ <jsp:include page="redirect.jsp" />
+<% } else if (snapshot == null) { %>
<div class="row inner_header">
<div class="page-header">
<h1>Snapshot "<%= snapshotName %>" does not exist</h1>
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index 8bf9873..d6c59ae 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -126,7 +126,7 @@
</jsp:include>
<%
-if ( fqtn != null ) {
+if (fqtn != null && master.isInitialized()) {
try {
table = master.getConnection().getTable(TableName.valueOf(fqtn));
if (table.getTableDescriptor().getRegionReplication() > 1) {
@@ -684,7 +684,7 @@ Actions:
</div> <%
}
}
- 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
%>
<div class="container-fluid content">
<div class="row inner_header">