knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [2/2] knox git commit: KNOX-1666 - Enable PMD best practices ruleset
Date Mon, 10 Dec 2018 22:52:57 GMT
KNOX-1666 - Enable PMD best practices ruleset

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/be7f4f37
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/be7f4f37
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/be7f4f37

Branch: refs/heads/master
Commit: be7f4f37ea0d716a6767ce41ef9f31fdf9912ff7
Parents: c478a06
Author: Kevin Risden <krisden@apache.org>
Authored: Mon Dec 10 17:04:53 2018 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Mon Dec 10 17:04:58 2018 -0500

----------------------------------------------------------------------
 .../resources/build-tools/pmd/pmd-ruleset.xml   | 22 +++++-
 .../ambari/AmbariServiceDiscoveryType.java      |  3 -
 .../SparkThriftServerUIServiceURLCreator.java   |  3 +-
 .../loggers/sout/SoutMessageLogger.java         |  7 --
 .../loggers/sout/SoutMessageLoggerFactory.java  |  2 +-
 .../provider/impl/HS2ZookeeperURLManager.java   |  4 +-
 ...entityAsserterHttpServletRequestWrapper.java | 12 +--
 .../function/UsernameFunctionProcessor.java     | 13 ----
 .../impl/ServiceAddressFunctionProcessor.java   |  2 -
 .../impl/ServiceUrlFunctionProcessor.java       |  2 -
 .../filter/rewrite/ext/ScopedMatcher.java       |  8 +-
 .../rewrite/impl/FrontendFunctionProcessor.java |  7 +-
 .../filter/rewrite/impl/UrlRewriteRequest.java  |  6 +-
 .../filter/rewrite/impl/UrlRewriteResponse.java |  2 -
 .../rewrite/impl/html/HtmlFilterReaderBase.java | 19 +----
 .../impl/javascript/JavaScriptFilterReader.java |  4 -
 .../rewrite/impl/json/JsonFilterReader.java     |  2 +-
 .../rewrite/impl/xml/XmlFilterReader.java       | 25 +++----
 .../impl/xml/XmlUrlRewriteFilterReader.java     |  6 +-
 .../api/UrlRewriteServletFilterTest.java        |  8 +-
 .../apache/knox/gateway/filter/AclParser.java   |  5 +-
 .../gateway/filter/AclsAuthorizationFilter.java |  4 +-
 .../jwt/filter/JWTAuthCodeAssertionFilter.java  |  2 -
 .../pac4j/filter/Pac4jDispatcherFilter.java     |  2 -
 .../knox/gateway/shirorealm/KnoxLdapRealm.java  |  6 +-
 .../filter/XForwardedHeaderRequestWrapper.java  |  8 +-
 .../org/apache/knox/gateway/GatewayFilter.java  | 26 +------
 .../knox/gateway/GatewayForwardingServlet.java  |  2 -
 .../org/apache/knox/gateway/GatewayServer.java  | 56 +++++---------
 .../org/apache/knox/gateway/GatewayServlet.java |  2 +-
 .../gateway/config/impl/GatewayConfigImpl.java  |  4 -
 .../impl/ApplicationDeploymentContributor.java  |  8 +-
 .../ServiceDefinitionDeploymentContributor.java |  6 +-
 .../xml/XmlGatewayDescriptorRules.java          |  7 +-
 .../filter/BasicAuthChallengeFilter.java        | 50 -------------
 .../gateway/services/CLIGatewayServices.java    |  5 --
 .../metrics/impl/DefaultMetricsContext.java     |  3 +-
 .../metrics/impl/DefaultMetricsService.java     |  5 +-
 .../InstrGatewayFilterProviderDescriptor.java   |  2 +-
 .../InstrHttpClientProviderDescriptor.java      |  2 +-
 .../impl/DefaultServiceRegistryService.java     |  8 +-
 .../services/registry/impl/Registry.java        |  3 +-
 .../security/impl/CLIMasterService.java         |  4 -
 .../security/impl/DefaultCryptoService.java     |  3 +-
 .../security/impl/DefaultMasterService.java     |  4 -
 .../security/impl/RemoteAliasService.java       |  2 -
 .../simple/SimpleDescriptorHandler.java         |  4 +-
 .../org/apache/knox/gateway/util/KnoxCLI.java   | 44 ++---------
 .../websockets/GatewayWebsocketHandler.java     | 15 +---
 .../builder/PropertyTopologyBuilderTest.java    |  4 +-
 .../service/knoxtoken/TokenResource.java        |  2 +-
 .../knox/gateway/dispatch/NiFiRequestUtil.java  |  2 +-
 .../config/remote/zk/CuratorClientService.java  |  4 +-
 .../service/test/ServiceTestResource.java       |  2 +-
 .../knox/gateway/shell/ClientContext.java       | 14 ++--
 .../apache/knox/gateway/shell/Credentials.java  |  7 +-
 .../AbstractIdentityAssertionFilter.java        | 11 ---
 .../principal/SimplePrincipalMapper.java        |  7 +-
 .../apache/knox/gateway/topology/Topology.java  |  2 -
 .../apache/knox/gateway/GatewayTestDriver.java  |  2 +-
 .../org/apache/knox/test/log/NoOpAppender.java  |  4 +-
 .../knox/gateway/GatewayAdminFuncTest.java      |  4 +-
 .../gateway/GatewayAdminTopologyFuncTest.java   |  4 +-
 .../apache/knox/gateway/GatewayAppFuncTest.java |  4 +-
 .../knox/gateway/GatewayDeployFuncTest.java     |  4 +-
 .../gateway/GatewayLocalServiceFuncTest.java    |  4 +-
 .../knox/gateway/GatewayMultiFuncTest.java      |  4 +-
 .../knox/gateway/GatewaySampleFuncTest.java     |  4 +-
 .../apache/knox/gateway/GatewaySslFuncTest.java |  4 +-
 .../apache/knox/gateway/Knox242FuncTest.java    |  2 +-
 .../gateway/KnoxCliLdapFuncTestNegative.java    |  6 +-
 .../gateway/KnoxCliLdapFuncTestPositive.java    |  6 +-
 .../apache/knox/gateway/KnoxCliSysBindTest.java |  6 +-
 .../deploy/DeploymentFactoryFuncTest.java       |  4 +-
 .../knox/gateway/util/IpAddressValidator.java   |  7 +-
 .../org/apache/knox/gateway/util/JsonPath.java  | 16 ++--
 .../knox/gateway/util/X500PrincipalParser.java  | 79 +++++++-------------
 .../impl/DefaultConfigurationInjector.java      |  6 +-
 .../apache/knox/gateway/launcher/Command.java   |  2 +-
 .../knox/gateway/util/urltemplate/Builder.java  |  6 +-
 .../knox/gateway/util/urltemplate/Matcher.java  | 15 ++--
 .../knox/gateway/util/urltemplate/Rewriter.java |  2 +-
 .../knox/gateway/util/urltemplate/Segment.java  | 64 +---------------
 .../knox/gateway/util/urltemplate/Template.java |  3 +-
 84 files changed, 222 insertions(+), 544 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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
index 83896f7..1f659dc 100644
--- a/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
+++ b/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
@@ -20,9 +20,25 @@ limitations under the License.
          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/bestpractices.xml">
+        <exclude name="AbstractClassWithoutAbstractMethod" />
+        <exclude name="AccessorMethodGeneration" />
+        <exclude name="ArrayIsStoredDirectly" />
+        <exclude name="AvoidPrintStackTrace" />
+        <exclude name="AvoidReassigningParameters" />
+        <exclude name="AvoidStringBufferField" />
+        <exclude name="AvoidUsingHardCodedIP" />
+        <exclude name="ConstantsInInterface" />
+        <exclude name="GuardLogStatement" />
+        <exclude name="MethodReturnsInternalArray" />
+        <exclude name="OneDeclarationPerLine" />
+        <exclude name="PreserveStackTrace" />
+        <exclude name="ReplaceEnumerationWithIterator" />
+        <exclude name="ReplaceHashtableWithMap" />
+        <exclude name="SwitchStmtsShouldHaveDefault" />
+        <exclude name="SystemPrintln" />
+        <exclude name="UseVarargs" />
+    </rule>
     <!--<rule ref="category/java/codestyle.xml" />-->
     <!--<rule ref="category/java/design.xml" />-->
     <!--<rule ref="category/java/documentation.xml" />-->

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryType.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryType.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryType.java
index c3793f2..3d4987e 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryType.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariServiceDiscoveryType.java
@@ -20,9 +20,6 @@ import org.apache.knox.gateway.topology.discovery.ServiceDiscovery;
 import org.apache.knox.gateway.topology.discovery.ServiceDiscoveryType;
 
 public class AmbariServiceDiscoveryType implements ServiceDiscoveryType {
-
-    private static final String IMPL = AmbariServiceDiscovery.class.getCanonicalName();
-
     @Override
     public String getType() {
         return AmbariServiceDiscovery.TYPE;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkThriftServerUIServiceURLCreator.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkThriftServerUIServiceURLCreator.java b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkThriftServerUIServiceURLCreator.java
index 4d33c2c..665e5c7 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkThriftServerUIServiceURLCreator.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/SparkThriftServerUIServiceURLCreator.java
@@ -53,7 +53,7 @@ public class SparkThriftServerUIServiceURLCreator extends SparkCommonServiceURLC
 
       if (comp != null) {
         String transportMode = comp.getConfigProperty("hive.server2.transport.mode");
-        if (transportMode.equalsIgnoreCase("http")) {
+        if ("http".equalsIgnoreCase(transportMode)) {
           String endpoint = comp.getConfigProperty("hive.server2.http.endpoint");
           for (String url : urls) {
             thriftURLs.add(url + (endpoint != null ? "/" + endpoint : ""));
@@ -64,5 +64,4 @@ public class SparkThriftServerUIServiceURLCreator extends SparkCommonServiceURLC
 
     return thriftURLs;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java
----------------------------------------------------------------------
diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java
index 4109eaf..03ef3ac 100644
--- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java
+++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLogger.java
@@ -28,12 +28,6 @@ public class SoutMessageLogger implements MessageLogger {
   private static final String FORMAT_WITHOUT_ID = "{0}: {2}";
   private static final String FORMAT_WITH_ID = "{0}: {2} [{1}]";
 
-  private final String name;
-
-  SoutMessageLogger( String name ) {
-    this.name = name;
-  }
-
   @Override
   public boolean isLoggable( MessageLevel level ) {
     return true;
@@ -51,5 +45,4 @@ public class SoutMessageLogger implements MessageLogger {
       thrown.printStackTrace();
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLoggerFactory.java
----------------------------------------------------------------------
diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLoggerFactory.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLoggerFactory.java
index 74ab6f6..9f02c1d 100644
--- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLoggerFactory.java
+++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/loggers/sout/SoutMessageLoggerFactory.java
@@ -43,7 +43,7 @@ public class SoutMessageLoggerFactory implements MessageLoggerFactory {
   public MessageLogger getLogger( String name ) {
     MessageLogger logger = LOGGERS.get( name );
     if( logger == null ) {
-      logger = new SoutMessageLogger( name );
+      logger = new SoutMessageLogger();
       LOGGERS.put( name, logger );
     }
     return logger;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
index 112d3df..562611b 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/provider/impl/HS2ZookeeperURLManager.java
@@ -26,9 +26,9 @@ import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -43,7 +43,7 @@ public class HS2ZookeeperURLManager extends DefaultURLManager {
 
   private String zooKeeperNamespace;
 
-  private HashSet<String> failedSet;
+  private Set<String> failedSet;
 
   public HS2ZookeeperURLManager() {
     failedSet = new LinkedHashSet<>();

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 1c8b478..ace4ad1 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
@@ -73,16 +73,10 @@ private static SpiGatewayMessages log = MessagesFactory.get( SpiGatewayMessages.
 
   @Override
   public Map<String, String[]> getParameterMap() {
-    Map<String, String[]> map = null;
-    try {
-      map = convertValuesToStringArrays(getParams());
-    } catch (UnsupportedEncodingException e) {
-      log.unableToGetParamsFromQueryString(e);
-    }
-    return map;
+    return convertValuesToStringArrays();
   }
 
-  private Map<String, String[]> convertValuesToStringArrays(Map<String, List<String>> params) {
+  private Map<String, String[]> convertValuesToStringArrays() {
     Map<String, String[]> arrayMap = new HashMap<>();
     String name;
     Enumeration<String> names = getParameterNames();
@@ -288,7 +282,7 @@ private static SpiGatewayMessages log = MessagesFactory.get( SpiGatewayMessages.
 
     private InputStream stream;
 
-    private ServletInputStreamWrapper( InputStream stream ) {
+    ServletInputStreamWrapper( InputStream stream ) {
       this.stream = stream;
     }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/function/UsernameFunctionProcessor.java b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
index ccfee37..29ba0b8 100644
--- a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
+++ b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
@@ -20,8 +20,6 @@ package org.apache.knox.gateway.identityasserter.common.function;
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteEnvironment;
 import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteContext;
 import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor;
-import org.apache.knox.gateway.i18n.GatewaySpiMessages;
-import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.security.SubjectUtils;
 
 import javax.security.auth.Subject;
@@ -31,9 +29,6 @@ import java.util.List;
 public class UsernameFunctionProcessor
     implements UrlRewriteFunctionProcessor<UsernameFunctionDescriptor> {
 
-  private static final GatewaySpiMessages LOG = MessagesFactory.get( GatewaySpiMessages.class );
-//  private PrincipalMapper mapper = null;
-
   @Override
   public String name() {
     return UsernameFunctionDescriptor.FUNCTION_NAME;
@@ -41,12 +36,6 @@ public class UsernameFunctionProcessor
 
   @Override
   public void initialize( UrlRewriteEnvironment environment, UsernameFunctionDescriptor descriptor ) throws Exception {
-//    if( environment != null ) {
-//      GatewayServices services = environment.getAttribute( GatewayServices.GATEWAY_SERVICES_ATTRIBUTE );
-//      if( services != null ) {
-//        mapper = (PrincipalMapper)services.getService( "PrincipalMapperService" /*GatewayServices.PRINCIPAL_MAPPER_SERVICE*/ );
-//      }
-//    }
   }
 
   @Override
@@ -67,6 +56,4 @@ public class UsernameFunctionProcessor
     }
     return results;
   }
-
 }
-

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceAddressFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceAddressFunctionProcessor.java b/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceAddressFunctionProcessor.java
index 10a889c..3bc8d2a 100644
--- a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceAddressFunctionProcessor.java
+++ b/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceAddressFunctionProcessor.java
@@ -17,7 +17,6 @@
  */
 package org.apache.knox.gateway.svcregfunc.impl;
 
-import org.apache.knox.gateway.filter.rewrite.api.UrlRewriter;
 import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteContext;
 import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor;
 import org.apache.knox.gateway.svcregfunc.api.ServiceAddressFunctionDescriptor;
@@ -42,7 +41,6 @@ public class ServiceAddressFunctionProcessor
   public List<String> resolve( UrlRewriteContext context, List<String> parameters ) throws Exception {
     List<String> results = null;
     if( parameters != null ) {
-      UrlRewriter.Direction direction = context.getDirection();
       results = new ArrayList<>( parameters.size() );
       for( String parameter : parameters ) {
         parameter = resolve( parameter );

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceUrlFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceUrlFunctionProcessor.java b/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceUrlFunctionProcessor.java
index ea229bd..463d539 100644
--- a/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceUrlFunctionProcessor.java
+++ b/gateway-provider-rewrite-func-service-registry/src/main/java/org/apache/knox/gateway/svcregfunc/impl/ServiceUrlFunctionProcessor.java
@@ -17,7 +17,6 @@
  */
 package org.apache.knox.gateway.svcregfunc.impl;
 
-import org.apache.knox.gateway.filter.rewrite.api.UrlRewriter;
 import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteContext;
 import org.apache.knox.gateway.filter.rewrite.spi.UrlRewriteFunctionProcessor;
 import org.apache.knox.gateway.svcregfunc.api.ServiceUrlFunctionDescriptor;
@@ -39,7 +38,6 @@ public class ServiceUrlFunctionProcessor
   public List<String> resolve( UrlRewriteContext context, List<String> parameters ) throws Exception {
     List<String> results = null;
     if( parameters != null ) {
-      UrlRewriter.Direction direction = context.getDirection();
       results = new ArrayList<>( parameters.size() );
       for( String parameter : parameters ) {
         parameter = resolve( parameter );

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/ScopedMatcher.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/ScopedMatcher.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/ScopedMatcher.java
index 350e5c5..04f0fa5 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/ScopedMatcher.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/ScopedMatcher.java
@@ -24,6 +24,7 @@ import org.apache.knox.gateway.util.urltemplate.Template;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.HashMap;
+import java.util.Map;
 
 /**
  * A simple extension to the matcher that takes into account scopes for rules along with the templates themselves.
@@ -34,7 +35,7 @@ public class ScopedMatcher extends Matcher<UrlRewriteRuleProcessorHolder> {
 
   public static final String GLOBAL_SCOPE = "GLOBAL";
 
-  private HashMap<String, Matcher<UrlRewriteRuleProcessorHolder>> matchers;
+  private Map<String, Matcher<UrlRewriteRuleProcessorHolder>> matchers;
 
   public ScopedMatcher() {
     super();
@@ -48,7 +49,7 @@ public class ScopedMatcher extends Matcher<UrlRewriteRuleProcessorHolder> {
 
   @Override
   public void add(Template template, UrlRewriteRuleProcessorHolder value) {
-    Matcher<UrlRewriteRuleProcessorHolder> matcher = getMatcher(template, value);
+    Matcher<UrlRewriteRuleProcessorHolder> matcher = getMatcher(value);
     matcher.add( template, value );
   }
 
@@ -108,11 +109,10 @@ public class ScopedMatcher extends Matcher<UrlRewriteRuleProcessorHolder> {
    * Returns a matcher for a given template and processor holder. This method takes into account different scopes in
    * addition to template values. If a matcher exists for a template but the scope is different, a new matcher is
    * created and returned.
-   * @param template the template for which a matcher is needed
    * @param holder the rule holder that goes along with the template.
    * @return a matcher
    */
-  private Matcher<UrlRewriteRuleProcessorHolder> getMatcher(Template template, UrlRewriteRuleProcessorHolder holder) {
+  private Matcher<UrlRewriteRuleProcessorHolder> getMatcher(UrlRewriteRuleProcessorHolder holder) {
     String scope = holder.getScope();
     if (!matchers.containsKey(scope)) {
       matchers.put(scope, new Matcher<>());

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
index 219a8cf..0d36d6d 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
@@ -96,7 +96,7 @@ public class FrontendFunctionProcessor implements UrlRewriteFunctionProcessor<Fr
 
     private String paramName;
 
-    private ParamResolver( String paramName ) {
+    ParamResolver( String paramName ) {
       this.paramName = paramName;
     }
 
@@ -104,14 +104,13 @@ public class FrontendFunctionProcessor implements UrlRewriteFunctionProcessor<Fr
     public List<String> resolve( UrlRewriteContext context, List<String> parameter ) throws Exception {
       return context.getParameters().resolve( paramName );
     }
-
   }
 
   private static class FixedResolver implements UrlRewriteResolver {
 
     private List<String> fixedValues;
 
-    private FixedResolver( String... fixedValues ) {
+    FixedResolver( String... fixedValues ) {
       this.fixedValues = Arrays.asList( fixedValues );
     }
 
@@ -119,7 +118,5 @@ public class FrontendFunctionProcessor implements UrlRewriteFunctionProcessor<Fr
     public List<String> resolve( UrlRewriteContext context, List<String> parameter ) throws Exception {
       return fixedValues;
     }
-
   }
-
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 a2ad19f..b92dfaf 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
@@ -67,7 +67,6 @@ public class UrlRewriteRequest extends GatewayRequestWrapper implements Resolver
   private String bodyFilterName;
   private String headersFilterName;
   private UrlRewriteFilterContentDescriptor headersFilterConfig;
-  private String cookiesFilterName;
 
   /**
    * Constructs a request object wrapping the given request.
@@ -84,7 +83,6 @@ public class UrlRewriteRequest extends GatewayRequestWrapper implements Resolver
     this.bodyFilterName = config.getInitParameter( UrlRewriteServletFilter.REQUEST_BODY_FILTER_PARAM );
     this.headersFilterName = config.getInitParameter( UrlRewriteServletFilter.REQUEST_HEADERS_FILTER_PARAM );
     this.headersFilterConfig = getRewriteFilterConfig( headersFilterName, UrlRewriteServletFilter.HEADERS_MIME_TYPE );
-    this.cookiesFilterName = config.getInitParameter( UrlRewriteServletFilter.REQUEST_COOKIES_FILTER_PARAM );
   }
 
   Template getSourceUrl() {
@@ -182,7 +180,7 @@ public class UrlRewriteRequest extends GatewayRequestWrapper implements Resolver
   @Override
   public String getHeader( String name ) {
     String value;
-    if (name.equalsIgnoreCase("Host")) {
+    if ("Host".equalsIgnoreCase(name)) {
       String uri = getRequestURI();
       try {
         URL url = new URL(uri);
@@ -222,7 +220,7 @@ public class UrlRewriteRequest extends GatewayRequestWrapper implements Resolver
     private Enumeration<String> delegate;
     private String rule;
 
-    private EnumerationRewriter( UrlRewriter rewriter, Enumeration<String> delegate, String rule ) {
+    EnumerationRewriter( UrlRewriter rewriter, Enumeration<String> delegate, String rule ) {
       this.rewriter = rewriter;
       this.delegate = delegate;
       this.rule = rule;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 1efcb40..aa1effb 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
@@ -87,7 +87,6 @@ public class UrlRewriteResponse extends GatewayResponseWrapper implements Params
   private String bodyFilterName;
   private String headersFilterName;
   private UrlRewriteFilterContentDescriptor headersFilterConfig;
-  private String cookiesFilterName;
   private String xForwardedHostname;
   private String xForwardedPort;
   private String xForwardedScheme;
@@ -103,7 +102,6 @@ public class UrlRewriteResponse extends GatewayResponseWrapper implements Params
     this.bodyFilterName = config.getInitParameter( UrlRewriteServletFilter.RESPONSE_BODY_FILTER_PARAM );
     this.headersFilterName = config.getInitParameter( UrlRewriteServletFilter.RESPONSE_HEADERS_FILTER_PARAM );
     this.headersFilterConfig = getRewriteFilterConfig( rewriter.getConfig(), headersFilterName, UrlRewriteServletFilter.HEADERS_MIME_TYPE );
-    this.cookiesFilterName = config.getInitParameter( UrlRewriteServletFilter.RESPONSE_COOKIES_FILTER_PARAM );
   }
 
   protected boolean ignoreHeader( String name ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 60005fe..877c753 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
@@ -31,9 +31,6 @@ import org.apache.knox.gateway.filter.rewrite.i18n.UrlRewriteMessages;
 import org.apache.knox.gateway.filter.rewrite.impl.UrlRewriteFilterReader;
 import org.apache.knox.gateway.filter.rewrite.impl.UrlRewriteUtil;
 import org.apache.knox.gateway.i18n.messages.MessagesFactory;
-import org.apache.knox.gateway.util.XmlUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
 
 import javax.xml.namespace.QName;
 import javax.xml.parsers.ParserConfigurationException;
@@ -56,7 +53,6 @@ public abstract class HtmlFilterReaderBase extends Reader implements
 
   private static final UrlRewriteMessages LOG = MessagesFactory.get( UrlRewriteMessages.class );
 
-  private Document document;
   private Stack<Level> stack;
   private Reader reader;
   private StreamedSource parser;
@@ -69,7 +65,6 @@ public abstract class HtmlFilterReaderBase extends Reader implements
 
   protected HtmlFilterReaderBase( Reader reader ) throws IOException, ParserConfigurationException {
     this.reader = reader;
-    document = XmlUtils.createDocument( false );
     stack = new Stack<>();
     parser = new StreamedSource( reader );
     iterator = parser.iterator();
@@ -148,7 +143,6 @@ public abstract class HtmlFilterReaderBase extends Reader implements
 
   private void processStartTag( StartTag tag ) {
     if( "<".equals( tag.getTagType().getStartDelimiter() ) ) {
-      Element e = document.createElement( tag.getNameSegment().toString() );
       stack.push( new Level( tag ) );
       writer.write( "<" );
       writer.write( tag.getNameSegment().toString() );
@@ -244,23 +238,12 @@ public abstract class HtmlFilterReaderBase extends Reader implements
     stack.clear();
   }
 
-  private String getNamespace( String prefix ) {
-    String namespace = null;
-    for( Level level : stack ) {
-      namespace = level.getNamespace( prefix );
-      if( namespace != null ) {
-        break;
-      }
-    }
-    return namespace;
-  }
-
   private static class Level {
     private StartTag tag;
     private QName name;
     private Map<String,String> namespaces;
 
-    private Level( StartTag tag ) {
+    Level( StartTag tag ) {
       this.tag = tag;
       this.name = null;
       this.namespaces = null;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/javascript/JavaScriptFilterReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/javascript/JavaScriptFilterReader.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/javascript/JavaScriptFilterReader.java
index 84a61b9..c2f502d 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/javascript/JavaScriptFilterReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/javascript/JavaScriptFilterReader.java
@@ -19,10 +19,8 @@ package org.apache.knox.gateway.filter.rewrite.impl.javascript;
 
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterContentDescriptor;
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterPathDescriptor;
-import org.apache.knox.gateway.filter.rewrite.i18n.UrlRewriteMessages;
 import org.apache.knox.gateway.filter.rewrite.impl.UrlRewriteFilterReader;
 import org.apache.knox.gateway.filter.rewrite.impl.UrlRewriteUtil;
-import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -34,8 +32,6 @@ public abstract class JavaScriptFilterReader extends Reader implements UrlRewrit
 
   private static final UrlRewriteFilterPathDescriptor.Compiler<Pattern> REGEX_COMPILER = new RegexCompiler();
 
-  private static final UrlRewriteMessages LOG = MessagesFactory.get( UrlRewriteMessages.class );
-
   private BufferedReader reader;
   private int offset;
   private StringWriter writer;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
index 7afab15..d3592c3 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
@@ -621,7 +621,7 @@ class JsonFilterReader extends Reader {
     JsonNode node;
     JsonNode scopeNode;
     UrlRewriteFilterGroupDescriptor scopeConfig;
-    private Level( String field, JsonNode node, JsonNode scopeNode, UrlRewriteFilterGroupDescriptor scopeConfig ) {
+    Level( String field, JsonNode node, JsonNode scopeNode, UrlRewriteFilterGroupDescriptor scopeConfig ) {
       this.field = field;
       this.node = node;
       this.scopeNode = scopeNode;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
index 379d9f0..38aab4b 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlFilterReader.java
@@ -25,9 +25,7 @@ import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterDetectDescript
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterGroupDescriptor;
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterPathDescriptor;
 import org.apache.knox.gateway.filter.rewrite.api.UrlRewriteFilterScopeDescriptor;
-import org.apache.knox.gateway.filter.rewrite.i18n.UrlRewriteMessages;
 import org.apache.knox.gateway.filter.rewrite.i18n.UrlRewriteResources;
-import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.i18n.resources.ResourcesFactory;
 import org.apache.knox.gateway.util.XmlUtils;
 import org.w3c.dom.Attr;
@@ -73,7 +71,6 @@ public abstract class XmlFilterReader extends Reader {
 
   private static final String DEFAULT_XML_VERSION = "1.0";
 
-  private static final UrlRewriteMessages LOG = MessagesFactory.get( UrlRewriteMessages.class );
   private static final UrlRewriteFilterPathDescriptor.Compiler<XPathExpression> XPATH_COMPILER = new XmlPathCompiler();
   private static final UrlRewriteFilterPathDescriptor.Compiler<Pattern> REGEX_COMPILER = new RegexCompiler();
 
@@ -192,7 +189,7 @@ public abstract class XmlFilterReader extends Reader {
     String s;
 
     document = XmlUtils.createDocument( false );
-    pushLevel( null, event, document, document, config );
+    pushLevel( null, document, document, config );
 
     writer.write( "<?xml" );
 
@@ -234,7 +231,7 @@ public abstract class XmlFilterReader extends Reader {
     // If already buffering just continue to do so.
     // Note: Don't currently support nested buffer or scope descriptors.
     if( currentlyBuffering() ) {
-      pushLevel( parent, event, element, parent.scopeNode, parent.scopeConfig );
+      pushLevel( parent, element, parent.scopeNode, parent.scopeConfig );
       bufferAttributes( event, element );
     // Else not currently buffering
     } else {
@@ -243,22 +240,22 @@ public abstract class XmlFilterReader extends Reader {
       if( descriptor != null ) {
         // If this is a buffer descriptor then switch to buffering and buffer the attributes.
         if( descriptor instanceof UrlRewriteFilterBufferDescriptor ) {
-          pushLevel( parent, event, element, element, (UrlRewriteFilterBufferDescriptor)descriptor );
+          pushLevel( parent, element, element, (UrlRewriteFilterBufferDescriptor)descriptor );
           bufferAttributes( event, element );
         // Otherwise if this is a scope descriptor then change the scope and stream the attributes.
         } else if( descriptor instanceof UrlRewriteFilterScopeDescriptor ) {
-          pushLevel( parent, event, element, element, (UrlRewriteFilterScopeDescriptor)descriptor );
+          pushLevel( parent, element, element, (UrlRewriteFilterScopeDescriptor)descriptor );
           streamElement( event, element );
         // Else found an unexpected matching path.
         } else {
           // This is likely because there is an <apply> targeted at the text of an element.
           // That "convenience" config will be taken care of in the streamElement() processing.
-          pushLevel( parent, event, element, parent.scopeNode, parent.scopeConfig );
+          pushLevel( parent, element, parent.scopeNode, parent.scopeConfig );
           streamElement( event, element );
         }
       // If there is no matching path descriptor then continue streaming.
       } else {
-        pushLevel( parent, event, element, parent.scopeNode, parent.scopeConfig );
+        pushLevel( parent, element, parent.scopeNode, parent.scopeConfig );
         streamElement( event, element );
       }
     }
@@ -586,23 +583,19 @@ public abstract class XmlFilterReader extends Reader {
     return stack.peek().buffered;
   }
 
-  private Level pushLevel( Level parent, XMLEvent event, Node node, Node scopeNode, UrlRewriteFilterGroupDescriptor scopeConfig ) {
-    Level level = new Level( parent, event, node, scopeNode, scopeConfig );
+  private Level pushLevel( Level parent, Node node, Node scopeNode, UrlRewriteFilterGroupDescriptor scopeConfig ) {
+    Level level = new Level( parent, node, scopeNode, scopeConfig );
     stack.push( level );
     return level;
   }
 
   private static class Level {
-//    private Level parent;
-//    private XMLEvent event;
     private Node node;
     private UrlRewriteFilterGroupDescriptor scopeConfig;
     private Node scopeNode;
     private boolean buffered;
 
-    private Level( Level parent, XMLEvent event, Node node, Node scopeNode, UrlRewriteFilterGroupDescriptor scopeConfig ) {
-//      this.parent = parent;
-//      this.event = event;
+    Level( Level parent, Node node, Node scopeNode, UrlRewriteFilterGroupDescriptor scopeConfig ) {
       this.node = node;
       this.scopeConfig = scopeConfig;
       this.scopeNode = scopeNode;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlUrlRewriteFilterReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlUrlRewriteFilterReader.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlUrlRewriteFilterReader.java
index 5dddb62..ff98bb1 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlUrlRewriteFilterReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/xml/XmlUrlRewriteFilterReader.java
@@ -49,7 +49,7 @@ public class XmlUrlRewriteFilterReader extends XmlFilterReader {
   }
 
   //TODO: Need to limit which values are attempted to be filtered by the name.
-  private String filterValueString( String name, String value, String rule ) {
+  private String filterValueString( String value, String rule ) {
     try {
       Template input = Parser.parseLiteral( value );
       if( input != null ) {
@@ -70,11 +70,11 @@ public class XmlUrlRewriteFilterReader extends XmlFilterReader {
 
   @Override
   protected String filterAttribute( QName elementName, QName attributeName, String attributeValue, String ruleName ) {
-    return filterValueString( attributeName.getLocalPart(), attributeValue, ruleName );
+    return filterValueString( attributeValue, ruleName );
   }
 
   @Override
   protected String filterText( QName elementName, String text, String ruleName ) {
-    return filterValueString( elementName.getLocalPart(), text, ruleName );
+    return filterValueString( text, ruleName );
   }
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index df5572a..6c7e8ff 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/knox/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -183,7 +183,7 @@ public class UrlRewriteServletFilterTest {
 //  @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
 //  @Test
 //  public void testRequestCookieRewrite() throws Exception {
-//    setUp( null );
+//    setUpAndReturnOriginalAppenders( null );
 //    // Setup the server side request/response interaction.
 //    interaction.expect()
 //        .method( "GET" )
@@ -210,7 +210,7 @@ public class UrlRewriteServletFilterTest {
 //  @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
 //  @Test
 //  public void testResponseCookieRewrite() throws Exception {
-//    setUp( null );
+//    setUpAndReturnOriginalAppenders( null );
 //    // Setup the server side request/response interaction.
 //    interaction.expect()
 //        .method( "GET" )
@@ -526,7 +526,7 @@ public class UrlRewriteServletFilterTest {
 
   @Test
   public void testRequestXmlBodyRewriteWithFilterInitParamForInvalidFilterConfig() throws Exception {
-    Enumeration<Appender> realAppenders = NoOpAppender.setUp();
+    Enumeration<Appender> realAppenders = NoOpAppender.setUpAndReturnOriginalAppenders();
     try {
 
       Map<String,String> initParams = new HashMap<>();
@@ -559,7 +559,7 @@ public class UrlRewriteServletFilterTest {
       // Test the results.
       assertThat( response.getStatus(), is( 500 ) );
     } finally {
-      NoOpAppender.tearDown( realAppenders );
+      NoOpAppender.resetOriginalAppenders( realAppenders );
     }
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java b/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
index 603dfe8..7afba8d 100644
--- a/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
+++ b/gateway-provider-security-authz-acls/src/main/java/org/apache/knox/gateway/filter/AclParser.java
@@ -19,6 +19,7 @@ package org.apache.knox.gateway.filter;
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 
 import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.util.IpAddressValidator;
@@ -26,8 +27,8 @@ import org.apache.knox.gateway.util.IpAddressValidator;
 public class AclParser {
   private static AclsAuthorizationMessages log = MessagesFactory.get( AclsAuthorizationMessages.class );
 
-  public ArrayList<String> users;
-  public ArrayList<String> groups;
+  public List<String> users;
+  public List<String> groups;
   public boolean anyUser = true;
   public boolean anyGroup = true;
   public IpAddressValidator ipv;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 d0d1629..337c3d7 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
@@ -53,8 +53,8 @@ public class AclsAuthorizationFilter implements Filter {
   private String resourceRole;
   private String aclProcessingMode;
   private AclParser parser = new AclParser();
-  private ArrayList<String> adminGroups = new ArrayList<>();
-  private ArrayList<String> adminUsers = new ArrayList<>();
+  private List<String> adminGroups = new ArrayList<>();
+  private List<String> adminUsers = new ArrayList<>();
 
   @Override
   public void init(FilterConfig filterConfig) throws ServletException {

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 0602928..9afb21e 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
@@ -37,8 +37,6 @@ import org.apache.knox.gateway.services.security.token.impl.JWT;
 import org.apache.knox.gateway.util.JsonUtils;
 
 public class JWTAuthCodeAssertionFilter extends AbstractIdentityAssertionFilter {
-  private static final String BEARER = "Bearer ";
-
   private JWTokenAuthority authority;
 
   private ServiceRegistry sr;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 02e1064..c2eeb81 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
@@ -46,7 +46,6 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -218,7 +217,6 @@ public class Pac4jDispatcherFilter implements Filter {
   public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
 
     final HttpServletRequest request = (HttpServletRequest) servletRequest;
-    final HttpServletResponse response = (HttpServletResponse) servletResponse;
     request.setAttribute(PAC4J_CONFIG, securityFilter.getConfig());
 //    final J2EContext context = new J2EContext(request, response, securityFilter.getConfig().getSessionStore());
 

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 7aedeca..1352a25 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
@@ -560,13 +560,13 @@ public class KnoxLdapRealm extends JndiLdapRealm {
     LdapName searchBaseDn = new LdapName(searchBaseString);
 
     // do scope test
-    if (searchScope.equalsIgnoreCase("base")) {
+    if ("base".equalsIgnoreCase(searchScope)) {
       return false;
     }
     if (!userLdapDn.toString().endsWith(searchBaseDn.toString())) {
       return false;
     }
-    if (searchScope.equalsIgnoreCase("one")
+    if ("one".equalsIgnoreCase(searchScope)
         && (userLdapDn.size() != searchBaseDn.size() - 1)) {
       return false;
     }
@@ -578,7 +578,7 @@ public class KnoxLdapRealm extends JndiLdapRealm {
     try {
       searchResultEnum = systemLdapCtx
         .search(userLdapDn, searchFilter,
-            searchScope.equalsIgnoreCase("sub") ? SUBTREE_SCOPE
+            "sub".equalsIgnoreCase(searchScope) ? SUBTREE_SCOPE
                 : ONELEVEL_SCOPE);
       if (searchResultEnum.hasMore()) {
         return true;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/XForwardedHeaderRequestWrapper.java
----------------------------------------------------------------------
diff --git a/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/XForwardedHeaderRequestWrapper.java b/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/XForwardedHeaderRequestWrapper.java
index 0ed303d..ba8867d 100644
--- a/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/XForwardedHeaderRequestWrapper.java
+++ b/gateway-server-xforwarded-filter/src/main/java/org/apache/knox/gateway/filter/XForwardedHeaderRequestWrapper.java
@@ -21,8 +21,10 @@ import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 public class XForwardedHeaderRequestWrapper extends GatewayRequestWrapper {
 
@@ -38,7 +40,7 @@ public class XForwardedHeaderRequestWrapper extends GatewayRequestWrapper {
   private static final String X_FORWARDED_SERVER_LOWER = X_FORWARDED_SERVER.toLowerCase(Locale.ROOT);
   private static final String X_FORWARDED_CONTEXT = "X-Forwarded-Context";
   private static final String X_FORWARDED_CONTEXT_LOWER = X_FORWARDED_CONTEXT.toLowerCase(Locale.ROOT);
-  private static final ArrayList<String> headerNames = new ArrayList<>();
+  private static final List<String> headerNames = new ArrayList<>();
 
   static {
     headerNames.add(X_FORWARDED_FOR);
@@ -49,7 +51,7 @@ public class XForwardedHeaderRequestWrapper extends GatewayRequestWrapper {
     headerNames.add(X_FORWARDED_CONTEXT);
   }
 
-  Hashtable<String,String> proxyHeaders = new Hashtable<>();
+  Map<String,String> proxyHeaders = new HashMap<>();
 
   public XForwardedHeaderRequestWrapper(HttpServletRequest request) {
     super( request );

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 6403a02..aabce03 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
@@ -226,11 +226,6 @@ public class GatewayFilter implements Filter {
     addHolder( holder );
   }
 
-//  public void addFilter( String path, String name, Class<RegexDirFilter> clazz, Map<String,String> params ) throws URISyntaxException {
-//    Holder holder = new Holder( path, name, clazz, params );
-//    addHolder( holder );
-//  }
-
   public void addFilter( String path, String name, String clazz, Map<String,String> params, String resourceRole ) throws URISyntaxException {
     Holder holder = new Holder( path, name, clazz, params, resourceRole );
     addHolder( holder );
@@ -253,11 +248,11 @@ public class GatewayFilter implements Filter {
     private List<Holder> chain;
     private String resourceRole;
 
-    private Chain() {
+    Chain() {
       this.chain = new ArrayList<>();
     }
 
-    private Chain( List<Holder> chain ) {
+    Chain( List<Holder> chain ) {
       this.chain = chain;
     }
 
@@ -289,7 +284,6 @@ public class GatewayFilter implements Filter {
   }
 
   private class Holder implements Filter, FilterConfig {
-//    private String path;
     private Template template;
     private String name;
     private Map<String,String> params;
@@ -298,8 +292,7 @@ public class GatewayFilter implements Filter {
     private String type;
     private String resourceRole;
 
-    private Holder( String path, String name, Filter filter, Map<String,String> params, String resourceRole ) throws URISyntaxException {
-//      this.path = path;
+    Holder( String path, String name, Filter filter, Map<String,String> params, String resourceRole ) throws URISyntaxException {
       this.template = Parser.parseTemplate( path );
       this.name = name;
       this.params = params;
@@ -309,18 +302,7 @@ public class GatewayFilter implements Filter {
       this.resourceRole = resourceRole;
     }
 
-//    private Holder( String path, String name, Class<RegexDirFilter> clazz, Map<String,String> params ) throws URISyntaxException {
-//      this.path = path;
-//      this.template = Parser.parse( path );
-//      this.name = name;
-//      this.params = params;
-//      this.instance = null;
-//      this.clazz = clazz;
-//      this.type = clazz.getCanonicalName();
-//    }
-
-    private Holder( String path, String name, String clazz, Map<String,String> params, String resourceRole ) throws URISyntaxException {
-//      this.path = path;
+    Holder( String path, String name, String clazz, Map<String,String> params, String resourceRole ) throws URISyntaxException {
       this.template = Parser.parseTemplate( path );
       this.name = name;
       this.params = params;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 403c5fe..c24b14f 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
@@ -23,7 +23,6 @@ import org.apache.knox.gateway.audit.api.AuditServiceFactory;
 import org.apache.knox.gateway.audit.api.Auditor;
 import org.apache.knox.gateway.audit.api.ResourceType;
 import org.apache.knox.gateway.audit.log4j.audit.AuditConstants;
-import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.i18n.resources.ResourcesFactory;
 
 import javax.servlet.RequestDispatcher;
@@ -42,7 +41,6 @@ public class GatewayForwardingServlet extends HttpServlet{
   private static final String AUDIT_ACTION = "forward";
 
   private static final GatewayResources RES = ResourcesFactory.get( GatewayResources.class );
-  private static final GatewayMessages LOG = MessagesFactory.get( GatewayMessages.class );
 
   private static AuditService auditService = AuditServiceFactory.getAuditService();
   private static Auditor auditor = AuditServiceFactory.getAuditService()

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 2c80c81..023956c 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
@@ -310,25 +310,21 @@ public class GatewayServer {
       services.start();
       DeploymentFactory.setGatewayServices(services);
       server.start();
-      // Coverity CID 1352654
-      URI uri = server.jetty.getURI();
 
       // Logging for topology <-> port
-      InetSocketAddress[] addresses = new InetSocketAddress[server.jetty
-          .getConnectors().length];
-      for (int i = 0, n = addresses.length; i < n; i++) {
-        NetworkConnector connector = (NetworkConnector) server.jetty
-            .getConnectors()[i];
-        if (connector != null) {
-          for(ConnectionFactory x  : connector.getConnectionFactories()) {
-            if(x instanceof HttpConnectionFactory) {
-                ((HttpConnectionFactory)x).getHttpConfiguration().setSendServerVersion(config.isGatewayServerHeaderEnabled());
+      Connector[] connectors = server.jetty.getConnectors();
+      for (Connector connector : connectors) {
+        NetworkConnector networkConnector = (NetworkConnector) connector;
+        if (networkConnector != null) {
+          for (ConnectionFactory x : networkConnector.getConnectionFactories()) {
+            if (x instanceof HttpConnectionFactory) {
+              ((HttpConnectionFactory) x).getHttpConfiguration().setSendServerVersion(config.isGatewayServerHeaderEnabled());
             }
           }
-          if (connector.getName() == null) {
-            log.startedGateway(connector.getLocalPort());
+          if (networkConnector.getName() == null) {
+            log.startedGateway(networkConnector.getLocalPort());
           } else {
-            log.startedGateway(connector.getName(), connector.getLocalPort());
+            log.startedGateway(networkConnector.getName(), networkConnector.getLocalPort());
           }
         }
       }
@@ -338,10 +334,6 @@ public class GatewayServer {
   }
 
   public GatewayServer( GatewayConfig config ) {
-    this(config, null);
-  }
-
-  public GatewayServer( GatewayConfig config, Properties options ) {
       this.config = config;
       this.listener = new InternalTopologyListener();
   }
@@ -748,10 +740,10 @@ public class GatewayServer {
         for( Application application : applications ) {
           List<String> urls = application.getUrls();
           if( urls == null || urls.isEmpty() ) {
-            internalDeployApplication( topology, topoDir, application, application.getName() );
+            internalDeployApplication( topoDir, application, application.getName() );
           } else {
             for( String url : urls ) {
-              internalDeployApplication( topology, topoDir, application, url );
+              internalDeployApplication( topoDir, application, url );
             }
           }
         }
@@ -759,7 +751,7 @@ public class GatewayServer {
     }
   }
 
-  private synchronized void internalDeployApplication( Topology topology, File topoDir, Application application, String url ) throws IOException, ZipException, TransformerException, SAXException, ParserConfigurationException {
+  private synchronized void internalDeployApplication( File topoDir, Application application, String url ) throws IOException, ZipException, TransformerException, SAXException, ParserConfigurationException {
     File appsDir = new File( config.getGatewayApplicationsDir() );
     File appDir = new File( appsDir, application.getName() );
     File[] implFiles = appDir.listFiles( new RegexFilenameFilter( "app|app\\..*" ) );
@@ -774,7 +766,7 @@ public class GatewayServer {
     createArchiveTempDir( warDir );
   }
 
-  private synchronized void internalActivateTopology( Topology topology, File topoDir ) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException {
+  private synchronized void internalActivateTopology( Topology topology, File topoDir ) {
     log.activatingTopology( topology.getName() );
     File[] files = topoDir.listFiles( new RegexFilenameFilter( "%.*" ) );
     if( files != null ) {
@@ -784,7 +776,7 @@ public class GatewayServer {
     }
   }
 
-  private synchronized void internalActivateArchive( Topology topology, File warDir ) throws IOException, ZipException, ParserConfigurationException, TransformerException, SAXException {
+  private synchronized void internalActivateArchive( Topology topology, File warDir ) {
     log.activatingTopologyArchive( topology.getName(), warDir.getName() );
     try {
       WebAppContext newContext = createWebAppContext( topology, warDir, Urls.decode( warDir.getName() ) );
@@ -844,7 +836,6 @@ public class GatewayServer {
       }
     }
     deactivate.clear();
-
   }
 
   // Using an inner class to hide the handleTopologyEvent method from consumers of GatewayServer.
@@ -918,7 +909,6 @@ public class GatewayServer {
         log.failedToDeployTopology( topology.getName(), e );
       }
     }
-
   }
 
   private File createArchiveTempDir( File warDir ) {
@@ -953,12 +943,12 @@ public class GatewayServer {
     return new File( calculateAbsoluteDeploymentsDir(), calculateDeploymentName( topology ) );
   }
 
-  private String calculateDeploymentExtension( Topology topology ) {
+  private String calculateDeploymentExtension() {
     return ".topo.";
   }
 
   private String calculateDeploymentName( Topology topology ) {
-    return topology.getName() + calculateDeploymentExtension( topology ) + Long.toHexString( topology.getTimestamp() );
+    return topology.getName() + calculateDeploymentExtension() + Long.toHexString( topology.getTimestamp() );
   }
 
   private static void checkAddressAvailability( InetSocketAddress address ) throws IOException {
@@ -1001,23 +991,13 @@ public class GatewayServer {
   }
 
   private static class FileModificationTimeDescendingComparator implements Comparator<File>, Serializable {
-    /**
-     *
-     */
     private static final long serialVersionUID = -2269785204848916823L;
 
     @Override
     public int compare( File left, File right ) {
       long leftTime = ( left == null ? Long.MIN_VALUE : left.lastModified() );
       long rightTime = ( right == null ? Long.MIN_VALUE : right.lastModified() );
-      if( leftTime > rightTime ) {
-        return -1;
-      } else if ( leftTime < rightTime ) {
-        return 1;
-      } else {
-        return 0;
-      }
+      return Long.compare(rightTime, leftTime);
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServlet.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServlet.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServlet.java
index 1f63f90..ee2558f 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServlet.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayServlet.java
@@ -255,7 +255,7 @@ public class GatewayServlet implements Servlet, Filter {
 
     private ServletConfig config;
 
-    private FilterConfigAdapter( ServletConfig config ) {
+    FilterConfigAdapter( ServletConfig config ) {
       this.config = config;
     }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java b/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
index 8a613fe..62d70a0 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/config/impl/GatewayConfigImpl.java
@@ -252,10 +252,6 @@ public class GatewayConfigImpl extends Configuration implements GatewayConfig {
     return get(GATEWAY_HOME_VAR, System.getProperty(GATEWAY_HOME_VAR, System.getenv(GATEWAY_HOME_VAR)));
   }
 
-  private void setGatewayHomeDir( String dir ) {
-    set( GATEWAY_HOME_VAR, dir );
-  }
-
   @Override
   public String getGatewayConfDir() {
     String value = getVar( GATEWAY_CONF_HOME_VAR, getGatewayHomeDir() + File.separator + "conf"  );

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 00574af..4496fb5 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
@@ -92,7 +92,7 @@ public class ApplicationDeploymentContributor extends ServiceDeploymentContribut
     return definition;
   }
 
-  private static UrlRewriteRulesDescriptor loadRewriteRules( Application application, File file ) throws IOException {
+  private static UrlRewriteRulesDescriptor loadRewriteRules( File file ) throws IOException {
     UrlRewriteRulesDescriptor rules;
     if( !file.exists() ) {
       rules = UrlRewriteRulesDescriptorFactory.load( "xml", new StringReader( "<rules/>" ) );
@@ -113,7 +113,7 @@ public class ApplicationDeploymentContributor extends ServiceDeploymentContribut
       File serviceFile = new File( appDir, SERVICE_DEFINITION_FILE_NAME );
       File rewriteFile = new File( appDir, REWRITE_RULES_FILE_NAME );
       serviceDefinition = loadServiceDefinition( application, serviceFile );
-      serviceRules = loadRewriteRules( application, rewriteFile );
+      serviceRules = loadRewriteRules( rewriteFile );
     } catch ( IOException | JAXBException e ) {
       throw new DeploymentException( "Failed to deploy application: " + application.getName(), e );
     }
@@ -136,11 +136,11 @@ public class ApplicationDeploymentContributor extends ServiceDeploymentContribut
 
   @Override
   public void contributeService(DeploymentContext context, Service service) throws Exception {
-    contributeRewriteRules(context, service);
+    contributeRewriteRules(context);
     contributeResources(context, service);
   }
 
-  private void contributeRewriteRules(DeploymentContext context, Service service) {
+  private void contributeRewriteRules(DeploymentContext context) {
     if ( serviceRules != null ) {
       UrlRewriteRulesDescriptor clusterRules = context.getDescriptor("rewrite");
       // Coverity CID 1352312

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
index c4f3af2..63b22a5 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
@@ -89,11 +89,11 @@ public class ServiceDefinitionDeploymentContributor extends ServiceDeploymentCon
 
   @Override
   public void contributeService(DeploymentContext context, Service service) throws Exception {
-    contributeRewriteRules(context, service);
+    contributeRewriteRules(context);
     contributeResources(context, service);
   }
 
-  private void contributeRewriteRules(DeploymentContext context, Service service) {
+  private void contributeRewriteRules(DeploymentContext context) {
     if ( serviceRules != null ) {
       UrlRewriteRulesDescriptor clusterRules = context.getDescriptor("rewrite");
       clusterRules.addRules(serviceRules);
@@ -160,7 +160,7 @@ public class ServiceDefinitionDeploymentContributor extends ServiceDeploymentCon
         context.contributeFilter(service, resource, role, policyBinding.getName(), null);
       }
       /* handle the case where topology has federation provider but service defines Anonymous authentication see KNOX-1197 */
-      else if (role.equalsIgnoreCase("authentication") && topologyContainsProviderType(context, "federation")) {
+      else if ("authentication".equalsIgnoreCase(role) && topologyContainsProviderType(context, "federation")) {
         context.contributeFilter(service, resource, role, policyBinding.getName(), null);
       }
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorRules.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorRules.java b/gateway-server/src/main/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorRules.java
index c9790ae..ff91b99 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorRules.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/descriptor/xml/XmlGatewayDescriptorRules.java
@@ -25,12 +25,10 @@ import org.apache.commons.digester3.binder.AbstractRulesModule;
 import org.xml.sax.Attributes;
 
 public class XmlGatewayDescriptorRules extends AbstractRulesModule implements XmlGatewayDescriptorTags {
-
   private static final Object[] NO_PARAMS = new Object[0];
 
   @Override
   protected void configure() {
-
     forPattern( GATEWAY ).addRule( new FactoryCreateRule( XmlGatewayDescriptorFactory.class ) );
     forPattern( GATEWAY + "/" + RESOURCE ).addRule( new AddNextRule( "addResource" ) );
     forPattern( GATEWAY + "/" + RESOURCE + "/" + RESOURCE_ROLE ).callMethod( "role" ).usingElementBodyAsArgument();
@@ -45,10 +43,9 @@ public class XmlGatewayDescriptorRules extends AbstractRulesModule implements Xm
   }
 
   private static class AddNextRule extends Rule {
-
     private String method;
 
-    private AddNextRule( String method ) {
+    AddNextRule( String method ) {
       this.method = method;
     }
 
@@ -62,7 +59,5 @@ public class XmlGatewayDescriptorRules extends AbstractRulesModule implements Xm
     public void end( String namespace, String name ) {
       getDigester().pop();
     }
-
   }
-
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/filter/BasicAuthChallengeFilter.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/filter/BasicAuthChallengeFilter.java b/gateway-server/src/main/java/org/apache/knox/gateway/filter/BasicAuthChallengeFilter.java
index 1c005d3..3fbe96f 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/filter/BasicAuthChallengeFilter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/filter/BasicAuthChallengeFilter.java
@@ -17,66 +17,16 @@
  */
 package org.apache.knox.gateway.filter;
 
-import org.apache.commons.codec.binary.Base64;
-import org.apache.http.auth.AUTH;
-import org.apache.http.auth.UsernamePasswordCredentials;
-
 import javax.servlet.FilterChain;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.nio.charset.StandardCharsets;
 
 //TODO: Remove the Authenticate header from the expect so that downstream filters and dispatch don't see it.
 public class BasicAuthChallengeFilter extends AbstractGatewayFilter {
 
   @Override
   public void doFilter( HttpServletRequest request, HttpServletResponse response, FilterChain chain ) throws IOException, ServletException {
-
-//KAM:2013014[ Removing due to dependency issues.  This class isn't used anyway
-//    boolean challenge = false;
-//
-//    // If the user isn't already authenticated.
-//    if( Subject.getSubject( AccessController.getContext() ) == null ) {
-//      UsernamePasswordCredentials credentials = createValidatedCredentials( request );
-//      if( credentials == null ) {
-//        challenge = true;
-//      } else {
-//        setUserCredentials( request, credentials );
-//      }
-//    }
-//    if( challenge ) {
-//      response.setHeader( AUTH.WWW_AUTH, "Basic realm=\"" + getConfig().getInitParameter( "realm" ) + "\"" );
-//      response.sendError( HttpServletResponse.SC_UNAUTHORIZED );
-//    } else {
-//      chain.doFilter( request, response );
-//      if( HttpServletResponse.SC_UNAUTHORIZED == response.getStatus() &&
-//          response.getHeader( AUTH.WWW_AUTH ) == null ) {
-//        response.setHeader( AUTH.WWW_AUTH, "Basic realm=\"" + getConfig().getInitParameter( "realm" ) + "\"" );
-//      }
-//    }
-
-  }
-
-  private static UsernamePasswordCredentials createValidatedCredentials( HttpServletRequest request ) {
-    UsernamePasswordCredentials credentials = null;
-    String basicAuthResponse = request.getHeader( AUTH.WWW_AUTH_RESP );
-    if( basicAuthResponse != null ) {
-      String[] parts = basicAuthResponse.split( " " );
-      if( parts.length == 2 ) {
-        String usernamePassword = new String( Base64.decodeBase64( parts[1] ), StandardCharsets.UTF_8);
-        parts = usernamePassword.split( ":" );
-        if( parts.length == 2 ) {
-          String username = parts[0];
-          String password = parts[1];
-          if(!username.isEmpty() && !password.isEmpty()) {
-            credentials = new UsernamePasswordCredentials( username, password );
-          }
-        }
-      }
-      //System.out.println( basicAuthResponse );
-    }
-    return credentials;
   }
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/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 5214928..954ef93 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
@@ -17,12 +17,10 @@
  */
 package org.apache.knox.gateway.services;
 
-import org.apache.knox.gateway.GatewayMessages;
 import org.apache.knox.gateway.config.GatewayConfig;
 import org.apache.knox.gateway.deploy.DeploymentContext;
 import org.apache.knox.gateway.descriptor.FilterParamDescriptor;
 import org.apache.knox.gateway.descriptor.ResourceDescriptor;
-import org.apache.knox.gateway.i18n.messages.MessagesFactory;
 import org.apache.knox.gateway.service.config.remote.RemoteConfigurationRegistryClientServiceFactory;
 import org.apache.knox.gateway.services.config.client.RemoteConfigurationRegistryClientService;
 import org.apache.knox.gateway.services.security.impl.RemoteAliasService;
@@ -39,9 +37,6 @@ import java.util.List;
 import java.util.Map;
 
 public class CLIGatewayServices implements GatewayServices {
-
-  private static GatewayMessages log = MessagesFactory.get( GatewayMessages.class );
-
   private Map<String,Service> services = new HashMap<>();
   private CLIMasterService ms;
   private DefaultKeystoreService ks;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsContext.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsContext.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsContext.java
index bb2f8fe..9f20aa0 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsContext.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsContext.java
@@ -21,12 +21,13 @@ import org.apache.knox.gateway.services.metrics.MetricsContext;
 import org.apache.knox.gateway.services.metrics.MetricsService;
 
 import java.util.HashMap;
+import java.util.Map;
 
 public class DefaultMetricsContext implements MetricsContext {
 
   private MetricsService metricsService;
 
-  private HashMap<String, Object> properties = new HashMap<>();
+  private Map<String, Object> properties = new HashMap<>();
 
   public DefaultMetricsContext(MetricsService metricsService) {
     this.metricsService = metricsService;

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsService.java
index c6bee57..a16d0a9 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/DefaultMetricsService.java
@@ -38,6 +38,7 @@ import org.apache.knox.gateway.services.metrics.MetricsService;
 import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.concurrent.TimeUnit;
@@ -51,7 +52,7 @@ public class DefaultMetricsService implements MetricsService {
 
   private Map<Class<?>, InstrumentationProvider> instrumentationProviders;
 
-  private ArrayList<MetricsReporter> metricsReporters;
+  private List<MetricsReporter> metricsReporters;
 
   private MetricsContext context;
 
@@ -156,7 +157,7 @@ public class DefaultMetricsService implements MetricsService {
     return instrumentationProviders;
   }
 
-  public ArrayList<MetricsReporter> getMetricsReporters() {
+  public List<MetricsReporter> getMetricsReporters() {
     return metricsReporters;
   }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrGatewayFilterProviderDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrGatewayFilterProviderDescriptor.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrGatewayFilterProviderDescriptor.java
index 1df40b2..2a70cd4 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrGatewayFilterProviderDescriptor.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrGatewayFilterProviderDescriptor.java
@@ -26,7 +26,7 @@ import java.util.Map;
 
 public class InstrGatewayFilterProviderDescriptor implements InstrumentationProviderDescriptor {
 
-  private HashMap<Class<?>, InstrumentationProvider> providers;
+  private Map<Class<?>, InstrumentationProvider> providers;
 
   public InstrGatewayFilterProviderDescriptor() {
     providers = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientProviderDescriptor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientProviderDescriptor.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientProviderDescriptor.java
index 6d0aca9..c0c26ae 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientProviderDescriptor.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientProviderDescriptor.java
@@ -27,7 +27,7 @@ import java.util.Map;
 public class InstrHttpClientProviderDescriptor implements
     InstrumentationProviderDescriptor {
 
-  private HashMap<Class<?>, InstrumentationProvider> providers;
+  private Map<Class<?>, InstrumentationProvider> providers;
 
   public InstrHttpClientProviderDescriptor() {
     providers = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
index d15ff45..34f1697 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/DefaultServiceRegistryService.java
@@ -95,7 +95,7 @@ public class DefaultServiceRegistryService implements ServiceRegistry, Service {
     // part one is the code and part two is the signature
     boolean verified = crypto.verify("SHA256withRSA", "gateway-identity", parts[0], Base64.decodeBase64(parts[1]));
     if (verified) {
-      HashMap<String,RegEntry> clusterServices = registry.get(clusterName);
+      Map<String,RegEntry> clusterServices = registry.get(clusterName);
       if (clusterServices == null) {
         synchronized(this) {
           clusterServices = new HashMap<>();
@@ -120,7 +120,7 @@ public class DefaultServiceRegistryService implements ServiceRegistry, Service {
     return rc;
   }
 
-  private String renderAsJsonString(HashMap<String,HashMap<String,RegEntry>> registry) {
+  private String renderAsJsonString(Map<String,Map<String,RegEntry>> registry) {
     String json = null;
     ObjectMapper mapper = new ObjectMapper();
 
@@ -146,7 +146,7 @@ public class DefaultServiceRegistryService implements ServiceRegistry, Service {
   @Override
   public List<String> lookupServiceURLs( String clusterName, String serviceName ) {
     RegEntry entry;
-    HashMap<String, RegEntry> clusterServices = registry.get(clusterName);
+    Map<String, RegEntry> clusterServices = registry.get(clusterName);
     if (clusterServices != null) {
       entry = clusterServices.get(serviceName);
       if( entry != null ) {
@@ -156,7 +156,7 @@ public class DefaultServiceRegistryService implements ServiceRegistry, Service {
     return null;
   }
 
-  private HashMap<String, HashMap<String,RegEntry>> getMapFromJsonString(String json) {
+  private Map<String, Map<String,RegEntry>> getMapFromJsonString(String json) {
     Registry map = null;
     JsonFactory factory = new JsonFactory();
     ObjectMapper mapper = new ObjectMapper(factory);

http://git-wip-us.apache.org/repos/asf/knox/blob/be7f4f37/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/Registry.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/Registry.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/Registry.java
index 640d643..97d4025 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/Registry.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/registry/impl/Registry.java
@@ -18,8 +18,9 @@
 package org.apache.knox.gateway.services.registry.impl;
 
 import java.util.HashMap;
+import java.util.Map;
 
-class Registry extends HashMap<String,HashMap<String,RegEntry>> {
+class Registry extends HashMap<String, Map<String,RegEntry>> {
   private static final long serialVersionUID = 1L;
 
   Registry() {


Mime
View raw message