HBASE-19424 Fix NPE in "/metrics" servlet.

Signed-off-by: Apekshit Sharma <appy@apache.org>
This commit is contained in:
Toshihiro Suzuki 2018-01-08 15:10:42 -08:00 committed by Apekshit Sharma
parent 4c31374a90
commit ed0058b6a1
1 changed files with 3 additions and 0 deletions

View File

@ -591,6 +591,9 @@ public class HttpServer implements FilterContainer {
ctx.setContextPath("/"); ctx.setContextPath("/");
ctx.setWar(appDir + "/" + name); ctx.setWar(appDir + "/" + name);
ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf); ctx.getServletContext().setAttribute(CONF_CONTEXT_ATTRIBUTE, conf);
// for org.apache.hadoop.metrics.MetricsServlet
ctx.getServletContext().setAttribute(
org.apache.hadoop.http.HttpServer2.CONF_CONTEXT_ATTRIBUTE, conf);
ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl); ctx.getServletContext().setAttribute(ADMINS_ACL, adminsAcl);
addNoCacheFilter(ctx); addNoCacheFilter(ctx);
return ctx; return ctx;