Skip to content

Commit 59d05d6

Browse files
guluo2016PDavid
authored andcommitted
HBASE-28778 NPE may occur when opening master-status or table.jsp or procedure.jsp while Master is initializing (#6152)
Signed-off-by: Duo Zhang <zhangduo@apache.org> (cherry picked from commit 3caaf2d)
1 parent 9e4d233 commit 59d05d6

File tree

1 file changed

+21
-18
lines changed
  • hbase-server/src/main/resources/hbase-webapps/master

1 file changed

+21
-18
lines changed

hbase-server/src/main/resources/hbase-webapps/master/table.jsp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,32 @@
147147
return "";
148148
}
149149
%>
150+
151+
<jsp:include page="header.jsp">
152+
<jsp:param name="pageTitle" value="${pageTitle}"/>
153+
</jsp:include>
154+
150155
<%
151156
final String ZEROMB = "0 MB";
152157
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
153158
Configuration conf = master.getConfiguration();
154159
String fqtn = request.getParameter("name");
160+
// handle the case for fqtn is null or master is not initialized with error message + redirect
161+
if (fqtn == null || !master.isInitialized()) {
162+
%>
163+
<div class="container-fluid content">
164+
<div class="row inner_header">
165+
<div class="page-header">
166+
<h1>Table not ready</h1>
167+
</div>
168+
</div>
169+
<p><hr><p>
170+
<jsp:include page="redirect.jsp" />
171+
</div>
172+
<% return;
173+
} %>
174+
175+
<%
155176
final String escaped_fqtn = StringEscapeUtils.escapeHtml4(fqtn);
156177
Table table = master.getConnection().getTable(TableName.valueOf(fqtn));
157178
boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false);
@@ -200,24 +221,6 @@
200221
final MetaBrowser metaBrowser = new MetaBrowser(connection, request);
201222
%>
202223

203-
<jsp:include page="header.jsp">
204-
<jsp:param name="pageTitle" value="${pageTitle}"/>
205-
</jsp:include>
206-
207-
<% // handle the case for fqtn is null or master is not initialized with error message + redirect
208-
if (fqtn == null || ! master.isInitialized()) { %>
209-
<div class="container-fluid content">
210-
<div class="row inner_header">
211-
<div class="page-header">
212-
<h1>Table not ready</h1>
213-
</div>
214-
</div>
215-
<p><hr><p>
216-
<jsp:include page="redirect.jsp" />
217-
</div>
218-
<% return;
219-
} %>
220-
221224
<% // unknow table
222225
if (! admin.tableExists(TableName.valueOf(fqtn)).get()) { %>
223226
<div class="container-fluid content">

0 commit comments

Comments
 (0)