From 3826894f890a850270053a25b53f07a007555711 Mon Sep 17 00:00:00 2001 From: tedyu Date: Wed, 6 Apr 2016 06:52:51 -0700 Subject: [PATCH] HBASE-15369 Handle NPE in region.jsp (Samir Ahmic) --- .../hbase-webapps/regionserver/region.jsp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp index 874ac439244..02f3d943d50 100644 --- a/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/regionserver/region.jsp @@ -21,6 +21,7 @@ import="java.util.Collection" import="java.util.Date" import="java.util.List" + import="org.owasp.esapi.ESAPI" import="static org.apache.commons.lang.StringEscapeUtils.escapeXml" import="org.apache.hadoop.conf.Configuration" import="org.apache.hadoop.hbase.HTableDescriptor" @@ -35,10 +36,14 @@ String regionName = request.getParameter("name"); HRegionServer rs = (HRegionServer) getServletContext().getAttribute(HRegionServer.REGIONSERVER); Configuration conf = rs.getConfiguration(); - + String displayName = null; Region region = rs.getFromOnlineRegions(regionName); - String displayName = HRegionInfo.getRegionNameAsStringForDisplay(region.getRegionInfo(), + if(region == null) { + displayName= ESAPI.encoder().encodeForHTML(regionName) + " does not exist"; + } else { + displayName = HRegionInfo.getRegionNameAsStringForDisplay(region.getRegionInfo(), rs.getConfiguration()); + } %>