knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [3/3] knox git commit: KNOX-1615 - Enable PMD for source analysis
Date Mon, 10 Dec 2018 18:20:22 GMT
KNOX-1615 - Enable PMD for source analysis

Signed-off-by: Kevin Risden <krisden@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/6a35473a
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/6a35473a
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/6a35473a

Branch: refs/heads/master
Commit: 6a35473a9ccf411e32a8681b9005a032d6473afa
Parents: f54e9d2
Author: Kevin Risden <krisden@apache.org>
Authored: Mon Dec 10 11:52:52 2018 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Mon Dec 10 11:56:40 2018 -0500

----------------------------------------------------------------------
 .../resources/build-tools/pmd/pmd-ruleset.xml   | 44 ++++++++++++++
 .../discovery/ambari/AmbariCluster.java         |  9 +--
 .../ambari/AmbariConfigurationMonitor.java      | 14 ++---
 .../ambari/AmbariDynamicServiceURLCreator.java  |  6 +-
 .../ambari/AmbariServiceDiscovery.java          |  7 ++-
 .../discovery/ambari/HDFSURLCreatorBase.java    |  2 +-
 .../discovery/ambari/NameNodeUrlCreator.java    |  2 +-
 .../discovery/ambari/NiFiURLCreator.java        |  2 +-
 .../ambari/ResourceManagerURLCreatorBase.java   |  2 +-
 .../ambari/ServiceURLPropertyConfig.java        |  4 +-
 .../ambari/SparkCommonServiceURLCreator.java    |  8 +--
 .../ambari/AmbariConfigurationMonitorTest.java  |  2 +-
 .../i18n/resources/ResourcesInvoker.java        | 10 +--
 .../provider/impl/AtlasZookeeperURLManager.java |  6 --
 .../provider/impl/KafkaZookeeperURLManager.java |  8 +--
 ...entityAsserterHttpServletRequestWrapper.java |  4 +-
 .../CommonIdentityAssertionFilterTest.java      |  6 +-
 .../filter/ConcatIdentityAssertionFilter.java   |  4 +-
 .../filter/RegexIdentityAssertionFilter.java    |  4 +-
 .../hostmap/impl/HostmapFunctionProcessor.java  |  2 +-
 .../ServiceMappedAddressFunctionProcessor.java  |  2 +-
 .../SecureQueryDecryptProcessor.java            |  2 +-
 .../filter/rewrite/impl/UrlRewriteRequest.java  | 12 ++--
 .../filter/rewrite/impl/UrlRewriteResponse.java |  3 +-
 .../rewrite/impl/html/HtmlFilterReaderBase.java |  2 +-
 .../impl/html/HtmlImportFunctionProcessor.java  |  3 +-
 .../gateway/filter/AclsAuthorizationFilter.java |  4 +-
 .../gateway/filter/AclsAuthzFilterTest.java     |  4 +-
 .../jwt/filter/AbstractJWTFilter.java           |  2 +-
 .../filter/JWTAccessTokenAssertionFilter.java   |  2 +-
 .../jwt/filter/JWTAuthCodeAssertionFilter.java  |  2 +-
 .../jwt/filter/SSOCookieFederationFilter.java   |  4 +-
 .../federation/AbstractJWTFilterTest.java       | 12 ++--
 .../pac4j/filter/Pac4jDispatcherFilter.java     |  6 +-
 .../gateway/pac4j/MockHttpServletResponse.java  |  2 +-
 .../filter/AbstractPreAuthFederationFilter.java |  2 +-
 .../filter/HeaderPreAuthFederationFilter.java   |  2 +-
 .../preauth/filter/PreAuthFederationFilter.java |  2 +-
 .../knox/gateway/deploy/impl/ShiroConfig.java   |  4 +-
 .../gateway/filter/RedirectToUrlFilter.java     |  2 +-
 .../knox/gateway/shirorealm/KnoxLdapRealm.java  |  2 +-
 .../webappsec/filter/CSRFPreventionFilter.java  |  2 +-
 .../webappsec/StrictTransportFilterTest.java    |  8 +--
 .../XContentTypeOptionsFilterTest.java          |  6 +-
 .../webappsec/XFrameOptionsFilterTest.java      |  8 +--
 .../webappsec/XSSProtectionFilterTest.java      |  6 +-
 .../gateway/filter/CompositeEnumeration.java    |  2 +-
 .../org/apache/knox/gateway/GatewayFilter.java  |  5 +-
 .../knox/gateway/GatewayForwardingServlet.java  |  2 +-
 .../org/apache/knox/gateway/GatewayServer.java  |  4 +-
 .../knox/gateway/deploy/DeploymentFactory.java  |  2 +-
 .../impl/ApplicationDeploymentContributor.java  | 12 ++--
 .../gateway/dispatch/UrlConnectionDispatch.java |  6 +-
 .../filter/PortMappingHelperHandler.java        |  2 +-
 .../gateway/services/CLIGatewayServices.java    |  4 +-
 .../services/DefaultGatewayServices.java        |  4 +-
 .../impl/instr/InstrumentedGatewayFilter.java   |  6 +-
 .../impl/reporters/AbstractMetricsReporter.java |  2 +-
 .../security/impl/DefaultCryptoService.java     |  6 +-
 .../security/impl/DefaultKeystoreService.java   |  8 +--
 .../services/security/impl/JettySSLService.java | 11 ++--
 .../impl/DefaultTokenAuthorityService.java      |  6 +-
 ...faultClusterConfigurationMonitorService.java |  2 +-
 .../topology/impl/DefaultTopologyService.java   |  2 +-
 .../DefaultServiceDiscoveryConfig.java          |  4 +-
 .../DefaultRemoteConfigurationMonitor.java      |  2 +-
 .../RemoteConfigurationMonitorFactory.java      |  2 +-
 .../simple/ProviderConfigurationParser.java     |  8 +--
 .../simple/SimpleDescriptorHandler.java         |  4 +-
 .../topology/simple/SimpleDescriptorImpl.java   |  2 +-
 .../topology/validation/TopologyValidator.java  |  7 +--
 .../knox/gateway/trace/AccessHandler.java       | 34 +++++------
 .../apache/knox/gateway/trace/TraceRequest.java | 16 +++--
 .../knox/gateway/trace/TraceResponse.java       |  4 +-
 .../apache/knox/gateway/trace/TraceUtil.java    |  4 +-
 .../org/apache/knox/gateway/util/KnoxCLI.java   | 36 +++++------
 .../gateway/util/ServiceDefinitionsLoader.java  |  6 +-
 .../websockets/GatewayWebsocketHandler.java     |  4 +-
 .../knox/gateway/jetty/SslSocketTest.java       |  2 +-
 .../services/security/CryptoServiceTest.java    |  4 +-
 .../simple/ProviderConfigurationParserTest.java |  2 +-
 .../websockets/ProxyInboundClientTest.java      |  4 +-
 .../gateway/websockets/WebsocketClient.java     |  8 +--
 .../service/admin/TopologiesResource.java       | 35 +++++------
 .../service/definition/CustomDispatch.java      |  2 +-
 .../apache/knox/gateway/hive/HiveDispatch.java  |  2 +-
 .../knox/gateway/hive/HiveHaDispatch.java       |  2 +-
 .../gateway/service/knoxsso/WebSSOResource.java | 18 +++---
 .../service/knoxsso/WebSSOutResource.java       |  2 +-
 .../service/knoxtoken/TokenResource.java        |  6 +-
 .../config/remote/zk/CuratorClientService.java  |  2 +-
 .../gateway/rm/dispatch/RMHaBaseDispatcher.java |  4 +-
 .../service/test/ServiceTestResource.java       | 64 +++++++-------------
 .../knox/gateway/shell/BasicResponse.java       |  2 +-
 .../knox/gateway/shell/ErrorResponse.java       |  2 +-
 .../apache/knox/gateway/shell/KnoxSession.java  |  6 +-
 .../org/apache/knox/gateway/shell/KnoxSh.java   | 14 +++--
 .../shell/KnoxTokenCredentialCollector.java     |  4 +-
 .../shell/hbase/table/row/DeleteRows.java       |  2 +-
 .../shell/hbase/table/row/QueryRows.java        |  8 +--
 .../apache/knox/gateway/shell/hdfs/Mkdir.java   |  4 +-
 .../org/apache/knox/gateway/shell/hdfs/Put.java |  2 +-
 .../gateway/dispatch/GatewayDispatchFilter.java |  2 +-
 .../gateway/dispatch/HadoopAuthCookieStore.java |  7 +--
 .../principal/SimplePrincipalMapper.java        |  4 +-
 .../security/impl/BaseKeystoreService.java      | 18 +++---
 .../security/impl/CMFMasterService.java         |  2 +-
 .../security/impl/X509CertificateUtil.java      |  7 ++-
 .../apache/knox/gateway/topology/Service.java   |  2 +-
 .../apache/knox/gateway/topology/Topology.java  |  4 +-
 .../dispatch/GatewayDispatchFilterTest.java     |  2 +-
 .../security/impl/CMFMasterServiceTest.java     |  2 +-
 .../apache/knox/gateway/GatewayTestConfig.java  | 16 ++---
 .../apache/knox/gateway/GatewayTestDriver.java  |  9 +--
 .../knox/test/mock/MockRequestMatcher.java      | 24 ++++----
 .../knox/test/mock/MockResponseProvider.java    | 20 +++---
 .../gateway/audit/api/AuditServiceFactory.java  |  2 +-
 .../audit/api/CorrelationServiceFactory.java    |  2 +-
 .../gateway/audit/log4j/appender/JdbmQueue.java |  4 +-
 .../gateway/audit/log4j/audit/Log4jAuditor.java |  2 +-
 .../org/apache/knox/gateway/util/JsonPath.java  |  6 +-
 .../knox/gateway/util/X500PrincipalParser.java  |  4 +-
 .../org/apache/knox/gateway/util/XmlUtils.java  |  6 +-
 .../gateway/util/IpAddressValidatorTest.java    |  2 +-
 .../config/ConfigurationInjectorBuilder.java    |  8 +--
 .../impl/ConfigurationAdapterFactory.java       |  2 +-
 .../knox/gateway/config/AdapterSampleTest.java  |  2 +-
 .../apache/knox/gateway/config/FuncTest.java    |  2 +-
 .../apache/knox/gateway/launcher/Launcher.java  |  4 +-
 .../knox/gateway/util/urltemplate/Expander.java | 36 +++++------
 .../knox/gateway/util/urltemplate/Function.java |  6 +-
 .../knox/gateway/util/urltemplate/Segment.java  |  6 +-
 .../knox/gateway/util/urltemplate/Template.java | 12 ++--
 pom.xml                                         | 36 +++++++++++
 134 files changed, 488 insertions(+), 445 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml b/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
new file mode 100644
index 0000000..83896f7
--- /dev/null
+++ b/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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 regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         name="Maven PMD Plugin Ruleset"
+         xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
+    <description>Ruleset</description>
+    <!--<rule ref="category/java/bestpractices.xml">-->
+        <!--<exclude name="ConstantsInInterface" />-->
+    <!--</rule>-->
+    <!--<rule ref="category/java/codestyle.xml" />-->
+    <!--<rule ref="category/java/design.xml" />-->
+    <!--<rule ref="category/java/documentation.xml" />-->
+    <!--<rule ref="category/java/errorprone.xml">-->
+        <!--<exclude name="AvoidFieldNameMatchingMethodName" />-->
+        <!--<exclude name="BeanMembersShouldSerialize" />-->
+        <!--<exclude name="DataflowAnomalyAnalysis" />-->
+        <!--<exclude name="EmptyCatchBlock" />-->
+    <!--</rule>-->
+    <!--<rule ref="category/java/multithreading.xml" />-->
+    <rule ref="category/java/performance.xml">
+        <exclude name="AvoidInstantiatingObjectsInLoops" />
+        <exclude name="InefficientEmptyStringCheck" />
+        <exclude name="SimplifyStartsWith" />
+        <exclude name="TooFewBranchesForASwitchStatement" />
+        <exclude name="UseStringBufferForStringAppends" />
+    </rule>
+    <rule ref="category/java/security.xml" />
+</ruleset>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
index f098b75..be47d63 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
@@ -20,8 +20,9 @@ import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.topology.discovery.ServiceDiscovery;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -69,7 +70,7 @@ class AmbariCluster implements ServiceDiscovery.Cluster {
 
             if (overridesPath != null) {
                 Properties overrides = new Properties();
-                try (InputStream in = new FileInputStream(overridesPath)) {
+                try (InputStream in = Files.newInputStream(Paths.get(overridesPath))) {
                     overrides.load(in);
                     for (String name : overrides.stringPropertyNames()) {
                         zooKeeperHAConfigMappings.setProperty(name, overrides.getProperty(name));
@@ -260,9 +261,9 @@ class AmbariCluster implements ServiceDiscovery.Cluster {
                 if (portIndex > 0) {
                     host = host.substring(0, portIndex);
                 }
-                updatedEnsemble.append(host).append(":").append(port);
+                updatedEnsemble.append(host).append(':').append(port);
                 if (++index < hosts.length) {
-                    updatedEnsemble.append(",");
+                    updatedEnsemble.append(',');
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitor.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitor.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitor.java
index 141df87..3f1b035 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitor.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitor.java
@@ -24,9 +24,10 @@ import org.apache.knox.gateway.topology.discovery.ClusterConfigurationMonitor;
 import org.apache.knox.gateway.topology.discovery.ServiceDiscoveryConfig;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -37,7 +38,6 @@ import java.util.Properties;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-
 class AmbariConfigurationMonitor implements ClusterConfigurationMonitor {
 
     private static final String TYPE = "Ambari";
@@ -116,7 +116,7 @@ class AmbariConfigurationMonitor implements ClusterConfigurationMonitor {
             Collection<File> persistedConfigs = FileUtils.listFiles(persistenceDir, new String[]{"conf"}, false);
             for (File persisted : persistedConfigs) {
                 Properties props = new Properties();
-                try (FileInputStream in = new FileInputStream(persisted)) {
+                try (InputStream in = Files.newInputStream(persisted.toPath())) {
                     props.load(in);
 
                     addDiscoveryConfig(props.getProperty(PROP_CLUSTER_NAME), new ServiceDiscoveryConfig() {
@@ -152,7 +152,7 @@ class AmbariConfigurationMonitor implements ClusterConfigurationMonitor {
             Collection<File> persistedConfigs = FileUtils.listFiles(persistenceDir, new String[]{"ver"}, false);
             for (File persisted : persistedConfigs) {
                 Properties props = new Properties();
-                try (FileInputStream in = new FileInputStream(persisted)) {
+                try (InputStream in = Files.newInputStream(persisted.toPath())) {
                     props.load(in);
 
                     String source = props.getProperty(PROP_CLUSTER_SOURCE);
@@ -210,7 +210,7 @@ class AmbariConfigurationMonitor implements ClusterConfigurationMonitor {
     }
 
     private void persist(Properties props, File dest) {
-        try (FileOutputStream out = new FileOutputStream(dest)) {
+        try (OutputStream out = Files.newOutputStream(dest.toPath())) {
             props.store(out, PERSISTED_FILE_COMMENT);
             out.flush();
         } catch (Exception e) {
@@ -472,7 +472,7 @@ class AmbariConfigurationMonitor implements ClusterConfigurationMonitor {
 
         private AmbariConfigurationMonitor delegate;
 
-        private boolean isActive = false;
+        private boolean isActive;
 
         PollingConfigAnalyzer(AmbariConfigurationMonitor delegate) {
             this.delegate = delegate;

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreator.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreator.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreator.java
index b81a53a..1ad1830 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreator.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariDynamicServiceURLCreator.java
@@ -21,10 +21,10 @@ import org.apache.knox.gateway.topology.discovery.ServiceDiscovery;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -39,7 +39,7 @@ class AmbariDynamicServiceURLCreator implements ServiceURLCreator {
 
     private AmbariServiceDiscoveryMessages log = MessagesFactory.get(AmbariServiceDiscoveryMessages.class);
 
-    private AmbariCluster cluster = null;
+    private AmbariCluster cluster;
     private ServiceURLPropertyConfig config;
 
     AmbariDynamicServiceURLCreator() {
@@ -52,7 +52,7 @@ class AmbariDynamicServiceURLCreator implements ServiceURLCreator {
 
     AmbariDynamicServiceURLCreator(AmbariCluster cluster, File mappingConfiguration) throws IOException {
         this.cluster = cluster;
-        try (InputStream inputStream = new FileInputStream(mappingConfiguration)) {
+        try (InputStream inputStream = Files.newInputStream(mappingConfiguration.toPath())) {
           config = new ServiceURLPropertyConfig(inputStream);
         }
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
index a1ceba2..b95fe81 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscovery.java
@@ -29,9 +29,10 @@ import org.apache.knox.gateway.topology.discovery.ServiceDiscovery;
 import org.apache.knox.gateway.topology.discovery.ServiceDiscoveryConfig;
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.InputStream;
 import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -78,7 +79,7 @@ class AmbariServiceDiscovery implements ServiceDiscovery {
     // This is used to update the monitor when new cluster configuration details are discovered.
     private AmbariConfigurationMonitor configChangeMonitor;
 
-    private boolean isInitialized = false;
+    private boolean isInitialized;
 
     //
     static void initializeComponentConfigMappings(){
@@ -111,7 +112,7 @@ class AmbariServiceDiscovery implements ServiceDiscovery {
             // If there is an overrides configuration file specified either way, then apply it
             if (overridesPath != null) {
                 Properties overrides = new Properties();
-                try (InputStream in = new FileInputStream(overridesPath)) {
+                try (InputStream in = Files.newInputStream(Paths.get(overridesPath))) {
                     overrides.load(in);
                     for (String name : overrides.stringPropertyNames()) {
                         componentServiceConfigs.put(name, overrides.getProperty(name));

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/HDFSURLCreatorBase.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/HDFSURLCreatorBase.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/HDFSURLCreatorBase.java
index 6145632..c6f7bb0 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/HDFSURLCreatorBase.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/HDFSURLCreatorBase.java
@@ -44,7 +44,7 @@ public abstract class HDFSURLCreatorBase implements ServiceURLCreator {
 
   protected AmbariServiceDiscoveryMessages log = MessagesFactory.get(AmbariServiceDiscoveryMessages.class);
 
-  private AmbariCluster cluster = null;
+  private AmbariCluster cluster;
 
 
   @Override

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NameNodeUrlCreator.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NameNodeUrlCreator.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NameNodeUrlCreator.java
index 17a7517..7d39204 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NameNodeUrlCreator.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NameNodeUrlCreator.java
@@ -31,7 +31,7 @@ public class NameNodeUrlCreator implements ServiceURLCreator {
 
   private AmbariServiceDiscoveryMessages log = MessagesFactory.get(AmbariServiceDiscoveryMessages.class);
 
-  private AmbariCluster cluster = null;
+  private AmbariCluster cluster;
 
   @Override
   public void init(AmbariCluster cluster) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NiFiURLCreator.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NiFiURLCreator.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NiFiURLCreator.java
index ffe2922..a2d0dae 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NiFiURLCreator.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/NiFiURLCreator.java
@@ -36,7 +36,7 @@ public class NiFiURLCreator implements ServiceURLCreator {
   static final String SSL_PORT_PROPERTY = "nifi.node.ssl.port";
 
 
-  private AmbariCluster cluster = null;
+  private AmbariCluster cluster;
 
   @Override
   public String getTargetService() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ResourceManagerURLCreatorBase.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ResourceManagerURLCreatorBase.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ResourceManagerURLCreatorBase.java
index 7081b30..a504d8a 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ResourceManagerURLCreatorBase.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ResourceManagerURLCreatorBase.java
@@ -35,7 +35,7 @@ public abstract class ResourceManagerURLCreatorBase implements ServiceURLCreator
 
   protected AmbariServiceDiscoveryMessages log = MessagesFactory.get(AmbariServiceDiscoveryMessages.class);
 
-  private AmbariCluster cluster = null;
+  private AmbariCluster cluster;
 
 
   @Override

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ServiceURLPropertyConfig.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ServiceURLPropertyConfig.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ServiceURLPropertyConfig.java
index 25eedc6..ae2db81 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ServiceURLPropertyConfig.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/ServiceURLPropertyConfig.java
@@ -30,9 +30,9 @@ import javax.xml.xpath.XPathExpression;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -87,7 +87,7 @@ class ServiceURLPropertyConfig {
      * The default service URL pattern to property mapping configuration will be used.
      */
     ServiceURLPropertyConfig(File mappingConfigurationFile) throws Exception {
-        this(new FileInputStream(mappingConfigurationFile));
+        this(Files.newInputStream(mappingConfigurationFile.toPath()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkCommonServiceURLCreator.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkCommonServiceURLCreator.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkCommonServiceURLCreator.java
index 6ff1614..ab49b45 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkCommonServiceURLCreator.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkCommonServiceURLCreator.java
@@ -28,13 +28,13 @@ public abstract class SparkCommonServiceURLCreator implements ServiceURLCreator
 
   private static final String URL_TEMPLATE = "%s://%s:%s";
 
-  protected AmbariCluster cluster = null;
+  protected AmbariCluster cluster;
 
-  String primaryComponentName = null;
+  String primaryComponentName;
 
-  String secondaryComponentName = null;
+  String secondaryComponentName;
 
-  String portConfigProperty = null;
+  String portConfigProperty;
 
   @Override
   public void init(AmbariCluster cluster) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitorTest.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitorTest.java b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitorTest.java
index fcdbcad..ee01e64 100644
--- a/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitorTest.java
+++ b/gateway-discovery-ambari/src/test/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariConfigurationMonitorTest.java
@@ -40,7 +40,7 @@ import static org.junit.Assert.assertTrue;
 
 public class AmbariConfigurationMonitorTest {
 
-    private File dataDir = null;
+    private File dataDir;
 
     @Before
     public void setup() throws Exception {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
----------------------------------------------------------------------
diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
index 77bf113..02000c0 100644
--- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
+++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
@@ -108,14 +108,14 @@ public class ResourcesInvoker implements InvocationHandler {
 
   private static String createDefaultPatternSuffix( final int size ) {
     StringBuilder builder = new StringBuilder( 1 + size*7 );
-    builder.append( "(" );
+    builder.append('(');
     for( int i=0; i<size; i++ ) {
-      if( i>0 ) {
-        builder.append( "," );
+      if(i > 0) {
+        builder.append(',');
       }
-      builder.append( "\"{" ).append( i ).append( "}\"" );
+      builder.append("\"{").append(i).append("}\"");
     }
-    builder.append( ")" );
+    builder.append(')');
     return builder.toString();
 
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
index 8bca9e4..47a8641 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/AtlasZookeeperURLManager.java
@@ -32,16 +32,13 @@ import java.util.concurrent.TimeUnit;
 
 public class AtlasZookeeperURLManager extends DefaultURLManager {
     private static final String DEFAULT_ZOOKEEPER_NAMESPACE = "/apache_atlas";
-
     private static final String APACHE_ATLAS_ACTIVE_SERVER_INFO = "/active_server_info";
 
     private static final HaMessages LOG = MessagesFactory.get(HaMessages.class);
 
     private String zooKeeperEnsemble;
-
     private String zooKeeperNamespace;
 
-
     @Override
     public boolean supportsConfig(HaServiceConfig config) {
         if (!( config.getServiceName().equalsIgnoreCase("ATLAS") || config.getServiceName().equalsIgnoreCase("ATLAS-API"))) {
@@ -66,7 +63,6 @@ public class AtlasZookeeperURLManager extends DefaultURLManager {
     }
 
     public List<String> lookupURLs() {
-
         List<String> serverHosts = new ArrayList<>();
         try (CuratorFramework zooKeeperClient = CuratorFrameworkFactory.builder()
             .connectString(zooKeeperEnsemble)
@@ -88,8 +84,6 @@ public class AtlasZookeeperURLManager extends DefaultURLManager {
         return serverHosts;
     }
 
-
-
     @Override
     public synchronized void markFailed(String url) {
         setURLs(lookupURLs());

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
index a94834b..debbebe 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/KafkaZookeeperURLManager.java
@@ -133,15 +133,11 @@ public class KafkaZookeeperURLManager extends BaseZookeeperURLManager {
 
     StringBuilder buffer = new StringBuilder();
 
-    buffer.append(scheme);
-    buffer.append("://");
+    buffer.append(scheme).append("://");
 
     JSONParser parser = new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE);
     JSONObject obj = (JSONObject) parser.parse(serverInfo);
-    buffer.append(obj.get("host"));
-
-    buffer.append(":");
-    buffer.append(PORT_NUMBER);
+    buffer.append(obj.get("host")).append(':').append(PORT_NUMBER);
 
     return buffer.toString();
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
index 71251ca..1c8b478 100644
--- a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
+++ b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/IdentityAsserterHttpServletRequestWrapper.java
@@ -266,12 +266,12 @@ private static SpiGatewayMessages log = MessagesFactory.get( SpiGatewayMessages.
         } else {
           for (String value : values) {
             if (sb.length() > 0) {
-              sb.append("&");
+              sb.append('&');
             }
             try {
               sb.append(urlEncode(name, encoding));
               if (value != null) {
-                sb.append("=");
+                sb.append('=');
                 sb.append(urlEncode(value, encoding));
               }
             } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/CommonIdentityAssertionFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/CommonIdentityAssertionFilterTest.java b/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/CommonIdentityAssertionFilterTest.java
index 25800f5..ccc7936 100644
--- a/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/CommonIdentityAssertionFilterTest.java
+++ b/gateway-provider-identity-assertion-common/src/test/java/org/apache/knox/gateway/identityasserter/filter/CommonIdentityAssertionFilterTest.java
@@ -48,9 +48,9 @@ import static org.junit.Assert.assertTrue;
  */
 public class CommonIdentityAssertionFilterTest {
 
-  private String username = null;
-  private String[] mappedGroups = null;
-  private Filter filter = null;
+  private String username;
+  private String[] mappedGroups;
+  private Filter filter;
 
   @Before
   public void setup() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-identity-assertion-concat/src/main/java/org/apache/knox/gateway/identityasserter/concat/filter/ConcatIdentityAssertionFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-concat/src/main/java/org/apache/knox/gateway/identityasserter/concat/filter/ConcatIdentityAssertionFilter.java b/gateway-provider-identity-assertion-concat/src/main/java/org/apache/knox/gateway/identityasserter/concat/filter/ConcatIdentityAssertionFilter.java
index 7d72c97..655fec7 100644
--- a/gateway-provider-identity-assertion-concat/src/main/java/org/apache/knox/gateway/identityasserter/concat/filter/ConcatIdentityAssertionFilter.java
+++ b/gateway-provider-identity-assertion-concat/src/main/java/org/apache/knox/gateway/identityasserter/concat/filter/ConcatIdentityAssertionFilter.java
@@ -23,8 +23,8 @@ import javax.servlet.ServletException;
 import org.apache.knox.gateway.identityasserter.common.filter.CommonIdentityAssertionFilter;
 
 public class ConcatIdentityAssertionFilter extends CommonIdentityAssertionFilter {
-  private String prefix = null;
-  private String suffix = null;
+  private String prefix;
+  private String suffix;
 
   @Override
   public void init(FilterConfig filterConfig) throws ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-identity-assertion-regex/src/main/java/org/apache/knox/gateway/identityasserter/regex/filter/RegexIdentityAssertionFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-regex/src/main/java/org/apache/knox/gateway/identityasserter/regex/filter/RegexIdentityAssertionFilter.java b/gateway-provider-identity-assertion-regex/src/main/java/org/apache/knox/gateway/identityasserter/regex/filter/RegexIdentityAssertionFilter.java
index cb8c222..3ddc41a 100644
--- a/gateway-provider-identity-assertion-regex/src/main/java/org/apache/knox/gateway/identityasserter/regex/filter/RegexIdentityAssertionFilter.java
+++ b/gateway-provider-identity-assertion-regex/src/main/java/org/apache/knox/gateway/identityasserter/regex/filter/RegexIdentityAssertionFilter.java
@@ -31,8 +31,8 @@ import java.util.TreeMap;
 public class RegexIdentityAssertionFilter extends
     CommonIdentityAssertionFilter {
 
-  private String input = null;
-  private String output = null;
+  private String input;
+  private String output;
   private Map<String,String> dict;
   RegexTemplate template;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite-func-hostmap-static/src/main/java/org/apache/knox/gateway/hostmap/impl/HostmapFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-hostmap-static/src/main/java/org/apache/knox/gateway/hostmap/impl/HostmapFunctionProcessor.java b/gateway-provider-rewrite-func-hostmap-static/src/main/java/org/apache/knox/gateway/hostmap/impl/HostmapFunctionProcessor.java
index fe97b57..885eecc 100644
--- a/gateway-provider-rewrite-func-hostmap-static/src/main/java/org/apache/knox/gateway/hostmap/impl/HostmapFunctionProcessor.java
+++ b/gateway-provider-rewrite-func-hostmap-static/src/main/java/org/apache/knox/gateway/hostmap/impl/HostmapFunctionProcessor.java
@@ -37,7 +37,7 @@ public class HostmapFunctionProcessor
   public static final String DESCRIPTOR_DEFAULT_LOCATION = "/WEB-INF/" + DESCRIPTOR_DEFAULT_FILE_NAME;
 
   private HostMapperService hostMapperService;
-  private HostMapper hostMapper = null;
+  private HostMapper hostMapper;
   private String clusterName;
 
   @Override

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceMappedAddressFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceMappedAddressFunctionProcessor.java b/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceMappedAddressFunctionProcessor.java
index e798301..7dcf063 100644
--- a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceMappedAddressFunctionProcessor.java
+++ b/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceMappedAddressFunctionProcessor.java
@@ -37,7 +37,7 @@ public class ServiceMappedAddressFunctionProcessor
     extends ServiceRegistryFunctionProcessorBase<ServiceMappedAddressFunctionDescriptor>
     implements UrlRewriteFunctionProcessor<ServiceMappedAddressFunctionDescriptor> {
 
-  private HostMapper hostmap = null;
+  private HostMapper hostmap;
 
   @Override
   public String name() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
index df9e33e..ccd82c4 100644
--- a/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
+++ b/gateway-provider-rewrite-step-secure-query/src/main/java/org/apache/knox/gateway/securequery/SecureQueryDecryptProcessor.java
@@ -41,7 +41,7 @@ public class SecureQueryDecryptProcessor implements
   private static SecureQueryMessages log = MessagesFactory.get( SecureQueryMessages.class );
   private static final String ENCRYPTED_PARAMETER_NAME = "_";
 
-  private ConfigurableEncryptor encryptor = null;
+  private ConfigurableEncryptor encryptor;
 
   @Override
   public String getType() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
index a369830..a2ad19f 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteRequest.java
@@ -92,17 +92,13 @@ public class UrlRewriteRequest extends GatewayRequestWrapper implements Resolver
     //KNOX-439[
     //StringBuffer urlString = super.getRequestURL();
     StringBuilder urlString = new StringBuilder( 128 );
-    urlString.append( getScheme() );
-    urlString.append( "://" );
-    urlString.append( getServerName() );
-    urlString.append( ":" );
-    urlString.append( getServerPort() );
-    urlString.append( super.getRequestURI() );
+    urlString.append(getScheme()).append("://")
+        .append(getServerName()).append(':').append(getServerPort())
+        .append(super.getRequestURI());
     //]
     String queryString = super.getQueryString();
     if( queryString != null ) {
-      urlString.append( '?' );
-      urlString.append( queryString );
+      urlString.append( '?' ).append( queryString );
     }
     try {
       urlTemplate = Parser.parseLiteral( urlString.toString() );

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
index 783e9d5..1efcb40 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteResponse.java
@@ -18,6 +18,7 @@
 package org.apache.knox.gateway.filter.rewrite.impl;
 
 import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.knox.gateway.filter.GatewayResponseWrapper;
 import org.apache.knox.gateway.filter.ResponseStreamer;
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterContentDescriptor;
@@ -153,7 +154,7 @@ public class UrlRewriteResponse extends GatewayResponseWrapper implements Params
         getRewriteFilterConfig(rewriter.getConfig(), bodyFilterName, mimeType);
     if (filterContentConfig != null) {
       String asType = filterContentConfig.asType();
-      if ( asType != null && !asType.trim().isEmpty()) {
+      if ( asType != null && !StringUtils.isBlank(asType)) {
         mimeType = MimeTypes.create(asType, getCharacterEncoding());
       }
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java
index c2b4264..60005fe 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlFilterReaderBase.java
@@ -65,7 +65,7 @@ public abstract class HtmlFilterReaderBase extends Reader implements
   private int offset;
   private StringWriter writer;
   private StringBuffer buffer;
-  private UrlRewriteFilterContentDescriptor config = null;
+  private UrlRewriteFilterContentDescriptor config;
 
   protected HtmlFilterReaderBase( Reader reader ) throws IOException, ParserConfigurationException {
     this.reader = reader;

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
index 5687a40f..f3e7bb1 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
@@ -80,8 +80,7 @@ public class HtmlImportFunctionProcessor implements UrlRewriteFunctionProcessor<
     }
     List<String> frontendValues = frontend.resolve(context, parameters);
     StringBuilder buffer = new StringBuilder(IMPORT_LITERAL);
-    buffer.append(" ");
-    buffer.append(prefix);
+    buffer.append(' ').append(prefix);
     if ( frontendValues != null && !frontendValues.isEmpty() ) {
       for ( String value : frontendValues ) {
         buffer.append(value);

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclsAuthorizationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclsAuthorizationFilter.java b/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclsAuthorizationFilter.java
index 29dc38b..d0d1629 100644
--- a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclsAuthorizationFilter.java
+++ b/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclsAuthorizationFilter.java
@@ -50,8 +50,8 @@ public class AclsAuthorizationFilter implements Filter {
   private static Auditor auditor = AuditServiceFactory.getAuditService().getAuditor( AuditConstants.DEFAULT_AUDITOR_NAME,
           AuditConstants.KNOX_SERVICE_NAME, AuditConstants.KNOX_COMPONENT_NAME );
 
-  private String resourceRole = null;
-  private String aclProcessingMode = null;
+  private String resourceRole;
+  private String aclProcessingMode;
   private AclParser parser = new AclParser();
   private ArrayList<String> adminGroups = new ArrayList<>();
   private ArrayList<String> adminUsers = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-authz-acls/src/test/java/org/apache/knox/gateway/filter/AclsAuthzFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authz-acls/src/test/java/org/apache/knox/gateway/filter/AclsAuthzFilterTest.java b/gateway-provider-security-authz-acls/src/test/java/org/apache/knox/gateway/filter/AclsAuthzFilterTest.java
index 4d1258a..43c9bec 100644
--- a/gateway-provider-security-authz-acls/src/test/java/org/apache/knox/gateway/filter/AclsAuthzFilterTest.java
+++ b/gateway-provider-security-authz-acls/src/test/java/org/apache/knox/gateway/filter/AclsAuthzFilterTest.java
@@ -42,8 +42,8 @@ import org.junit.Before;
 import org.junit.Test;
 
 public class AclsAuthzFilterTest {
-  private boolean accessGranted = false;
-  private Filter filter = null;
+  private boolean accessGranted;
+  private Filter filter;
 
   @Before
   public void setup() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
index 2ad4c1b..418e38e 100644
--- a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
+++ b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/AbstractJWTFilter.java
@@ -83,7 +83,7 @@ public abstract class AbstractJWTFilter implements Filter {
 
   protected List<String> audiences;
   protected JWTokenAuthority authority;
-  protected RSAPublicKey publicKey = null;
+  protected RSAPublicKey publicKey;
   private String expectedIssuer;
   private String expectedSigAlg;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAccessTokenAssertionFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAccessTokenAssertionFilter.java b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAccessTokenAssertionFilter.java
index c4de8ab..ac14794 100644
--- a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAccessTokenAssertionFilter.java
+++ b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAccessTokenAssertionFilter.java
@@ -51,7 +51,7 @@ public class JWTAccessTokenAssertionFilter extends AbstractIdentityAssertionFilt
   private static final String BEARER = "Bearer ";
   private static JWTMessages log = MessagesFactory.get( JWTMessages.class );
   private long validity;
-  private JWTokenAuthority authority = null;
+  private JWTokenAuthority authority;
   private ServiceRegistry sr;
 
   @Override

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAuthCodeAssertionFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAuthCodeAssertionFilter.java b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAuthCodeAssertionFilter.java
index d7f0dcf..0602928 100644
--- a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAuthCodeAssertionFilter.java
+++ b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/JWTAuthCodeAssertionFilter.java
@@ -39,7 +39,7 @@ import org.apache.knox.gateway.util.JsonUtils;
 public class JWTAuthCodeAssertionFilter extends AbstractIdentityAssertionFilter {
   private static final String BEARER = "Bearer ";
 
-  private JWTokenAuthority authority = null;
+  private JWTokenAuthority authority;
 
   private ServiceRegistry sr;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
index bf6ad94..d5235aa 100644
--- a/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
+++ b/gateway-provider-security-jwt/src/main/java/org/apache/knox/gateway/provider/federation/jwt/filter/SSOCookieFederationFilter.java
@@ -213,9 +213,9 @@ private String gatewayPath;
     StringBuilder sb = new StringBuilder(scheme);
     sb.append("://").append(host);
     if (!host.contains(":")) {
-      sb.append(":").append(port);
+      sb.append(':').append(port);
     }
-    sb.append("/").append(gatewayPath).append("/knoxsso/api/v1/websso");
+    sb.append('/').append(gatewayPath).append("/knoxsso/api/v1/websso");
 
     return sb.toString();
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-jwt/src/test/java/org/apache/knox/gateway/provider/federation/AbstractJWTFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/test/java/org/apache/knox/gateway/provider/federation/AbstractJWTFilterTest.java b/gateway-provider-security-jwt/src/test/java/org/apache/knox/gateway/provider/federation/AbstractJWTFilterTest.java
index 9712ca8..dd9aae9 100644
--- a/gateway-provider-security-jwt/src/test/java/org/apache/knox/gateway/provider/federation/AbstractJWTFilterTest.java
+++ b/gateway-provider-security-jwt/src/test/java/org/apache/knox/gateway/provider/federation/AbstractJWTFilterTest.java
@@ -72,10 +72,10 @@ public abstract class AbstractJWTFilterTest  {
   private static final String SERVICE_URL = "https://localhost:8888/resource";
   private static final String dnTemplate = "CN={0},OU=Test,O=Hadoop,L=Test,ST=Test,C=US";
 
-  protected AbstractJWTFilter handler = null;
-  protected static RSAPublicKey publicKey = null;
-  protected static RSAPrivateKey privateKey = null;
-  protected static String pem = null;
+  protected AbstractJWTFilter handler;
+  protected static RSAPublicKey publicKey;
+  protected static RSAPrivateKey privateKey;
+  protected static String pem;
 
   protected abstract void setTokenOnRequest(HttpServletRequest request, SignedJWT jwt);
   protected abstract void setGarbledTokenOnRequest(HttpServletRequest request, SignedJWT jwt);
@@ -819,8 +819,8 @@ public abstract class AbstractJWTFilterTest  {
   }
 
   protected static class TestFilterChain implements FilterChain {
-    boolean doFilterCalled = false;
-    Subject subject = null;
+    boolean doFilterCalled;
+    Subject subject;
 
     @Override
     public void doFilter(ServletRequest request, ServletResponse response) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
index 78c2449..02e1064 100644
--- a/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
+++ b/gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jDispatcherFilter.java
@@ -85,9 +85,9 @@ public class Pac4jDispatcherFilter implements Filter {
   private CallbackFilter callbackFilter;
 
   private SecurityFilter securityFilter;
-  private MasterService masterService = null;
-  private KeystoreService keystoreService = null;
-  private AliasService aliasService = null;
+  private MasterService masterService;
+  private KeystoreService keystoreService;
+  private AliasService aliasService;
 
   @Override
   public void init( FilterConfig filterConfig ) throws ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-pac4j/src/test/java/org/apache/knox/gateway/pac4j/MockHttpServletResponse.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-pac4j/src/test/java/org/apache/knox/gateway/pac4j/MockHttpServletResponse.java b/gateway-provider-security-pac4j/src/test/java/org/apache/knox/gateway/pac4j/MockHttpServletResponse.java
index 8d0643d..6608e28 100644
--- a/gateway-provider-security-pac4j/src/test/java/org/apache/knox/gateway/pac4j/MockHttpServletResponse.java
+++ b/gateway-provider-security-pac4j/src/test/java/org/apache/knox/gateway/pac4j/MockHttpServletResponse.java
@@ -33,7 +33,7 @@ public class MockHttpServletResponse extends HttpServletResponseWrapper {
 
     private List<Cookie> cookies = new ArrayList<>();
     private String location;
-    private int status = 0;
+    private int status;
     private Map<String, String> headers = new HashMap<>();
 
     public MockHttpServletResponse() {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
index c6d1389..0b74c5e 100644
--- a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
+++ b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/AbstractPreAuthFederationFilter.java
@@ -46,7 +46,7 @@ import org.apache.knox.gateway.security.PrimaryPrincipal;
 
 public abstract class AbstractPreAuthFederationFilter implements Filter {
 
-  private List<PreAuthValidator> validators = null;
+  private List<PreAuthValidator> validators;
   private FilterConfig filterConfig;
   private static AuditService auditService = AuditServiceFactory.getAuditService();
   private static Auditor auditor = auditService.getAuditor(

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/HeaderPreAuthFederationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/HeaderPreAuthFederationFilter.java b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/HeaderPreAuthFederationFilter.java
index 2cd6235..bf613c2 100644
--- a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/HeaderPreAuthFederationFilter.java
+++ b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/HeaderPreAuthFederationFilter.java
@@ -30,7 +30,7 @@ public class HeaderPreAuthFederationFilter extends AbstractPreAuthFederationFilt
   static final String CUSTOM_HEADER_PARAM = "preauth.custom.header";
   static final String CUSTOM_GROUP_HEADER_PARAM = "preauth.custom.group.header";
   String headerName = "SM_USER";
-  String groupHeaderName = null;
+  String groupHeaderName;
 
   @Override
   public void init(FilterConfig filterConfig) throws ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/PreAuthFederationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/PreAuthFederationFilter.java b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/PreAuthFederationFilter.java
index d056b84..020004d 100644
--- a/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/PreAuthFederationFilter.java
+++ b/gateway-provider-security-preauth/src/main/java/org/apache/knox/gateway/preauth/filter/PreAuthFederationFilter.java
@@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletResponse;
 
 public class PreAuthFederationFilter implements Filter {
   private static final String CUSTOM_HEADER_PARAM = "preauth.customHeader";
-  private List<PreAuthValidator> validators = null;
+  private List<PreAuthValidator> validators;
   private FilterConfig filterConfig;
   private String headerName = "SM_USER";
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/deploy/impl/ShiroConfig.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/deploy/impl/ShiroConfig.java b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/deploy/impl/ShiroConfig.java
index f282d06..60ac744 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/deploy/impl/ShiroConfig.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/deploy/impl/ShiroConfig.java
@@ -62,9 +62,9 @@ public class ShiroConfig {
   public String toString() {
     StringBuilder sb = new StringBuilder();
     for(Entry<String, Map<String, String>> section : sections.entrySet()) {
-      sb.append("[").append(section.getKey()).append("]\n");
+      sb.append('[').append(section.getKey()).append("]\n");
       for(Entry<String, String> entry : section.getValue().entrySet()) {
-        sb.append(entry.getKey()).append("=").append(entry.getValue()).append("\n");
+        sb.append(entry.getKey()).append('=').append(entry.getValue()).append('\n');
       }
     }
     return sb.toString();

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/RedirectToUrlFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/RedirectToUrlFilter.java b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/RedirectToUrlFilter.java
index 87f25f7..f97984f 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/RedirectToUrlFilter.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/filter/RedirectToUrlFilter.java
@@ -28,7 +28,7 @@ import java.io.IOException;
 public class RedirectToUrlFilter extends AbstractGatewayFilter {
   public static final String REDIRECT_TO_URL = "redirectToUrl";
 
-  protected String redirectUrl = null;
+  protected String redirectUrl;
 
   @Override
   public void init(FilterConfig filterConfig) throws ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/shirorealm/KnoxLdapRealm.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/shirorealm/KnoxLdapRealm.java b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/shirorealm/KnoxLdapRealm.java
index 1a33d57..7aedeca 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/shirorealm/KnoxLdapRealm.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/knox/gateway/shirorealm/KnoxLdapRealm.java
@@ -162,7 +162,7 @@ public class KnoxLdapRealm extends JndiLdapRealm {
     private String principalRegex = DEFAULT_PRINCIPAL_REGEX;
     private Pattern principalPattern = Pattern.compile( DEFAULT_PRINCIPAL_REGEX );
     private String userDnTemplate = "{0}";
-    private String userSearchFilter = null;
+    private String userSearchFilter;
     private String userSearchAttributeTemplate = "{0}";
     private String userSearchScope = "subtree";
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-webappsec/src/main/java/org/apache/knox/gateway/webappsec/filter/CSRFPreventionFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/main/java/org/apache/knox/gateway/webappsec/filter/CSRFPreventionFilter.java b/gateway-provider-security-webappsec/src/main/java/org/apache/knox/gateway/webappsec/filter/CSRFPreventionFilter.java
index 9d0ba44..a248d5b 100644
--- a/gateway-provider-security-webappsec/src/main/java/org/apache/knox/gateway/webappsec/filter/CSRFPreventionFilter.java
+++ b/gateway-provider-security-webappsec/src/main/java/org/apache/knox/gateway/webappsec/filter/CSRFPreventionFilter.java
@@ -36,7 +36,7 @@ public class CSRFPreventionFilter implements Filter {
   private static final String CUSTOM_METHODS_TO_IGNORE_PARAM = "csrf.methodstoignore";
   private String  headerName = "X-XSRF-Header";
   private String  mti = "GET,OPTIONS,HEAD";
-  private Set<String> methodsToIgnore = null;
+  private Set<String> methodsToIgnore;
 
   @Override
   public void init( FilterConfig filterConfig ) throws ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/StrictTransportFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/StrictTransportFilterTest.java b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/StrictTransportFilterTest.java
index a4a5730..c459a1a 100644
--- a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/StrictTransportFilterTest.java
+++ b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/StrictTransportFilterTest.java
@@ -39,9 +39,9 @@ import org.junit.Test;
 
 public class StrictTransportFilterTest {
   private static final String STRICT_TRANSPORT = "Strict-Transport-Security";
-  String options = null;
-  Collection<String> headerNames = null;
-  Collection<String> headers = null;
+  String options;
+  Collection<String> headerNames;
+  Collection<String> headers;
 
   @Test
   public void testDefaultOptionsValue() throws Exception {
@@ -129,7 +129,7 @@ public class StrictTransportFilterTest {
   }
 
   class TestFilterChain implements FilterChain {
-    boolean doFilterCalled = false;
+    boolean doFilterCalled;
 
     @Override
     public void doFilter(ServletRequest request, ServletResponse response)

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XContentTypeOptionsFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XContentTypeOptionsFilterTest.java b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XContentTypeOptionsFilterTest.java
index 9318d38..d08642e 100644
--- a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XContentTypeOptionsFilterTest.java
+++ b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XContentTypeOptionsFilterTest.java
@@ -38,8 +38,8 @@ import static org.junit.Assert.fail;
 
 public class XContentTypeOptionsFilterTest {
 
-  private String options = null;
-  private Collection<String> headers = null;
+  private String options;
+  private Collection<String> headers;
 
   @Test
   public void testDefaultOptionsValue() throws Exception {
@@ -126,7 +126,7 @@ public class XContentTypeOptionsFilterTest {
   }
 
   class TestFilterChain implements FilterChain {
-    boolean doFilterCalled = false;
+    boolean doFilterCalled;
 
     @Override
     public void doFilter(ServletRequest request, ServletResponse response) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XFrameOptionsFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XFrameOptionsFilterTest.java b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XFrameOptionsFilterTest.java
index eb085d6..6ac0525 100644
--- a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XFrameOptionsFilterTest.java
+++ b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XFrameOptionsFilterTest.java
@@ -39,9 +39,9 @@ import org.junit.Test;
 
 public class XFrameOptionsFilterTest {
   private static final String X_FRAME_OPTIONS = "X-Frame-Options";
-  String options = null;
-  Collection<String> headerNames = null;
-  Collection<String> headers = null;
+  String options;
+  Collection<String> headerNames;
+  Collection<String> headers;
 
   @Test
   public void testDefaultOptionsValue() throws Exception {
@@ -158,7 +158,7 @@ public class XFrameOptionsFilterTest {
   }
 
   class TestFilterChain implements FilterChain {
-    boolean doFilterCalled = false;
+    boolean doFilterCalled;
 
     @Override
     public void doFilter(ServletRequest request, ServletResponse response)

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XSSProtectionFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XSSProtectionFilterTest.java b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XSSProtectionFilterTest.java
index 8d0dbca..773384b 100644
--- a/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XSSProtectionFilterTest.java
+++ b/gateway-provider-security-webappsec/src/test/java/org/apache/knox/gateway/webappsec/XSSProtectionFilterTest.java
@@ -38,8 +38,8 @@ import static org.junit.Assert.fail;
 
 public class XSSProtectionFilterTest {
 
-  private String options = null;
-  private Collection<String> headers = null;
+  private String options;
+  private Collection<String> headers;
 
   @Test
   public void testDefaultOptionsValue() throws Exception {
@@ -122,7 +122,7 @@ public class XSSProtectionFilterTest {
   }
 
   class TestFilterChain implements FilterChain {
-    boolean doFilterCalled = false;
+    boolean doFilterCalled;
 
     @Override
     public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/CompositeEnumeration.java
----------------------------------------------------------------------
diff --git a/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/CompositeEnumeration.java b/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/CompositeEnumeration.java
index 3c60e0b..96a76c6 100644
--- a/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/CompositeEnumeration.java
+++ b/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/CompositeEnumeration.java
@@ -22,7 +22,7 @@ import java.util.NoSuchElementException;
 
 public class CompositeEnumeration<T> implements Enumeration<T> {
 
-  private int index = 0;
+  private int index;
   private Enumeration<T>[] array;
 
   @SafeVarargs

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
index e93daee..6403a02 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
@@ -134,10 +134,9 @@ public class GatewayFilter implements Filter {
             match = chains.match(Parser.parseLiteral(newPathWithQuery));
             String origUrl = ((HttpServletRequest) servletRequest).getRequestURL().toString();
             String url = origUrl;
-            if (path.equals("/")) {
+            if (path == null || path.equals("/")) {
               url += defaultServicePath;
-            }
-            else {
+            } else {
               int index = origUrl.indexOf(path);
               url = origUrl.substring(0, index) + "/" + defaultServicePath + path;
             }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayForwardingServlet.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayForwardingServlet.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayForwardingServlet.java
index 6f078bd..403c5fe 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayForwardingServlet.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayForwardingServlet.java
@@ -49,7 +49,7 @@ public class GatewayForwardingServlet extends HttpServlet{
           .getAuditor( AuditConstants.DEFAULT_AUDITOR_NAME,
                   AuditConstants.KNOX_SERVICE_NAME, AuditConstants.KNOX_COMPONENT_NAME );
 
-  private String redirectToContext = null;
+  private String redirectToContext;
 
   @Override
   protected void doHead(HttpServletRequest req, HttpServletResponse resp)

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
index 0a90220..2c80c81 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServer.java
@@ -81,7 +81,6 @@ import javax.servlet.SessionCookieConfig;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.transform.TransformerException;
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.InputStream;
@@ -96,6 +95,7 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
 import java.security.cert.CertificateException;
@@ -734,7 +734,7 @@ public class GatewayServer {
         }
       }
 
-      try (OutputStream outputStream = new FileOutputStream(webXmlFile);
+      try (OutputStream outputStream = Files.newOutputStream(webXmlFile.toPath());
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)) {
         XmlUtils.writeXml(webXmlDoc, outputStreamWriter);
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
index 6358107..59f014f 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
@@ -69,7 +69,7 @@ public abstract class DeploymentFactory {
   private static final String SERVLET_NAME_SUFFIX = "-knox-gateway-servlet";
   private static final String FILTER_NAME_SUFFIX = "-knox-gateway-filter";
   private static final GatewayMessages log = MessagesFactory.get( GatewayMessages.class );
-  private static GatewayServices gatewayServices = null;
+  private static GatewayServices gatewayServices;
 
   private static Map<String,Map<String,Map<Version, ServiceDeploymentContributor>>> SERVICE_CONTRIBUTOR_MAP;
   static {

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ApplicationDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ApplicationDeploymentContributor.java b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ApplicationDeploymentContributor.java
index 8cbe8bc..00574af 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ApplicationDeploymentContributor.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ApplicationDeploymentContributor.java
@@ -41,13 +41,14 @@ import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.StringReader;
 import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -84,7 +85,7 @@ public class ApplicationDeploymentContributor extends ServiceDeploymentContribut
     } else {
       JAXBContext context = JAXBContext.newInstance( ServiceDefinition.class );
       Unmarshaller unmarshaller = context.createUnmarshaller();
-      try( FileInputStream inputStream = new FileInputStream( file ) ) {
+      try(InputStream inputStream = Files.newInputStream(file.toPath()) ) {
           definition = (ServiceDefinition) unmarshaller.unmarshal( inputStream );
       }
     }
@@ -96,9 +97,10 @@ public class ApplicationDeploymentContributor extends ServiceDeploymentContribut
     if( !file.exists() ) {
       rules = UrlRewriteRulesDescriptorFactory.load( "xml", new StringReader( "<rules/>" ) );
     } else {
-      InputStreamReader reader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8);
-      rules = UrlRewriteRulesDescriptorFactory.load( "xml", reader );
-      reader.close();
+      try(InputStream inputStream = Files.newInputStream(file.toPath());
+          InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) {
+        rules = UrlRewriteRulesDescriptorFactory.load("xml", reader);
+      }
     }
     return rules;
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java b/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
index 43fb579..27c83e5 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/dispatch/UrlConnectionDispatch.java
@@ -113,16 +113,16 @@ public class UrlConnectionDispatch extends AbstractGatewayFilter {
     StringBuilder paramStr = new StringBuilder();
     Enumeration paramNames = request.getParameterNames();
     if( paramNames.hasMoreElements() ) {
-      paramStr.append( "?" );
+      paramStr.append('?');
     }
     while( paramNames.hasMoreElements() ) {
       String paramName = (String)paramNames.nextElement();
       String paramValue = request.getParameter( paramName );
       paramStr.append( paramName );
-      paramStr.append( "=" );
+      paramStr.append('=');
       paramStr.append( URLEncoder.encode( paramValue, StandardCharsets.UTF_8.name() ) );
       if( paramNames.hasMoreElements() ) {
-        paramStr.append( "&" );
+        paramStr.append('&');
       }
     }
     String urlStr = targetUri.toString() + paramStr.toString();

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/filter/PortMappingHelperHandler.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/filter/PortMappingHelperHandler.java b/gateway-server/src/main/java/org/apache/knox/gateway/filter/PortMappingHelperHandler.java
index a11f52a..effcd64 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/filter/PortMappingHelperHandler.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/filter/PortMappingHelperHandler.java
@@ -49,7 +49,7 @@ public class PortMappingHelperHandler extends HandlerWrapper {
 
   final GatewayConfig config;
 
-  private String defaultTopologyRedirectContext = null;
+  private String defaultTopologyRedirectContext;
 
   public PortMappingHelperHandler(final GatewayConfig config) {
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
index 919019d..5214928 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/CLIGatewayServices.java
@@ -43,8 +43,8 @@ public class CLIGatewayServices implements GatewayServices {
   private static GatewayMessages log = MessagesFactory.get( GatewayMessages.class );
 
   private Map<String,Service> services = new HashMap<>();
-  private CLIMasterService ms = null;
-  private DefaultKeystoreService ks = null;
+  private CLIMasterService ms;
+  private DefaultKeystoreService ks;
 
   public CLIGatewayServices() {
     super();

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/services/DefaultGatewayServices.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/DefaultGatewayServices.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/DefaultGatewayServices.java
index 98f13b2..a09f2f3 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/DefaultGatewayServices.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/DefaultGatewayServices.java
@@ -52,8 +52,8 @@ public class DefaultGatewayServices implements GatewayServices {
   private static GatewayMessages log = MessagesFactory.get( GatewayMessages.class );
 
   private Map<String,Service> services = new HashMap<>();
-  private DefaultMasterService ms = null;
-  private DefaultKeystoreService ks = null;
+  private DefaultMasterService ms;
+  private DefaultKeystoreService ks;
 
   public DefaultGatewayServices() {
     super();

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrumentedGatewayFilter.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrumentedGatewayFilter.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrumentedGatewayFilter.java
index 9026598..e346bf8 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrumentedGatewayFilter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrumentedGatewayFilter.java
@@ -85,12 +85,12 @@ public class InstrumentedGatewayFilter extends GatewayFilter {
 
   private Timer timer(ServletRequest request) {
     StringBuilder builder = new StringBuilder();
-    builder.append("client.");
-    builder.append(request.getServletContext().getContextPath());
+    builder.append("client.")
+        .append(request.getServletContext().getContextPath());
     if (request instanceof HttpServletRequest) {
       HttpServletRequest httpServletRequest = (HttpServletRequest) request;
       builder.append(InstrUtils.getResourcePath(httpServletRequest.getPathInfo()));
-      builder.append(".");
+      builder.append('.');
       builder.append(httpServletRequest.getMethod());
       builder.append("-requests");
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/6a35473a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/reporters/AbstractMetricsReporter.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/reporters/AbstractMetricsReporter.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/reporters/AbstractMetricsReporter.java
index 9ec3cb5..e23982d 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/reporters/AbstractMetricsReporter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/reporters/AbstractMetricsReporter.java
@@ -20,7 +20,7 @@ package org.apache.knox.gateway.services.metrics.impl.reporters;
 import org.apache.knox.gateway.services.metrics.MetricsReporter;
 
 public abstract class AbstractMetricsReporter implements MetricsReporter {
-  private boolean enabled = false;
+  private boolean enabled;
 
   @Override
   public boolean isEnabled() {


Mime
View raw message