This is an automated email from the ASF dual-hosted git repository.

reidchan pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 0da8b2c  HBASE-22240 [backport] HBASE-19762 Fix Checkstyle errors in 
hbase-http
0da8b2c is described below

commit 0da8b2ce135ca20cdfe287cadd955362bb4457b4
Author: Jan Hentschel <[email protected]>
AuthorDate: Wed Feb 7 18:52:59 2018 +0100

    HBASE-22240 [backport] HBASE-19762 Fix Checkstyle errors in hbase-http
    
    Signed-off-by: Reid Chan <[email protected]>
---
 .../resources/hbase/checkstyle-suppressions.xml    |   7 +-
 hbase-http/pom.xml                                 |   7 ++
 .../hbase/http/ClickjackingPreventionFilter.java   |  45 ++++----
 .../org/apache/hadoop/hbase/http/HtmlQuoting.java  |  56 ++++++----
 .../org/apache/hadoop/hbase/http/HttpConfig.java   |   5 +-
 .../hadoop/hbase/http/HttpRequestLogAppender.java  |   2 +-
 .../org/apache/hadoop/hbase/http/HttpServer.java   | 120 ++++++++++++++-------
 .../org/apache/hadoop/hbase/http/InfoServer.java   |  51 ++++-----
 .../apache/hadoop/hbase/http/NoCacheFilter.java    |   8 +-
 .../apache/hadoop/hbase/http/ProfileServlet.java   |   4 +-
 .../apache/hadoop/hbase/http/conf/ConfServlet.java |   7 +-
 .../org/apache/hadoop/hbase/http/log/LogLevel.java |  30 +++---
 .../org/apache/hadoop/hbase/util/ProcessUtils.java |   4 +-
 .../hbase/http/HttpServerFunctionalTest.java       |  27 ++---
 .../apache/hadoop/hbase/http/TestGlobalFilter.java |  44 ++++----
 .../apache/hadoop/hbase/http/TestHtmlQuoting.java  |   7 +-
 .../apache/hadoop/hbase/http/TestHttpServer.java   | 103 ++++++++----------
 .../apache/hadoop/hbase/http/TestPathFilter.java   |  41 ++++---
 .../hadoop/hbase/http/TestServletFilter.java       |  38 +++----
 .../hadoop/hbase/http/TestSpnegoHttpServer.java    |  59 +++++-----
 .../apache/hadoop/hbase/http/log/TestLogLevel.java |  18 ++--
 .../hadoop/hbase/http/resource/JerseyResource.java |   2 +-
 .../hadoop/hbase/http/ssl/KeyStoreTestUtil.java    |  13 ++-
 23 files changed, 376 insertions(+), 322 deletions(-)

diff --git 
a/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml 
b/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml
index 77eefc2..090f1d9 100644
--- a/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml
+++ b/hbase-checkstyle/src/main/resources/hbase/checkstyle-suppressions.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <!DOCTYPE suppressions PUBLIC
-    "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
-    "https://checkstyle.org/dtds/suppressions_1_2.dtd";>
+        "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
+        "https://checkstyle.org/dtds/suppressions_1_2.dtd";>
 <!--
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -38,6 +38,9 @@
   <suppress checks="InterfaceIsTypeCheck" files=".*/src/main/.*\.java"/>
   <suppress checks="MethodLength" files="Branch1CoprocessorMethods.java"/>
   <suppress checks="EmptyBlockCheck" files="TBoundedThreadPoolServer.java"/>
+  <suppress checks="EmptyBlockCheck" files="TestServletFilter.java"/>
+  <suppress checks="EmptyBlockCheck" files="TestGlobalFilter.java"/>
+  <suppress checks="EmptyBlockCheck" files="TestPathFilter.java"/>
   <suppress checks="EqualsHashCode" files="StartcodeAgnosticServerName.java"/>
   <suppress checks="MethodLength" files="Branch1CoprocessorMethods.java"/>
   <suppress checks="IllegalImport" message="org\.apache\.htrace\.core"/>
diff --git a/hbase-http/pom.xml b/hbase-http/pom.xml
index e9c185f..ada1892 100644
--- a/hbase-http/pom.xml
+++ b/hbase-http/pom.xml
@@ -121,6 +121,13 @@
         </configuration>
       </plugin>
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <failOnViolation>true</failOnViolation>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>net.revelc.code</groupId>
         <artifactId>warbucks-maven-plugin</artifactId>
       </plugin>
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ClickjackingPreventionFilter.java
 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ClickjackingPreventionFilter.java
index 9944d29..7ce1301 100644
--- 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ClickjackingPreventionFilter.java
+++ 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ClickjackingPreventionFilter.java
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.hbase.http;
 
+import java.io.IOException;
+
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -24,32 +26,29 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
 
+import org.apache.yetus.audience.InterfaceAudience;
+
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
 public class ClickjackingPreventionFilter implements Filter {
-
-    private FilterConfig filterConfig;
-
-    @Override
-    public void init(FilterConfig filterConfig) throws ServletException {
-        this.filterConfig = filterConfig;
-    }
-
-    @Override
-    public void doFilter(ServletRequest req, ServletResponse res,
-                         FilterChain chain)
-            throws IOException, ServletException {
-        HttpServletResponse httpRes = (HttpServletResponse) res;
-        httpRes.addHeader("X-Frame-Options", 
filterConfig.getInitParameter("xframeoptions"));
-        chain.doFilter(req, res);
-    }
-
-    @Override
-    public void destroy() {
-    }
-
+  private FilterConfig filterConfig;
+
+  @Override
+  public void init(FilterConfig filterConfig) throws ServletException {
+    this.filterConfig = filterConfig;
+  }
+
+  @Override
+  public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain)
+        throws IOException, ServletException {
+    HttpServletResponse httpRes = (HttpServletResponse) res;
+    httpRes.addHeader("X-Frame-Options", 
filterConfig.getInitParameter("xframeoptions"));
+    chain.doFilter(req, res);
+  }
+
+  @Override
+  public void destroy() {
+  }
 }
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HtmlQuoting.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HtmlQuoting.java
index e2eebb2..678b397 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HtmlQuoting.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HtmlQuoting.java
@@ -42,19 +42,19 @@ public final class HtmlQuoting {
    */
   public static boolean needsQuoting(byte[] data, int off, int len) {
     if (off+len > data.length) {
-        throw new IllegalStateException("off+len=" + off+len + " should be 
lower"
-                + " than data length=" + data.length);
+      throw new IllegalStateException("off+len=" + off+len + " should be lower"
+              + " than data length=" + data.length);
     }
     for(int i=off; i< off+len; ++i) {
       switch(data[i]) {
-      case '&':
-      case '<':
-      case '>':
-      case '\'':
-      case '"':
-        return true;
-      default:
-        break;
+        case '&':
+        case '<':
+        case '>':
+        case '\'':
+        case '"':
+          return true;
+        default:
+          break;
       }
     }
     return false;
@@ -81,16 +81,28 @@ public final class HtmlQuoting {
    * @param off the index of the first byte to quote
    * @param len the number of bytes to quote
    */
-  public static void quoteHtmlChars(OutputStream output, byte[] buffer,
-                                    int off, int len) throws IOException {
+  public static void quoteHtmlChars(OutputStream output, byte[] buffer, int 
off, int len)
+          throws IOException {
     for(int i=off; i < off+len; i++) {
       switch (buffer[i]) {
-      case '&': output.write(ampBytes); break;
-      case '<': output.write(ltBytes); break;
-      case '>': output.write(gtBytes); break;
-      case '\'': output.write(aposBytes); break;
-      case '"': output.write(quotBytes); break;
-      default: output.write(buffer, i, 1);
+        case '&':
+          output.write(ampBytes);
+          break;
+        case '<':
+          output.write(ltBytes);
+          break;
+        case '>':
+          output.write(gtBytes);
+          break;
+        case '\'':
+          output.write(aposBytes);
+          break;
+        case '"':
+          output.write(quotBytes);
+          break;
+        default:
+          output.write(buffer, i, 1);
+          break;
       }
     }
   }
@@ -122,10 +134,8 @@ public final class HtmlQuoting {
    * Return an output stream that quotes all of the output.
    * @param out the stream to write the quoted output to
    * @return a new stream that the application show write to
-   * @throws IOException if the underlying output fails
    */
-  public static OutputStream quoteOutputStream(final OutputStream out
-                                               ) throws IOException {
+  public static OutputStream quoteOutputStream(final OutputStream out) {
     return new OutputStream() {
       private byte[] data = new byte[1];
       @Override
@@ -200,9 +210,9 @@ public final class HtmlQuoting {
     return buffer.toString();
   }
 
-  public static void main(String[] args) throws Exception {
+  public static void main(String[] args) {
     if (args.length == 0) {
-        throw new IllegalArgumentException("Please provide some arguments");
+      throw new IllegalArgumentException("Please provide some arguments");
     }
     for(String arg:args) {
       System.out.println("Original: " + arg);
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpConfig.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpConfig.java
index b9dde23..52c9133 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpConfig.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpConfig.java
@@ -17,9 +17,10 @@
  */
 package org.apache.hadoop.hbase.http;
 
+import org.apache.hadoop.conf.Configuration;
+
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.yetus.audience.InterfaceStability;
-import org.apache.hadoop.conf.Configuration;
 
 /**
  * Statics to get access to Http related configuration.
@@ -51,7 +52,7 @@ public class HttpConfig {
     }
   }
 
-   public HttpConfig(final Configuration conf) {
+  public HttpConfig(final Configuration conf) {
     boolean sslEnabled = conf.getBoolean(
       ServerConfigurationKeys.HBASE_SSL_ENABLED_KEY,
       ServerConfigurationKeys.HBASE_SSL_ENABLED_DEFAULT);
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLogAppender.java
 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLogAppender.java
index b6ce3c1..fe90498 100644
--- 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLogAppender.java
+++ 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpRequestLogAppender.java
@@ -17,8 +17,8 @@
  */
 package org.apache.hadoop.hbase.http;
 
-import org.apache.log4j.spi.LoggingEvent;
 import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
 import org.apache.yetus.audience.InterfaceAudience;
 
 /**
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java
index e9bcfbb..e816eed 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/HttpServer.java
@@ -147,7 +147,7 @@ public class HttpServer implements FilterContainer {
   protected String appDir;
   protected String logDir;
 
-  private static class ListenerInfo {
+  private static final class ListenerInfo {
     /**
      * Boolean flag to determine whether the HTTP server should clean up the
      * listener in stop().
@@ -206,10 +206,22 @@ public class HttpServer implements FilterContainer {
     private String kerberosNameRulesKey;
     private String signatureSecretFileKey;
 
+    /**
+     * @see #setAppDir(String)
+     * @deprecated Since 0.99.0. Use builder pattern via {@link 
#setAppDir(String)} instead.
+     */
     @Deprecated
     private String name;
+    /**
+     * @see #addEndpoint(URI)
+     * @deprecated Since 0.99.0. Use builder pattern via {@link 
#addEndpoint(URI)} instead.
+     */
     @Deprecated
     private String bindAddress;
+    /**
+     * @see #addEndpoint(URI)
+     * @deprecated Since 0.99.0. Use builder pattern vai {@link 
#addEndpoint(URI)} instead.
+     */
     @Deprecated
     private int port = -1;
 
@@ -267,7 +279,8 @@ public class HttpServer implements FilterContainer {
     }
 
     /**
-     * Use setAppDir() instead.
+     * @see #setAppDir(String)
+     * @deprecated Since 0.99.0. Use {@link #setAppDir(String)} instead.
      */
     @Deprecated
     public Builder setName(String name){
@@ -276,7 +289,8 @@ public class HttpServer implements FilterContainer {
     }
 
     /**
-     * Use addEndpoint() instead.
+     * @see #addEndpoint(URI)
+     * @deprecated Since 0.99.0. Use {@link #addEndpoint(URI)} instead.
      */
     @Deprecated
     public Builder setBindAddress(String bindAddress){
@@ -285,7 +299,8 @@ public class HttpServer implements FilterContainer {
     }
 
     /**
-     * Use addEndpoint() instead.
+     * @see #addEndpoint(URI)
+     * @deprecated Since 0.99.0. Use {@link #addEndpoint(URI)} instead.
      */
     @Deprecated
     public Builder setPort(int port) {
@@ -339,14 +354,14 @@ public class HttpServer implements FilterContainer {
     }
 
     public Builder setAppDir(String appDir) {
-        this.appDir = appDir;
-        return this;
-      }
+      this.appDir = appDir;
+      return this;
+    }
 
     public Builder setLogDir(String logDir) {
-        this.logDir = logDir;
-        return this;
-      }
+      this.logDir = logDir;
+      return this;
+    }
 
     public HttpServer build() throws IOException {
 
@@ -360,7 +375,8 @@ public class HttpServer implements FilterContainer {
         try {
           endpoints.add(0, new URI("http", "", bindAddress, port, "", "", ""));
         } catch (URISyntaxException e) {
-          throw new HadoopIllegalArgumentException("Invalid endpoint: "+ e); }
+          throw new HadoopIllegalArgumentException("Invalid endpoint: "+ e);
+        }
       }
 
       if (endpoints.isEmpty()) {
@@ -441,10 +457,13 @@ public class HttpServer implements FilterContainer {
 
   }
 
-  /** Same as this(name, bindAddress, port, findPort, null); */
+  /**
+   * @see #HttpServer(String, String, int, boolean, Configuration)
+   * @deprecated Since 0.99.0
+   */
   @Deprecated
-  public HttpServer(String name, String bindAddress, int port, boolean findPort
-      ) throws IOException {
+  public HttpServer(String name, String bindAddress, int port, boolean 
findPort)
+          throws IOException {
     this(name, bindAddress, port, findPort, new Configuration());
   }
 
@@ -461,6 +480,7 @@ public class HttpServer implements FilterContainer {
    * @param conf Configuration
    * @param pathSpecs Path specifications that this httpserver will be serving.
    *        These will be added to any filters.
+   * @deprecated Since 0.99.0
    */
   @Deprecated
   public HttpServer(String name, String bindAddress, int port,
@@ -476,6 +496,7 @@ public class HttpServer implements FilterContainer {
    * @param findPort whether the server should start at the given port and
    *        increment by 1 until it finds a free port.
    * @param conf Configuration
+   * @deprecated Since 0.99.0
    */
   @Deprecated
   public HttpServer(String name, String bindAddress, int port,
@@ -483,6 +504,20 @@ public class HttpServer implements FilterContainer {
     this(name, bindAddress, port, findPort, conf, null, null);
   }
 
+  /**
+   * Creates a status server on the given port. The JSP scripts are taken
+   * from src/webapp&lt;name&gt;.
+   *
+   * @param name the name of the server
+   * @param bindAddress the address for this server
+   * @param port the port to use on the server
+   * @param findPort whether the server should start at the given port and 
increment by 1 until it
+   *                 finds a free port
+   * @param conf the configuration to use
+   * @param adminsAcl {@link AccessControlList} of the admins
+   * @throws IOException when creating the server fails
+   * @deprecated Since 0.99.0
+   */
   @Deprecated
   public HttpServer(String name, String bindAddress, int port,
       boolean findPort, Configuration conf, AccessControlList adminsAcl)
@@ -502,6 +537,7 @@ public class HttpServer implements FilterContainer {
    * @param adminsAcl {@link AccessControlList} of the admins
    * @param pathSpecs Path specifications that this httpserver will be serving.
    *        These will be added to any filters.
+   * @deprecated Since 0.99.0
    */
   @Deprecated
   public HttpServer(String name, String bindAddress, int port,
@@ -628,14 +664,13 @@ public class HttpServer implements FilterContainer {
   /**
    * Add default apps.
    * @param appDir The application directory
-   * @throws IOException
    */
   protected void addDefaultApps(ContextHandlerCollection parent,
-      final String appDir, Configuration conf) throws IOException {
+      final String appDir, Configuration conf) {
     // set up the context for "/logs/" if "hadoop.log.dir" property is defined.
     String logDir = this.logDir;
     if (logDir == null) {
-        logDir = System.getProperty("hadoop.log.dir");
+      logDir = System.getProperty("hadoop.log.dir");
     }
     if (logDir != null) {
       ServletContextHandler logContext = new ServletContextHandler(parent, 
"/logs");
@@ -777,20 +812,18 @@ public class HttpServer implements FilterContainer {
     webAppContext.addServlet(holder, pathSpec);
 
     if(requireAuth && UserGroupInformation.isSecurityEnabled()) {
-       LOG.info("Adding Kerberos (SPNEGO) filter to " + name);
-       ServletHandler handler = webAppContext.getServletHandler();
-       FilterMapping fmap = new FilterMapping();
-       fmap.setPathSpec(pathSpec);
-       fmap.setFilterName(SPNEGO_FILTER);
-       fmap.setDispatches(FilterMapping.ALL);
-       handler.addFilterMapping(fmap);
+      LOG.info("Adding Kerberos (SPNEGO) filter to " + name);
+      ServletHandler handler = webAppContext.getServletHandler();
+      FilterMapping fmap = new FilterMapping();
+      fmap.setPathSpec(pathSpec);
+      fmap.setFilterName(SPNEGO_FILTER);
+      fmap.setDispatches(FilterMapping.ALL);
+      handler.addFilterMapping(fmap);
     }
   }
 
   @Override
-  public void addFilter(String name, String classname,
-      Map<String, String> parameters) {
-
+  public void addFilter(String name, String classname, Map<String, String> 
parameters) {
     final String[] USER_FACING_URLS = { "*.html", "*.jsp" };
     defineFilter(webAppContext, name, classname, parameters, USER_FACING_URLS);
     LOG.info("Added filter " + name + " (class=" + classname
@@ -808,8 +841,7 @@ public class HttpServer implements FilterContainer {
   }
 
   @Override
-  public void addGlobalFilter(String name, String classname,
-      Map<String, String> parameters) {
+  public void addGlobalFilter(String name, String classname, Map<String, 
String> parameters) {
     final String[] ALL_URLS = { "/*" };
     defineFilter(webAppContext, name, classname, parameters, ALL_URLS);
     for (ServletContextHandler ctx : defaultContexts.keySet()) {
@@ -823,7 +855,6 @@ public class HttpServer implements FilterContainer {
    */
   public static void defineFilter(ServletContextHandler handler, String name,
       String classname, Map<String,String> parameters, String[] urls) {
-
     FilterHolder holder = new FilterHolder();
     holder.setName(name);
     holder.setClassName(classname);
@@ -867,7 +898,7 @@ public class HttpServer implements FilterContainer {
   }
 
   public String getWebAppsPath(String appName) throws FileNotFoundException {
-      return getWebAppsPath(this.appDir, appName);
+    return getWebAppsPath(this.appDir, appName);
   }
 
   /**
@@ -878,9 +909,12 @@ public class HttpServer implements FilterContainer {
    */
   protected String getWebAppsPath(String webapps, String appName) throws 
FileNotFoundException {
     URL url = getClass().getClassLoader().getResource(webapps + "/" + appName);
-    if (url == null)
+
+    if (url == null) {
       throw new FileNotFoundException(webapps + "/" + appName
-          + " not found in CLASSPATH");
+              + " not found in CLASSPATH");
+    }
+
     String urlString = url.toString();
     return urlString.substring(0, urlString.lastIndexOf('/'));
   }
@@ -888,6 +922,7 @@ public class HttpServer implements FilterContainer {
   /**
    * Get the port that the server is on
    * @return the port
+   * @deprecated Since 0.99.0
    */
   @Deprecated
   public int getPort() {
@@ -902,8 +937,10 @@ public class HttpServer implements FilterContainer {
    */
   public InetSocketAddress getConnectorAddress(int index) {
     Preconditions.checkArgument(index >= 0);
-    if (index > webServer.getConnectors().length)
+
+    if (index > webServer.getConnectors().length) {
       return null;
+    }
 
     ServerConnector c = (ServerConnector)webServer.getConnectors()[index];
     if (c.getLocalPort() == -1 || c.getLocalPort() == -2) {
@@ -1031,7 +1068,7 @@ public class HttpServer implements FilterContainer {
 
   /**
    * Open the main listener for the server
-   * @throws Exception
+   * @throws Exception if the listener cannot be opened or the appropriate 
port is already in use
    */
   @VisibleForTesting
   void openListeners() throws Exception {
@@ -1139,7 +1176,8 @@ public class HttpServer implements FilterContainer {
       return "Inactive HttpServer";
     } else {
       StringBuilder sb = new StringBuilder("HttpServer (")
-        .append(isAlive() ? STATE_DESCRIPTION_ALIVE : 
STATE_DESCRIPTION_NOT_LIVE).append("), listening at:");
+        .append(isAlive() ? STATE_DESCRIPTION_ALIVE :
+                STATE_DESCRIPTION_NOT_LIVE).append("), listening at:");
       for (ListenerInfo li : listeners) {
         ServerConnector l = li.listener;
         sb.append(l.getHost()).append(":").append(l.getPort()).append("/,");
@@ -1184,11 +1222,11 @@ public class HttpServer implements FilterContainer {
    * Does the user sending the HttpServletRequest has the administrator ACLs? 
If
    * it isn't the case, response will be modified to send an error to the user.
    *
-   * @param servletContext
-   * @param request
+   * @param servletContext the {@link ServletContext} to use
+   * @param request the {@link HttpServletRequest} to check
    * @param response used to send the error response if user does not have 
admin access.
    * @return true if admin-authorized, false otherwise
-   * @throws IOException
+   * @throws IOException if an unauthenticated or unauthorized user tries to 
access the page
    */
   public static boolean hasAdministratorAccess(
       ServletContext servletContext, HttpServletRequest request,
@@ -1304,8 +1342,8 @@ public class HttpServer implements FilterContainer {
        */
       @Override
       public String getParameter(String name) {
-        return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter
-                                     (HtmlQuoting.unquoteHtmlChars(name)));
+        return HtmlQuoting.quoteHtmlChars(rawRequest.getParameter(
+                HtmlQuoting.unquoteHtmlChars(name)));
       }
 
       @Override
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java
index 5fd6514..695fcd7 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/InfoServer.java
@@ -1,5 +1,4 @@
 /**
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -16,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.hadoop.hbase.http;
 
 import java.io.IOException;
@@ -24,9 +22,9 @@ import java.net.URI;
 
 import javax.servlet.http.HttpServlet;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.yetus.audience.InterfaceAudience;
-import org.apache.hadoop.conf.Configuration;
 
 /**
  * Create a Jetty embedded server to answer http requests. The primary goal
@@ -38,7 +36,6 @@ import org.apache.hadoop.conf.Configuration;
  */
 @InterfaceAudience.Private
 public class InfoServer {
-
   private static final String HBASE_APP_DIR = "hbase-webapps";
   private final org.apache.hadoop.hbase.http.HttpServer httpServer;
 
@@ -48,32 +45,33 @@ public class InfoServer {
    * @param name The name of the server
    * @param bindAddress address to bind to
    * @param port The port to use on the server
-   * @param findPort whether the server should start at the given port and
-   * increment by 1 until it finds a free port.
-   * @throws IOException e
+   * @param findPort whether the server should start at the given port and 
increment by 1 until it
+   *                 finds a free port.
+   * @param c the {@link Configuration} to build the server
+   * @throws IOException if getting one of the password fails or the server 
cannot be created
    */
   public InfoServer(String name, String bindAddress, int port, boolean 
findPort,
-      final Configuration c)
-  throws IOException {
+      final Configuration c) throws IOException {
     HttpConfig httpConfig = new HttpConfig(c);
     HttpServer.Builder builder =
       new org.apache.hadoop.hbase.http.HttpServer.Builder();
 
-      
builder.setName(name).addEndpoint(URI.create(httpConfig.getSchemePrefix() +
-        bindAddress + ":" +
-        port)).setAppDir(HBASE_APP_DIR).setFindPort(findPort).setConf(c);
-      String logDir = System.getProperty("hbase.log.dir");
-      if (logDir != null) {
-        builder.setLogDir(logDir);
-      }
+    builder.setName(name).addEndpoint(URI.create(httpConfig.getSchemePrefix() +
+      bindAddress + ":" +
+      port)).setAppDir(HBASE_APP_DIR).setFindPort(findPort).setConf(c);
+    String logDir = System.getProperty("hbase.log.dir");
+    if (logDir != null) {
+      builder.setLogDir(logDir);
+    }
     if (httpConfig.isSecure()) {
-    builder.keyPassword(HBaseConfiguration.getPassword(c, 
"ssl.server.keystore.keypassword", null))
-      .keyStore(c.get("ssl.server.keystore.location"),
-        HBaseConfiguration.getPassword(c,"ssl.server.keystore.password", null),
-        c.get("ssl.server.keystore.type", "jks"))
-      .trustStore(c.get("ssl.server.truststore.location"),
-        HBaseConfiguration.getPassword(c, "ssl.server.truststore.password", 
null),
-        c.get("ssl.server.truststore.type", "jks"));
+      builder.keyPassword(HBaseConfiguration
+              .getPassword(c, "ssl.server.keystore.keypassword", null))
+        .keyStore(c.get("ssl.server.keystore.location"),
+                
HBaseConfiguration.getPassword(c,"ssl.server.keystore.password", null),
+                c.get("ssl.server.keystore.type", "jks"))
+        .trustStore(c.get("ssl.server.truststore.location"),
+                HBaseConfiguration.getPassword(c, 
"ssl.server.truststore.password", null),
+                c.get("ssl.server.truststore.type", "jks"));
     }
     // Enable SPNEGO authentication
     if ("kerberos".equalsIgnoreCase(c.get(HttpServer.HTTP_UI_AUTHENTICATION, 
null))) {
@@ -89,7 +87,7 @@ public class InfoServer {
 
   public void addServlet(String name, String pathSpec,
           Class<? extends HttpServlet> clazz) {
-      this.httpServer.addServlet(name, pathSpec, clazz);
+    this.httpServer.addServlet(name, pathSpec, clazz);
   }
 
   public void setAttribute(String name, Object value) {
@@ -100,6 +98,10 @@ public class InfoServer {
     this.httpServer.start();
   }
 
+  /**
+   * @return the port of the info server
+   * @deprecated Since 0.99.0
+   */
   @Deprecated
   public int getPort() {
     return this.httpServer.getPort();
@@ -108,5 +110,4 @@ public class InfoServer {
   public void stop() throws Exception {
     this.httpServer.stop();
   }
-
 }
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/NoCacheFilter.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/NoCacheFilter.java
index a1daf15..a1d4173 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/NoCacheFilter.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/NoCacheFilter.java
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.hbase.http;
 
+import java.io.IOException;
+
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -24,14 +26,13 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 
-import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
 
+import org.apache.yetus.audience.InterfaceAudience;
+
 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
 public class NoCacheFilter implements Filter {
-
   @Override
   public void init(FilterConfig filterConfig) throws ServletException {
   }
@@ -52,5 +53,4 @@ public class NoCacheFilter implements Filter {
   @Override
   public void destroy() {
   }
-
 }
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileServlet.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileServlet.java
index 25255a0..09d9734 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileServlet.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/ProfileServlet.java
@@ -31,11 +31,13 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.hadoop.hbase.util.ProcessUtils;
-import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
 import org.apache.yetus.audience.InterfaceAudience;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
+
 /**
  * Servlet that runs async-profiler as web-endpoint.
  * Following options from async-profiler can be specified as query paramater.
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/conf/ConfServlet.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/conf/ConfServlet.java
index d9aa7b6..05ca9a3 100644
--- 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/conf/ConfServlet.java
+++ 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/conf/ConfServlet.java
@@ -25,11 +25,12 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.yetus.audience.InterfaceAudience;
-import org.apache.yetus.audience.InterfaceStability;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.http.HttpServer;
 
+import org.apache.yetus.audience.InterfaceAudience;
+import org.apache.yetus.audience.InterfaceStability;
+
 /**
  * A servlet to print out the running configuration data.
  */
@@ -56,7 +57,6 @@ public class ConfServlet extends HttpServlet {
   @Override
   public void doGet(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
-
     if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
                                                    request, response)) {
       return;
@@ -103,5 +103,4 @@ public class ConfServlet extends HttpServlet {
       super(msg);
     }
   }
-
 }
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java
index cb23421..6f619ae 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java
@@ -24,6 +24,7 @@ import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.net.URL;
 import java.net.URLConnection;
+import java.util.Objects;
 import java.util.regex.Pattern;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -45,7 +46,7 @@ import org.slf4j.impl.Log4jLoggerAdapter;
  */
 @InterfaceAudience.Private
 public final class LogLevel {
-  public static final String USAGES = "\nUsage: General options are:\n"
+  private static final String USAGES = "\nUsage: General options are:\n"
       + "\t[-getlevel <host:httpPort> <name>]\n"
       + "\t[-setlevel <host:httpPort> <name> <level>]\n";
 
@@ -75,19 +76,16 @@ public final class LogLevel {
       connection.connect();
       try (InputStreamReader streamReader = new 
InputStreamReader(connection.getInputStream());
            BufferedReader bufferedReader = new BufferedReader(streamReader)) {
-        for(String line; (line = bufferedReader.readLine()) != null; ) {
-          if (line.startsWith(MARKER)) {
-            System.out.println(TAG.matcher(line).replaceAll(""));
-          }
-        }
+        bufferedReader.lines().filter(Objects::nonNull).filter(line -> 
line.startsWith(MARKER))
+                .forEach(line -> 
System.out.println(TAG.matcher(line).replaceAll("")));
       }
     } catch (IOException ioe) {
       System.err.println("" + ioe);
     }
   }
 
-  static final String MARKER = "<!-- OUTPUT -->";
-  static final Pattern TAG = Pattern.compile("<[^>]*>");
+  private static final String MARKER = "<!-- OUTPUT -->";
+  private static final Pattern TAG = Pattern.compile("<[^>]*>");
 
   /**
    * A servlet implementation
@@ -98,9 +96,8 @@ public final class LogLevel {
     private static final long serialVersionUID = 1L;
 
     @Override
-    public void doGet(HttpServletRequest request, HttpServletResponse response
-        ) throws ServletException, IOException {
-
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
       // Do the authorization
       if (!HttpServer.hasAdministratorAccess(getServletContext(), request,
           response)) {
@@ -175,8 +172,7 @@ public final class LogLevel {
         + "Set the specified log level for the specified log name." + 
"</td>\n" + "</form>\n"
         + "</tr>\n" + "</table>\n" + "</center>\n" + "</p>\n" + "<hr/>\n";
 
-    private static void process(org.apache.log4j.Logger log, String level,
-        PrintWriter out) throws IOException {
+    private static void process(org.apache.log4j.Logger log, String level, 
PrintWriter out) {
       if (level != null) {
         if (!level.equals(org.apache.log4j.Level.toLevel(level).toString())) {
           out.println(MARKER + "<div class='text-danger'>" + "Bad level : 
<strong>" + level
@@ -192,14 +188,18 @@ public final class LogLevel {
     }
 
     private static void process(java.util.logging.Logger log, String level,
-        PrintWriter out) throws IOException {
+        PrintWriter out) {
       if (level != null) {
         log.setLevel(java.util.logging.Level.parse(level));
         out.println(MARKER + "Setting Level to " + level + " ...<br />");
       }
 
       java.util.logging.Level lev;
-      for(; (lev = log.getLevel()) == null; log = log.getParent());
+
+      while ((lev = log.getLevel()) == null) {
+        log = log.getParent();
+      }
+
       out.println(MARKER + "Effective level: <b>" + lev + "</b><br />");
     }
   }
diff --git 
a/hbase-http/src/main/java/org/apache/hadoop/hbase/util/ProcessUtils.java 
b/hbase-http/src/main/java/org/apache/hadoop/hbase/util/ProcessUtils.java
index 2d3835e..7ed0946 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/util/ProcessUtils.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/util/ProcessUtils.java
@@ -21,11 +21,11 @@ import java.io.IOException;
 import java.lang.management.ManagementFactory;
 import java.util.List;
 
+import org.apache.yetus.audience.InterfaceAudience;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.yetus.audience.InterfaceAudience;
-
 /**
  * Process related utilities.
  */
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/HttpServerFunctionalTest.java
 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/HttpServerFunctionalTest.java
index 69972a2..b81826b 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/HttpServerFunctionalTest.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/HttpServerFunctionalTest.java
@@ -18,19 +18,19 @@
 
 package org.apache.hadoop.hbase.http;
 
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.authorize.AccessControlList;
-import org.junit.Assert;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.http.HttpServer.Builder;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.ServerSocket;
 import java.net.URI;
 import java.net.URL;
-import java.net.MalformedURLException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.http.HttpServer.Builder;
+import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.security.authorize.AccessControlList;
+import org.junit.Assert;
 
 /**
  * This is a base class for functional tests of the {@link HttpServer}.
@@ -114,9 +114,9 @@ public class HttpServerFunctionalTest extends Assert {
     File testWebappDir = new File(webapps +
         File.separatorChar + TEST);
     try {
-    if (!testWebappDir.exists()) {
-      fail("Test webapp dir " + testWebappDir.getCanonicalPath() + " missing");
-    }
+      if (!testWebappDir.exists()) {
+        fail("Test webapp dir " + testWebappDir.getCanonicalPath() + " 
missing");
+      }
     }
     catch (IOException e) {
     }
@@ -158,8 +158,8 @@ public class HttpServerFunctionalTest extends Assert {
     return localServerBuilder(webapp).setFindPort(true).setConf(conf).build();
   }
 
-  public static HttpServer createServer(String webapp, Configuration conf, 
AccessControlList adminsAcl)
-      throws IOException {
+  public static HttpServer createServer(String webapp, Configuration conf,
+      AccessControlList adminsAcl) throws IOException {
     return 
localServerBuilder(webapp).setFindPort(true).setConf(conf).setACL(adminsAcl).build();
   }
 
@@ -178,7 +178,8 @@ public class HttpServerFunctionalTest extends Assert {
    */
   public static HttpServer createServer(String webapp, Configuration conf,
       String[] pathSpecs) throws IOException {
-    return 
localServerBuilder(webapp).setFindPort(true).setConf(conf).setPathSpec(pathSpecs).build();
+    return 
localServerBuilder(webapp).setFindPort(true).setConf(conf).setPathSpec(pathSpecs)
+            .build();
   }
 
   /**
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestGlobalFilter.java 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestGlobalFilter.java
index 8190290..cb2a674 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestGlobalFilter.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestGlobalFilter.java
@@ -44,13 +44,12 @@ import org.slf4j.LoggerFactory;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestGlobalFilter extends HttpServerFunctionalTest {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestGlobalFilter.class);
 
   private static final Logger LOG = LoggerFactory.getLogger(HttpServer.class);
-  static final Set<String> RECORDS = new TreeSet<>();
+  private static final Set<String> RECORDS = new TreeSet<>();
 
   /** A very simple filter that records accessed uri's */
   static public class RecordingFilter implements Filter {
@@ -67,10 +66,11 @@ public class TestGlobalFilter extends 
HttpServerFunctionalTest {
     }
 
     @Override
-    public void doFilter(ServletRequest request, ServletResponse response,
-        FilterChain chain) throws IOException, ServletException {
-      if (filterConfig == null)
-         return;
+    public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain chain)
+            throws IOException, ServletException {
+      if (filterConfig == null) {
+        return;
+      }
 
       String uri = ((HttpServletRequest)request).getRequestURI();
       LOG.info("filtering " + uri);
@@ -89,21 +89,21 @@ public class TestGlobalFilter extends 
HttpServerFunctionalTest {
     }
   }
 
-
-  /** access a url, ignoring some IOException such as the page does not exist 
*/
-  static void access(String urlstring) throws IOException {
+  /**
+   * access a url, ignoring some IOException such as the page does not exist
+   */
+  private static void access(String urlstring) throws IOException {
     LOG.warn("access " + urlstring);
     URL url = new URL(urlstring);
     URLConnection connection = url.openConnection();
     connection.connect();
 
     try {
-      BufferedReader in = new BufferedReader(new InputStreamReader(
-          connection.getInputStream()));
-      try {
-        for(; in.readLine() != null; );
-      } finally {
-        in.close();
+      try (BufferedReader in = new BufferedReader(
+              new InputStreamReader(connection.getInputStream(), "UTF-8"))) {
+        for (; in.readLine() != null; ) {
+          // Ignoring the content of the URLs. Only checking if something is 
there.
+        }
       }
     } catch(IOException ioe) {
       LOG.warn("urlstring=" + urlstring, ioe);
@@ -131,15 +131,17 @@ public class TestGlobalFilter extends 
HttpServerFunctionalTest {
     final String outURL = "/static/a.out";
     final String logURL = "/logs/a.log";
 
-    final String[] urls = {fsckURL, stacksURL, ajspURL, listPathsURL,
-        dataURL, streamFile, rootURL, allURL, outURL, logURL};
+    final String[] urls = {
+      fsckURL, stacksURL, ajspURL, listPathsURL, dataURL, streamFile, rootURL, 
allURL,
+      outURL, logURL
+    };
 
     //access the urls
     final String prefix = "http://";
         + NetUtils.getHostPortString(http.getConnectorAddress(0));
     try {
-      for(int i = 0; i < urls.length; i++) {
-        access(prefix + urls[i]);
+      for (String url : urls) {
+        access(prefix + url);
       }
     } finally {
       http.stop();
@@ -148,8 +150,8 @@ public class TestGlobalFilter extends 
HttpServerFunctionalTest {
     LOG.info("RECORDS = " + RECORDS);
 
     //verify records
-    for(int i = 0; i < urls.length; i++) {
-      assertTrue(RECORDS.remove(urls[i]));
+    for (String url : urls) {
+      assertTrue(RECORDS.remove(url));
     }
     assertTrue(RECORDS.isEmpty());
   }
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHtmlQuoting.java 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHtmlQuoting.java
index f47991d..0f4c4d5 100644
--- a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHtmlQuoting.java
+++ b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHtmlQuoting.java
@@ -17,7 +17,10 @@
  */
 package org.apache.hadoop.hbase.http;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import javax.servlet.http.HttpServletRequest;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
@@ -30,7 +33,6 @@ import org.mockito.Mockito;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestHtmlQuoting {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestHtmlQuoting.class);
@@ -73,7 +75,6 @@ public class TestHtmlQuoting {
     runRoundTrip(buffer.toString());
   }
 
-
   @Test
   public void testRequestQuoting() throws Exception {
     HttpServletRequest mockReq = Mockito.mock(HttpServletRequest.class);
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpServer.java 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpServer.java
index 0f5b8a1..1ab1140 100644
--- a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpServer.java
+++ b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestHttpServer.java
@@ -23,6 +23,7 @@ import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URL;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
@@ -70,7 +71,6 @@ import org.slf4j.LoggerFactory;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestHttpServer extends HttpServerFunctionalTest {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestHttpServer.class);
@@ -84,9 +84,7 @@ public class TestHttpServer extends HttpServerFunctionalTest {
   @SuppressWarnings("serial")
   public static class EchoMapServlet extends HttpServlet {
     @Override
-    public void doGet(HttpServletRequest request,
-                      HttpServletResponse response
-                      ) throws ServletException, IOException {
+    public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException {
       PrintWriter out = response.getWriter();
       Map<String, String[]> params = request.getParameterMap();
       SortedSet<String> keys = new TreeSet<>(params.keySet());
@@ -110,9 +108,8 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
   @SuppressWarnings("serial")
   public static class EchoServlet extends HttpServlet {
     @Override
-    public void doGet(HttpServletRequest request,
-                      HttpServletResponse response
-                      ) throws ServletException, IOException {
+    public void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws IOException {
       PrintWriter out = response.getWriter();
       SortedSet<String> sortedKeys = new TreeSet<>();
       Enumeration<String> keys = request.getParameterNames();
@@ -132,9 +129,7 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
   @SuppressWarnings("serial")
   public static class LongHeaderServlet extends HttpServlet {
     @Override
-    public void doGet(HttpServletRequest request,
-                      HttpServletResponse response
-    ) throws ServletException, IOException {
+    public void doGet(HttpServletRequest request, HttpServletResponse 
response) {
       Assert.assertEquals(63 * 1024, request.getHeader("longheader").length());
       response.setStatus(HttpServletResponse.SC_OK);
     }
@@ -143,9 +138,7 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
   @SuppressWarnings("serial")
   public static class HtmlContentServlet extends HttpServlet {
     @Override
-    public void doGet(HttpServletRequest request,
-                      HttpServletResponse response
-                      ) throws ServletException, IOException {
+    public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException {
       response.setContentType("text/html");
       PrintWriter out = response.getWriter();
       out.print("hello world");
@@ -172,30 +165,30 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
     server.stop();
   }
 
-  /** Test the maximum number of threads cannot be exceeded. */
-  @Test public void testMaxThreads() throws Exception {
+  /**
+   * Test the maximum number of threads cannot be exceeded.
+   */
+  @Test
+  public void testMaxThreads() throws Exception {
     int clientThreads = MAX_THREADS * 10;
     Executor executor = Executors.newFixedThreadPool(clientThreads);
     // Run many clients to make server reach its maximum number of threads
     final CountDownLatch ready = new CountDownLatch(clientThreads);
     final CountDownLatch start = new CountDownLatch(1);
     for (int i = 0; i < clientThreads; i++) {
-      executor.execute(new Runnable() {
-        @Override
-        public void run() {
-          ready.countDown();
-          try {
-            start.await();
-            assertEquals("a:b\nc:d\n",
-                         readOutput(new URL(baseUrl, "/echo?a=b&c=d")));
-            int serverThreads = server.webServer.getThreadPool().getThreads();
-            assertTrue("More threads are started than expected, Server Threads 
count: "
-                    + serverThreads, serverThreads <= MAX_THREADS);
-            System.out.println("Number of threads = " + serverThreads +
-                " which is less or equal than the max = " + MAX_THREADS);
-          } catch (Exception e) {
-            // do nothing
-          }
+      executor.execute(() -> {
+        ready.countDown();
+        try {
+          start.await();
+          assertEquals("a:b\nc:d\n",
+                       readOutput(new URL(baseUrl, "/echo?a=b&c=d")));
+          int serverThreads = server.webServer.getThreadPool().getThreads();
+          assertTrue("More threads are started than expected, Server Threads 
count: "
+                  + serverThreads, serverThreads <= MAX_THREADS);
+          LOG.info("Number of threads = " + serverThreads +
+              " which is less or equal than the max = " + MAX_THREADS);
+        } catch (Exception e) {
+          // do nothing
         }
       });
     }
@@ -300,7 +293,7 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
     }
 
     @Override
-    public void init(FilterConfig arg0) throws ServletException { }
+    public void init(FilterConfig arg0) { }
   }
 
   /**
@@ -327,8 +320,7 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
    * @return The HTTP response code
    * @throws IOException if there is a problem communicating with the server
    */
-  static int getHttpStatusCode(String urlstring, String userName)
-      throws IOException {
+  private static int getHttpStatusCode(String urlstring, String userName) 
throws IOException {
     URL url = new URL(urlstring + "?user.name=" + userName);
     System.out.println("Accessing " + url + " as user " + userName);
     HttpURLConnection connection = (HttpURLConnection)url.openConnection();
@@ -347,7 +339,7 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
     }
 
     @Override
-    public List<String> getGroups(String user) throws IOException {
+    public List<String> getGroups(String user) {
       return mapping.get(user);
     }
   }
@@ -356,12 +348,10 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
    * Verify the access for /logs, /stacks, /conf, /logLevel and /metrics
    * servlets, when authentication filters are set, but authorization is not
    * enabled.
-   * @throws Exception
    */
   @Test
   @Ignore
   public void testDisabledAuthorizationOfDefaultServlets() throws Exception {
-
     Configuration conf = new Configuration();
 
     // Authorization is disabled by default
@@ -371,16 +361,15 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
         MyGroupsProvider.class.getName());
     Groups.getUserToGroupsMappingService(conf);
     MyGroupsProvider.clearMapping();
-    MyGroupsProvider.mapping.put("userA", Arrays.asList("groupA"));
-    MyGroupsProvider.mapping.put("userB", Arrays.asList("groupB"));
+    MyGroupsProvider.mapping.put("userA", Collections.singletonList("groupA"));
+    MyGroupsProvider.mapping.put("userB", Collections.singletonList("groupB"));
 
     HttpServer myServer = new HttpServer.Builder().setName("test")
         .addEndpoint(new URI("http://localhost:0";)).setFindPort(true).build();
     myServer.setAttribute(HttpServer.CONF_CONTEXT_ATTRIBUTE, conf);
     myServer.start();
     String serverURL = "http://"; + 
NetUtils.getHostPortString(myServer.getConnectorAddress(0)) + "/";
-    for (String servlet : new String[] { "conf", "logs", "stacks",
-        "logLevel", "metrics" }) {
+    for (String servlet : new String[] { "conf", "logs", "stacks", "logLevel", 
"metrics" }) {
       for (String user : new String[] { "userA", "userB" }) {
         assertEquals(HttpURLConnection.HTTP_OK, getHttpStatusCode(serverURL
             + servlet, user));
@@ -392,8 +381,6 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
   /**
    * Verify the administrator access for /logs, /stacks, /conf, /logLevel and
    * /metrics servlets.
-   *
-   * @throws Exception
    */
   @Test
   @Ignore
@@ -410,11 +397,11 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
         MyGroupsProvider.class.getName());
     Groups.getUserToGroupsMappingService(conf);
     MyGroupsProvider.clearMapping();
-    MyGroupsProvider.mapping.put("userA", Arrays.asList("groupA"));
-    MyGroupsProvider.mapping.put("userB", Arrays.asList("groupB"));
-    MyGroupsProvider.mapping.put("userC", Arrays.asList("groupC"));
-    MyGroupsProvider.mapping.put("userD", Arrays.asList("groupD"));
-    MyGroupsProvider.mapping.put("userE", Arrays.asList("groupE"));
+    MyGroupsProvider.mapping.put("userA", Collections.singletonList("groupA"));
+    MyGroupsProvider.mapping.put("userB", Collections.singletonList("groupB"));
+    MyGroupsProvider.mapping.put("userC", Collections.singletonList("groupC"));
+    MyGroupsProvider.mapping.put("userD", Collections.singletonList("groupD"));
+    MyGroupsProvider.mapping.put("userE", Collections.singletonList("groupE"));
 
     HttpServer myServer = new HttpServer.Builder().setName("test")
         .addEndpoint(new 
URI("http://localhost:0";)).setFindPort(true).setConf(conf)
@@ -424,8 +411,7 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
 
     String serverURL = "http://";
         + NetUtils.getHostPortString(myServer.getConnectorAddress(0)) + "/";
-    for (String servlet : new String[] { "conf", "logs", "stacks",
-        "logLevel", "metrics" }) {
+    for (String servlet : new String[] { "conf", "logs", "stacks", "logLevel", 
"metrics" }) {
       for (String user : new String[] { "userA", "userB", "userC", "userD" }) {
         assertEquals(HttpURLConnection.HTTP_OK, getHttpStatusCode(serverURL
             + servlet, user));
@@ -437,17 +423,17 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
   }
 
   @Test
-  public void testRequestQuoterWithNull() throws Exception {
+  public void testRequestQuoterWithNull() {
     HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
     Mockito.doReturn(null).when(request).getParameterValues("dummy");
     RequestQuoter requestQuoter = new RequestQuoter(request);
     String[] parameterValues = requestQuoter.getParameterValues("dummy");
-    Assert.assertEquals("It should return null "
-        + "when there are no values for the parameter", null, parameterValues);
+    Assert.assertNull("It should return null "
+            + "when there are no values for the parameter", parameterValues);
   }
 
   @Test
-  public void testRequestQuoterWithNotNull() throws Exception {
+  public void testRequestQuoterWithNotNull() {
     HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
     String[] values = new String[] { "abc", "def" };
     Mockito.doReturn(values).when(request).getParameterValues("dummy");
@@ -490,7 +476,8 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
     response = Mockito.mock(HttpServletResponse.class);
     conf.setBoolean(CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, 
true);
     Assert.assertFalse(HttpServer.hasAdministratorAccess(context, request, 
response));
-    
Mockito.verify(response).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED),
 Mockito.anyString());
+    
Mockito.verify(response).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED),
+            Mockito.anyString());
 
     //authorization ON & user NOT NULL & ACLs NULL
     response = Mockito.mock(HttpServletResponse.class);
@@ -503,7 +490,8 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
     
Mockito.when(acls.isUserAllowed(Mockito.<UserGroupInformation>any())).thenReturn(false);
     Mockito.when(context.getAttribute(HttpServer.ADMINS_ACL)).thenReturn(acls);
     Assert.assertFalse(HttpServer.hasAdministratorAccess(context, request, 
response));
-    
Mockito.verify(response).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED),
 Mockito.anyString());
+    
Mockito.verify(response).sendError(Mockito.eq(HttpServletResponse.SC_UNAUTHORIZED),
+            Mockito.anyString());
 
     //authorization ON & user NOT NULL & ACLs NOT NULL & user in in ACLs
     response = Mockito.mock(HttpServletResponse.class);
@@ -533,7 +521,8 @@ public class TestHttpServer extends 
HttpServerFunctionalTest {
     Assert.assertFalse(HttpServer.isInstrumentationAccessAllowed(context, 
request, response));
   }
 
-  @Test public void testBindAddress() throws Exception {
+  @Test
+  public void testBindAddress() throws Exception {
     checkBindAddress("localhost", 0, false).stop();
     // hang onto this one for a bit more testing
     HttpServer myServer = checkBindAddress("localhost", 0, false);
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestPathFilter.java 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestPathFilter.java
index 47e6ea2..d8a5e64 100644
--- a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestPathFilter.java
+++ b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestPathFilter.java
@@ -44,13 +44,12 @@ import org.slf4j.LoggerFactory;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestPathFilter extends HttpServerFunctionalTest {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestPathFilter.class);
 
   private static final Logger LOG = LoggerFactory.getLogger(HttpServer.class);
-  static final Set<String> RECORDS = new TreeSet<>();
+  private static final Set<String> RECORDS = new TreeSet<>();
 
   /** A very simple filter that records accessed uri's */
   static public class RecordingFilter implements Filter {
@@ -69,8 +68,9 @@ public class TestPathFilter extends HttpServerFunctionalTest {
     @Override
     public void doFilter(ServletRequest request, ServletResponse response,
         FilterChain chain) throws IOException, ServletException {
-      if (filterConfig == null)
-         return;
+      if (filterConfig == null) {
+        return;
+      }
 
       String uri = ((HttpServletRequest)request).getRequestURI();
       LOG.info("filtering " + uri);
@@ -89,9 +89,10 @@ public class TestPathFilter extends HttpServerFunctionalTest 
{
     }
   }
 
-
-  /** access a url, ignoring some IOException such as the page does not exist 
*/
-  static void access(String urlstring) throws IOException {
+  /**
+   * access a url, ignoring some IOException such as the page does not exist
+   */
+  private static void access(String urlstring) throws IOException {
     LOG.warn("access " + urlstring);
     URL url = new URL(urlstring);
 
@@ -99,12 +100,11 @@ public class TestPathFilter extends 
HttpServerFunctionalTest {
     connection.connect();
 
     try {
-      BufferedReader in = new BufferedReader(new InputStreamReader(
-          connection.getInputStream()));
-      try {
-        for(; in.readLine() != null; );
-      } finally {
-        in.close();
+      try (BufferedReader in = new BufferedReader(
+              new InputStreamReader(connection.getInputStream(), "UTF-8"))) {
+        for (; in.readLine() != null; ) {
+          // Ignoring the content of the URLs. Only checking if something is 
there.
+        }
       }
     } catch(IOException ioe) {
       LOG.warn("urlstring=" + urlstring, ioe);
@@ -130,8 +130,7 @@ public class TestPathFilter extends 
HttpServerFunctionalTest {
     final String rootURL = "/";
     final String allURL = "/*";
 
-    final String[] filteredUrls = {baseURL, baseSlashURL, addedURL,
-        addedSlashURL, longURL};
+    final String[] filteredUrls = { baseURL, baseSlashURL, addedURL, 
addedSlashURL, longURL };
     final String[] notFilteredUrls = {rootURL, allURL};
 
     // access the urls and verify our paths specs got added to the
@@ -139,11 +138,11 @@ public class TestPathFilter extends 
HttpServerFunctionalTest {
     final String prefix = "http://";
         + NetUtils.getHostPortString(http.getConnectorAddress(0));
     try {
-      for(int i = 0; i < filteredUrls.length; i++) {
-        access(prefix + filteredUrls[i]);
+      for (String filteredUrl : filteredUrls) {
+        access(prefix + filteredUrl);
       }
-      for(int i = 0; i < notFilteredUrls.length; i++) {
-        access(prefix + notFilteredUrls[i]);
+      for (String notFilteredUrl : notFilteredUrls) {
+        access(prefix + notFilteredUrl);
       }
     } finally {
       http.stop();
@@ -152,8 +151,8 @@ public class TestPathFilter extends 
HttpServerFunctionalTest {
     LOG.info("RECORDS = " + RECORDS);
 
     //verify records
-    for(int i = 0; i < filteredUrls.length; i++) {
-      assertTrue(RECORDS.remove(filteredUrls[i]));
+    for (String filteredUrl : filteredUrls) {
+      assertTrue(RECORDS.remove(filteredUrl));
     }
     assertTrue(RECORDS.isEmpty());
   }
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestServletFilter.java 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestServletFilter.java
index 6c70dbc..35c5531 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestServletFilter.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestServletFilter.java
@@ -46,13 +46,12 @@ import org.slf4j.LoggerFactory;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestServletFilter extends HttpServerFunctionalTest {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestServletFilter.class);
 
   private static final Logger LOG = LoggerFactory.getLogger(HttpServer.class);
-  static volatile String uri = null;
+  private static volatile String uri = null;
 
   /** A very simple filter which record the uri filtered. */
   static public class SimpleFilter implements Filter {
@@ -71,8 +70,9 @@ public class TestServletFilter extends 
HttpServerFunctionalTest {
     @Override
     public void doFilter(ServletRequest request, ServletResponse response,
         FilterChain chain) throws IOException, ServletException {
-      if (filterConfig == null)
-         return;
+      if (filterConfig == null) {
+        return;
+      }
 
       uri = ((HttpServletRequest)request).getRequestURI();
       LOG.info("filtering " + uri);
@@ -90,27 +90,28 @@ public class TestServletFilter extends 
HttpServerFunctionalTest {
     }
   }
 
-  public static void assertExceptionContains(String string, Throwable t) {
+  private static void assertExceptionContains(String string, Throwable t) {
     String msg = t.getMessage();
     Assert.assertTrue(
         "Expected to find '" + string + "' but got unexpected exception:"
         + StringUtils.stringifyException(t), msg.contains(string));
   }
 
-  /** access a url, ignoring some IOException such as the page does not exist 
*/
-  static void access(String urlstring) throws IOException {
+  /**
+   * access a url, ignoring some IOException such as the page does not exist
+   */
+  private static void access(String urlstring) throws IOException {
     LOG.warn("access " + urlstring);
     URL url = new URL(urlstring);
     URLConnection connection = url.openConnection();
     connection.connect();
 
     try {
-      BufferedReader in = new BufferedReader(new InputStreamReader(
-          connection.getInputStream()));
-      try {
-        for(; in.readLine() != null; );
-      } finally {
-        in.close();
+      try (BufferedReader in = new BufferedReader(new InputStreamReader(
+              connection.getInputStream(), "UTF-8"))) {
+        for (; in.readLine() != null; ) {
+          // Ignoring the content of the URLs. Only checking if something is 
there.
+        }
       }
     } catch(IOException ioe) {
       LOG.warn("urlstring=" + urlstring, ioe);
@@ -150,14 +151,14 @@ public class TestServletFilter extends 
HttpServerFunctionalTest {
     final String prefix = "http://";
         + NetUtils.getHostPortString(http.getConnectorAddress(0));
     try {
-      for(int i = 0; i < sequence.length; i++) {
-        access(prefix + urls[sequence[i]]);
+      for (int aSequence : sequence) {
+        access(prefix + urls[aSequence]);
 
         //make sure everything except fsck get filtered
-        if (sequence[i] == 0) {
-          assertEquals(null, uri);
+        if (aSequence == 0) {
+          assertNull(uri);
         } else {
-          assertEquals(urls[sequence[i]], uri);
+          assertEquals(urls[aSequence], uri);
           uri = null;
         }
       }
@@ -218,5 +219,4 @@ public class TestServletFilter extends 
HttpServerFunctionalTest {
       assertExceptionContains("Unable to initialize WebAppContext", e);
     }
   }
-
 }
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestSpnegoHttpServer.java
 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestSpnegoHttpServer.java
index 1262b0c..8d3cd95 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestSpnegoHttpServer.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/TestSpnegoHttpServer.java
@@ -69,7 +69,6 @@ import org.slf4j.LoggerFactory;
  */
 @Category({MiscTests.class, SmallTests.class})
 public class TestSpnegoHttpServer extends HttpServerFunctionalTest {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestSpnegoHttpServer.class);
@@ -208,35 +207,35 @@ public class TestSpnegoHttpServer extends 
HttpServerFunctionalTest {
     final String principalName = clientPrincipals.iterator().next().getName();
 
     // Run this code, logged in as the subject (the client)
-    HttpResponse resp = Subject.doAs(clientSubject,
-        new PrivilegedExceptionAction<HttpResponse>() {
-      @Override
-      public HttpResponse run() throws Exception {
-        // Logs in with Kerberos via GSS
-        GSSManager gssManager = GSSManager.getInstance();
-        // jGSS Kerberos login constant
-        Oid oid = new Oid("1.2.840.113554.1.2.2");
-        GSSName gssClient = gssManager.createName(principalName, 
GSSName.NT_USER_NAME);
-        GSSCredential credential = gssManager.createCredential(gssClient,
-            GSSCredential.DEFAULT_LIFETIME, oid, GSSCredential.INITIATE_ONLY);
-
-        HttpClientContext context = HttpClientContext.create();
-        Lookup<AuthSchemeProvider> authRegistry = 
RegistryBuilder.<AuthSchemeProvider>create()
-            .register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory(true, true))
-            .build();
-
-        HttpClient client = 
HttpClients.custom().setDefaultAuthSchemeRegistry(authRegistry).build();
-        BasicCredentialsProvider credentialsProvider = new 
BasicCredentialsProvider();
-        credentialsProvider.setCredentials(AuthScope.ANY, new 
KerberosCredentials(credential));
-
-        URL url = new URL(getServerURL(server), "/echo?a=b");
-        context.setTargetHost(new HttpHost(url.getHost(), url.getPort()));
-        context.setCredentialsProvider(credentialsProvider);
-        context.setAuthSchemeRegistry(authRegistry);
-
-        HttpGet get = new HttpGet(url.toURI());
-        return client.execute(get, context);
-      }
+    HttpResponse resp = Subject.doAs(clientSubject, new 
PrivilegedExceptionAction<HttpResponse>() {
+        @Override
+        public HttpResponse run() throws Exception {
+          // Logs in with Kerberos via GSS
+          GSSManager gssManager = GSSManager.getInstance();
+          // jGSS Kerberos login constant
+          Oid oid = new Oid("1.2.840.113554.1.2.2");
+          GSSName gssClient = gssManager.createName(principalName, 
GSSName.NT_USER_NAME);
+          GSSCredential credential = gssManager.createCredential(gssClient,
+              GSSCredential.DEFAULT_LIFETIME, oid, 
GSSCredential.INITIATE_ONLY);
+
+          HttpClientContext context = HttpClientContext.create();
+          Lookup<AuthSchemeProvider> authRegistry = 
RegistryBuilder.<AuthSchemeProvider>create()
+              .register(AuthSchemes.SPNEGO, new SPNegoSchemeFactory(true, 
true))
+              .build();
+
+          HttpClient client = 
HttpClients.custom().setDefaultAuthSchemeRegistry(authRegistry)
+                  .build();
+          BasicCredentialsProvider credentialsProvider = new 
BasicCredentialsProvider();
+          credentialsProvider.setCredentials(AuthScope.ANY, new 
KerberosCredentials(credential));
+
+          URL url = new URL(getServerURL(server), "/echo?a=b");
+          context.setTargetHost(new HttpHost(url.getHost(), url.getPort()));
+          context.setCredentialsProvider(credentialsProvider);
+          context.setAuthSchemeRegistry(authRegistry);
+
+          HttpGet get = new HttpGet(url.toURI());
+          return client.execute(get, context);
+        }
     });
 
     assertNotNull(resp);
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/log/TestLogLevel.java 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/log/TestLogLevel.java
index 9da4819..e258d85 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/log/TestLogLevel.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/log/TestLogLevel.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hbase.http.log;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedReader;
@@ -24,6 +25,7 @@ import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.net.URI;
 import java.net.URL;
+import java.util.Objects;
 import org.apache.hadoop.hbase.HBaseClassTestRule;
 import org.apache.hadoop.hbase.http.HttpServer;
 import org.apache.hadoop.hbase.testclassification.MiscTests;
@@ -40,12 +42,11 @@ import org.slf4j.impl.Log4jLoggerAdapter;
 
 @Category({MiscTests.class, SmallTests.class})
 public class TestLogLevel {
-
   @ClassRule
   public static final HBaseClassTestRule CLASS_RULE =
       HBaseClassTestRule.forClass(TestLogLevel.class);
 
-  static final PrintStream out = System.out;
+  private static final PrintStream out = System.out;
 
   @Test
   @SuppressWarnings("deprecation")
@@ -53,7 +54,7 @@ public class TestLogLevel {
     String logName = TestLogLevel.class.getName();
     org.slf4j.Logger testlog = LoggerFactory.getLogger(logName);
 
-    //only test Log4JLogger
+    // only test Log4JLogger
     if (testlog instanceof Log4jLoggerAdapter) {
       Logger log = LogManager.getLogger(logName);
       log.debug("log.debug1");
@@ -71,17 +72,17 @@ public class TestLogLevel {
         String authority = NetUtils.getHostPortString(server
             .getConnectorAddress(0));
 
-        //servlet
+        // servlet
         URL url =
             new URL("http://"; + authority + "/logLevel?log=" + logName + 
"&level=" + Level.ERROR);
         out.println("*** Connecting to " + url);
         try (BufferedReader in = new BufferedReader(new 
InputStreamReader(url.openStream()))) {
-          for(String line; (line = in.readLine()) != null; out.println(line));
+          in.lines().filter(Objects::nonNull).forEach(out::println);
         }
         log.debug("log.debug2");
         log.info("log.info2");
         log.error("log.error2");
-        assertTrue(Level.ERROR.equals(log.getEffectiveLevel()));
+        assertEquals(Level.ERROR, log.getEffectiveLevel());
 
         //command line
         String[] args = {"-setlevel", authority, logName, 
Level.DEBUG.toString()};
@@ -89,14 +90,13 @@ public class TestLogLevel {
         log.debug("log.debug3");
         log.info("log.info3");
         log.error("log.error3");
-        assertTrue(Level.DEBUG.equals(log.getEffectiveLevel()));
+        assertEquals(Level.DEBUG, log.getEffectiveLevel());
       } finally {
         if (server != null) {
           server.stop();
         }
       }
-    }
-    else {
+    } else {
       out.println(testlog.getClass() + " not tested.");
     }
   }
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/resource/JerseyResource.java
 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/resource/JerseyResource.java
index 31ff0ed..593b1c2 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/resource/JerseyResource.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/resource/JerseyResource.java
@@ -52,7 +52,7 @@ public class JerseyResource {
   public Response get(
       @PathParam(PATH) @DefaultValue("UNKNOWN_" + PATH) final String path,
       @QueryParam(OP) @DefaultValue("UNKNOWN_" + OP) final String op
-      ) throws IOException {
+  ) throws IOException {
     LOG.info("get: " + PATH + "=" + path + ", " + OP + "=" + op);
 
     final Map<String, Object> m = new TreeMap<>();
diff --git 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/ssl/KeyStoreTestUtil.java
 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/ssl/KeyStoreTestUtil.java
index 35d6236..aa8c244 100644
--- 
a/hbase-http/src/test/java/org/apache/hadoop/hbase/http/ssl/KeyStoreTestUtil.java
+++ 
b/hbase-http/src/test/java/org/apache/hadoop/hbase/http/ssl/KeyStoreTestUtil.java
@@ -49,7 +49,9 @@ import 
org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory;
 import org.apache.hadoop.security.ssl.SSLFactory;
 import org.bouncycastle.x509.X509V1CertificateGenerator;
 
-public class KeyStoreTestUtil {
+public final class KeyStoreTestUtil {
+  private KeyStoreTestUtil() {
+  }
 
   public static String getClasspathDir(Class<?> klass) throws Exception {
     String file = klass.getName();
@@ -69,11 +71,12 @@ public class KeyStoreTestUtil {
    * @param algorithm the signing algorithm, eg "SHA1withRSA"
    * @return the self-signed certificate
    */
-  public static X509Certificate generateCertificate(String dn, KeyPair pair, 
int days, String algorithm)
-      throws CertificateEncodingException, InvalidKeyException, 
IllegalStateException,
-      NoSuchProviderException, NoSuchAlgorithmException, SignatureException {
+  public static X509Certificate generateCertificate(String dn, KeyPair pair, 
int days,
+      String algorithm) throws CertificateEncodingException, 
InvalidKeyException,
+          IllegalStateException, NoSuchProviderException, 
NoSuchAlgorithmException,
+          SignatureException {
     Date from = new Date();
-    Date to = new Date(from.getTime() + days * 86400000l);
+    Date to = new Date(from.getTime() + days * 86400000L);
     BigInteger sn = new BigInteger(64, new SecureRandom());
     KeyPair keyPair = pair;
     X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();

Reply via email to