knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject [knox] branch master updated: KNOX-2122 - Code cleanup from static code analysis (#191)
Date Tue, 12 Nov 2019 21:19:20 GMT
This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b6cee2  KNOX-2122 - Code cleanup from static code analysis (#191)
2b6cee2 is described below

commit 2b6cee2d9081628348e0925a9e7e7b596292eee3
Author: Kevin Risden <risdenk@users.noreply.github.com>
AuthorDate: Tue Nov 12 16:19:11 2019 -0500

    KNOX-2122 - Code cleanup from static code analysis (#191)
    
    * Diamond operator
    * Static method calls instead of on instances
    * Remove null check before instanceof
    * Use computeIfAbsent where possible
    * Remove simple nested if statements
    * Remove redundant cast
    * Use entrySet for iteration of maps
    
    Signed-off-by: Kevin Risden <krisden@apache.org>
---
 .../main/resources/build-tools/pmd/pmd-ruleset.xml |  1 +
 .../security/ldap/SimpleLdapDirectoryServer.java   |  5 +-
 .../ambari/AmbariDynamicServiceURLCreator.java     |  6 +-
 .../discovery/ambari/AmbariServiceDiscovery.java   | 13 ++--
 .../discovery/ambari/ServiceURLPropertyConfig.java | 10 +--
 .../ambari/SparkCommonServiceURLCreator.java       |  4 -
 .../cm/ClouderaManagerServiceDiscovery.java        | 11 ++-
 .../topology/discovery/cm/DiscoveryApiClient.java  |  6 +-
 .../gateway/i18n/messages/MessagesInvoker.java     |  8 +-
 .../knox/gateway/ha/dispatch/AtlasHaDispatch.java  | 13 +---
 .../filter/CommonIdentityAssertionFilter.java      |  2 +-
 .../ext/UrlRewriteActionRewriteProcessorExt.java   |  4 +-
 .../impl/UrlRewriteFunctionProcessorFactory.java   |  7 +-
 .../impl/UrlRewriteStepProcessorFactory.java       |  7 +-
 .../filter/rewrite/impl/json/JsonFilterReader.java | 28 +++----
 .../impl/CompositeAuthzDeploymentContributor.java  |  8 +-
 .../knox/gateway/deploy/impl/ShiroConfig.java      |  6 +-
 .../org/apache/knox/gateway/GatewayServer.java     |  4 +-
 .../knox/gateway/deploy/DeploymentFactory.java     | 25 ++----
 .../impl/instr/InstrHttpClientBuilderProvider.java |  2 +-
 .../security/impl/DefaultAliasService.java         |  8 +-
 .../security/impl/DefaultCryptoService.java        |  9 ++-
 .../token/impl/DefaultTokenStateService.java       |  2 +-
 .../topology/impl/DefaultTopologyService.java      | 12 ++-
 .../monitor/RemoteConfigurationMonitorFactory.java |  2 +-
 .../topology/simple/SimpleDescriptorHandler.java   |  6 +-
 .../java/org/apache/knox/gateway/util/KnoxCLI.java |  8 +-
 .../service/admin/ServiceDefinitionsResource.java  |  2 +-
 .../service/admin/ServiceDiscoveryResource.java    |  6 +-
 .../gateway/service/admin/TopologiesResource.java  | 20 ++---
 .../service/admin/TopologyResourceTest.java        |  6 +-
 .../definition/ServiceDefinitionComparator.java    | 11 ++-
 .../apache/knox/gateway/impala/ImpalaDispatch.java |  5 --
 .../org/apache/knox/gateway/shell/Credentials.java |  2 +-
 .../apache/knox/gateway/shell/ErrorResponse.java   |  4 +-
 .../org/apache/knox/gateway/shell/KnoxSession.java |  6 +-
 .../shell/table/JoinKnoxShellTableBuilder.java     |  8 +-
 .../knox/gateway/shell/table/KnoxShellTable.java   | 45 ++++++-----
 .../gateway/shell/table/KnoxShellTableCall.java    |  2 +-
 .../shell/table/KnoxShellTableCallHistory.java     |  9 +--
 .../shell/table/KnoxShellTableJSONSerializer.java  |  8 +-
 .../shell/table/KnoxShellTableRowDeserializer.java |  7 +-
 .../knox/gateway/dispatch/DefaultDispatch.java     |  4 +-
 .../ServiceDefinitionPairComparator.java           |  8 +-
 .../UrlRewriteRulesDescriptorAdapter.java          |  2 +-
 .../org/apache/knox/gateway/topology/Topology.java |  6 +-
 .../discovery/ServiceDiscoveryFactory.java         | 15 ++--
 .../org/apache/knox/gateway/GatewayTestConfig.java |  5 +-
 .../org/apache/knox/gateway/GatewayTestDriver.java |  2 +-
 .../main/java/org/apache/knox/test/Console.java    |  9 ++-
 .../main/java/org/apache/knox/test/TestUtils.java  |  3 +
 .../config/impl/DefaultConfigurationInjector.java  |  2 +-
 .../org/apache/knox/gateway/launcher/Config.java   |  6 +-
 .../knox/gateway/util/urltemplate/Template.java    |  2 +-
 .../knox/gateway/util/urltemplate/ParserTest.java  | 88 ++++++++++------------
 pom.xml                                            |  4 +-
 56 files changed, 211 insertions(+), 303 deletions(-)

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 e20db56..aaad3a1 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
@@ -57,6 +57,7 @@ limitations under the License.
     <rule ref="category/java/codestyle.xml/PackageCase" />
     <rule ref="category/java/codestyle.xml/UnnecessaryModifier" />
     <rule ref="category/java/codestyle.xml/UnnecessaryReturn" />
+    <rule ref="category/java/codestyle.xml/UseDiamondOperator" />
 
     <!--<rule ref="category/java/design.xml" />-->
     <!--<rule ref="category/java/documentation.xml" />-->
diff --git a/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java b/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java
index 724cb0c..6e17c99 100644
--- a/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java
+++ b/gateway-demo-ldap/src/main/java/org/apache/knox/gateway/security/ldap/SimpleLdapDirectoryServer.java
@@ -82,8 +82,9 @@ public class SimpleLdapDirectoryServer {
         partitionFactory = new JdbmPartitionFactory();
       }
     } catch ( Exception e ) {
-      LOG.error( "Error instantiating custom partiton factory", e );
-      throw new RuntimeException( e );
+      String msg = "Error instantiating custom partition factory";
+      LOG.error(msg, e );
+      throw new RuntimeException(msg, e);
     }
 
     DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory(directoryService, partitionFactory);
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 d2199f7..da7e6b3 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
@@ -150,10 +150,8 @@ class AmbariDynamicServiceURLCreator implements ServiceURLCreator {
                         log.handlingDerivedProperty(serviceName, configProperty.getType(), configProperty.getName());
                         ServiceURLPropertyConfig.Property p = config.getConfigProperty(serviceName, configProperty.getName());
                         propertyValue = p.getValue();
-                        if (propertyValue == null) {
-                            if (p.getConditionHandler() != null) {
-                                propertyValue = p.getConditionHandler().evaluate(config, cluster);
-                            }
+                        if (propertyValue == null && p.getConditionHandler() != null) {
+                            propertyValue = p.getConditionHandler().evaluate(config, cluster);
                         }
                     }
 
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 cef6e9c..0693646 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
@@ -171,11 +171,9 @@ class AmbariServiceDiscovery implements ServiceDiscovery {
                         ClusterConfigurationMonitorService clusterMonitorService =
                               ((GatewayServices) obj).getService(ServiceType.CLUSTER_CONFIGURATION_MONITOR_SERVICE);
                         ClusterConfigurationMonitor monitor =
-                                                 clusterMonitorService.getMonitor(AmbariConfigurationMonitor.getType());
-                        if (monitor != null) {
-                            if (AmbariConfigurationMonitor.class.isAssignableFrom(monitor.getClass())) {
-                                ambariMonitor = (AmbariConfigurationMonitor) monitor;
-                            }
+                            clusterMonitorService.getMonitor(AmbariConfigurationMonitor.getType());
+                        if (monitor != null && AmbariConfigurationMonitor.class.isAssignableFrom(monitor.getClass())) {
+                            ambariMonitor = (AmbariConfigurationMonitor) monitor;
                         }
                     }
                 }
@@ -323,8 +321,9 @@ class AmbariServiceDiscovery implements ServiceDiscovery {
             }
 
             // Construct the AmbariCluster model
-            for (String componentName : serviceComponents.keySet()) {
-                String serviceName = serviceComponents.get(componentName);
+            for (Entry<String, String> entry : serviceComponents.entrySet()) {
+                String componentName = entry.getKey();
+                String serviceName = entry.getValue();
                 List<String> hostNames = componentHostNames.get(componentName);
 
                 Map<String, AmbariCluster.ServiceConfiguration> configs = serviceConfigurations.get(serviceName);
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 ae2db81..8c2e467 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
@@ -164,8 +164,8 @@ class ServiceURLPropertyConfig {
                     }
 
                     // Add the override properties
-                    for (String propertyName : serviceProperties.keySet()) {
-                        setConfigProperty(service, propertyName, serviceProperties.get(propertyName));
+                    for (Map.Entry<String, Property> entry : serviceProperties.entrySet()) {
+                        setConfigProperty(service, entry.getKey(), entry.getValue());
                     }
                 }
             }
@@ -173,11 +173,7 @@ class ServiceURLPropertyConfig {
     }
 
     void setConfigProperty(String service, String name, Property value) {
-        Map<String, Property> serviceProperties = properties.get(service);
-        if (serviceProperties == null) {
-            serviceProperties = new HashMap<>();
-            properties.put(service, serviceProperties);
-        }
+        Map<String, Property> serviceProperties = properties.computeIfAbsent(service, k -> new HashMap<>());
         serviceProperties.put(name, value);
     }
 
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 ab49b45..ffaf986 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
@@ -49,7 +49,6 @@ public abstract class SparkCommonServiceURLCreator implements ServiceURLCreator
     return comp.getConfigProperty(portConfigProperty);
   }
 
-
   @Override
   public List<String> create(String service, Map<String, String> serviceParams) {
     List<String> urls = new ArrayList<>();
@@ -71,7 +70,4 @@ public abstract class SparkCommonServiceURLCreator implements ServiceURLCreator
 
     return urls;
   }
-
-
-
 }
diff --git a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java
index 0a7ba47..b4396ed 100644
--- a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java
+++ b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/ClouderaManagerServiceDiscovery.java
@@ -191,12 +191,11 @@ public class ClouderaManagerServiceDiscovery implements ServiceDiscovery {
             List<ServiceModelGenerator> smgList = serviceModelGenerators.get(service.getType());
             if (smgList != null) {
               for (ServiceModelGenerator serviceModelGenerator : smgList) {
-                if (serviceModelGenerator != null) {
-                  if (serviceModelGenerator.handles(service, serviceConfig, role, roleConfig)) {
-                    serviceModelGenerator.setApiClient(client);
-                    ServiceModel serviceModel = serviceModelGenerator.generateService(service, serviceConfig, role, roleConfig);
-                    serviceModels.add(serviceModel);
-                  }
+                if (serviceModelGenerator != null &&
+                    serviceModelGenerator.handles(service, serviceConfig, role, roleConfig)) {
+                  serviceModelGenerator.setApiClient(client);
+                  ServiceModel serviceModel = serviceModelGenerator.generateService(service, serviceConfig, role, roleConfig);
+                  serviceModels.add(serviceModel);
                 }
               }
             }
diff --git a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/DiscoveryApiClient.java b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/DiscoveryApiClient.java
index 1f1c854..a29dd39 100644
--- a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/DiscoveryApiClient.java
+++ b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/DiscoveryApiClient.java
@@ -138,10 +138,8 @@ public class DiscoveryApiClient extends ApiClient {
   private String getUsername() {
     String username = null;
     Authentication basicAuth = getAuthentication("basic");
-    if (basicAuth != null) {
-      if (basicAuth instanceof HttpBasicAuth) {
-        username = ((HttpBasicAuth) basicAuth).getUsername();
-      }
+    if (basicAuth instanceof HttpBasicAuth) {
+      username = ((HttpBasicAuth) basicAuth).getUsername();
     }
     return username;
   }
diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java
index 62dae84..9b69ee8 100644
--- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java
+++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/messages/MessagesInvoker.java
@@ -89,11 +89,9 @@ public class MessagesInvoker extends ResourcesInvoker implements InvocationHandl
         Object arg = args[i];
         if( arg instanceof Throwable ) {
           StackTrace anno = getStackTraceAnno( method, i );
-          if( anno != null ) {
-            if( logger.isLoggable( anno.level() ) ) {
-              throwable = (Throwable)arg;
-              break;
-            }
+          if( anno != null && logger.isLoggable( anno.level() ) ) {
+            throwable = (Throwable)arg;
+            break;
           }
         }
       }
diff --git a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/dispatch/AtlasHaDispatch.java b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/dispatch/AtlasHaDispatch.java
index 7742b28..7885149 100644
--- a/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/dispatch/AtlasHaDispatch.java
+++ b/gateway-provider-ha/src/main/java/org/apache/knox/gateway/ha/dispatch/AtlasHaDispatch.java
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.knox.gateway.ha.dispatch;
 
 import org.apache.http.Header;
@@ -26,26 +25,16 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 public class AtlasHaDispatch extends DefaultHaDispatch {
-    private static Set<String> REQUEST_EXCLUDE_HEADERS = new HashSet<>();
-
-    static {
-        REQUEST_EXCLUDE_HEADERS.add("Content-Length");
-    }
+    private static final Set<String> REQUEST_EXCLUDE_HEADERS = Collections.singleton("Content-Length");
 
     public AtlasHaDispatch() {
         setServiceRole("ATLAS");
     }
 
     @Override
-    public void init() {
-        super.init();
-    }
-
-    @Override
     public Set<String> getOutboundResponseExcludeHeaders() {
         return Collections.emptySet();
     }
diff --git a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/CommonIdentityAssertionFilter.java b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/CommonIdentityAssertionFilter.java
index 20680c9..f16fa50 100644
--- a/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/CommonIdentityAssertionFilter.java
+++ b/gateway-provider-identity-assertion-common/src/main/java/org/apache/knox/gateway/identityasserter/common/filter/CommonIdentityAssertionFilter.java
@@ -96,7 +96,7 @@ public class CommonIdentityAssertionFilter extends AbstractIdentityAssertionFilt
 
   private String[] combineGroupMappings(String[] mappedGroups, String[] groups) {
     if (mappedGroups != null && groups != null) {
-      return (String[])ArrayUtils.addAll(mappedGroups, groups);
+      return ArrayUtils.addAll(mappedGroups, groups);
     }
     else {
       return groups != null ? groups : mappedGroups;
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java
index 0eaf966..c215cf3 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/ext/UrlRewriteActionRewriteProcessorExt.java
@@ -29,7 +29,6 @@ public class UrlRewriteActionRewriteProcessorExt
     implements UrlRewriteStepProcessor<UrlRewriteActionRewriteDescriptorExt> {
 
   private Template template;
-  private Expander expander;
 
   @Override
   public String getType() {
@@ -38,7 +37,6 @@ public class UrlRewriteActionRewriteProcessorExt
 
   @Override
   public void initialize( UrlRewriteEnvironment environment, UrlRewriteActionRewriteDescriptorExt descriptor ) throws Exception {
-    this.expander = new Expander();
     if ( descriptor.parameter() != null ) {
       this.template = Parser.parseTemplate( descriptor.parameter() );
     } else {
@@ -48,7 +46,7 @@ public class UrlRewriteActionRewriteProcessorExt
 
   @Override
   public UrlRewriteStepStatus process( UrlRewriteContext context ) throws Exception {
-    Template rewritten = expander.expandToTemplate( template, context.getParameters(), context.getEvaluator() );
+    Template rewritten = Expander.expandToTemplate( template, context.getParameters(), context.getEvaluator() );
     context.setCurrentUrl( rewritten );
     return UrlRewriteStepStatus.SUCCESS;
   }
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteFunctionProcessorFactory.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteFunctionProcessorFactory.java
index 06cccab..0035c68 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteFunctionProcessorFactory.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteFunctionProcessorFactory.java
@@ -66,11 +66,8 @@ public abstract class UrlRewriteFunctionProcessorFactory {
     ServiceLoader<UrlRewriteFunctionProcessor> processors = ServiceLoader.load( UrlRewriteFunctionProcessor.class );
     for( UrlRewriteFunctionProcessor processor : processors ) {
       Class<? extends UrlRewriteFunctionDescriptor> descriptorInterface = getDescriptorInterface( processor );
-      Map<String,Class<? extends UrlRewriteFunctionProcessor>> typeMap = descriptorMap.get( descriptorInterface );
-      if( typeMap == null ) {
-        typeMap = new HashMap<>();
-        descriptorMap.put( descriptorInterface, typeMap );
-      }
+      Map<String, Class<? extends UrlRewriteFunctionProcessor>> typeMap = descriptorMap
+          .computeIfAbsent(descriptorInterface, k -> new HashMap<>());
       String functionName = processor.name();
       typeMap.put( functionName, processor.getClass() );
     }
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteStepProcessorFactory.java b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteStepProcessorFactory.java
index cd1e724..3851396 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteStepProcessorFactory.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/UrlRewriteStepProcessorFactory.java
@@ -62,11 +62,8 @@ public abstract class UrlRewriteStepProcessorFactory {
     ServiceLoader<UrlRewriteStepProcessor> processors = ServiceLoader.load( UrlRewriteStepProcessor.class );
     for( UrlRewriteStepProcessor processor : processors ) {
       Class<? extends UrlRewriteStepDescriptor> descriptorInterface = getDescriptorInterface( processor );
-      Map<String,Class<? extends UrlRewriteStepProcessor>> typeMap = descriptorMap.get( descriptorInterface );
-      if( typeMap == null ) {
-        typeMap = new HashMap<>();
-        descriptorMap.put( descriptorInterface, typeMap );
-      }
+      Map<String, Class<? extends UrlRewriteStepProcessor>> typeMap = descriptorMap
+          .computeIfAbsent(descriptorInterface, k -> new HashMap<>());
       String processorType = processor.getType();
       typeMap.put( processorType, processor.getClass() );
     }
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 3c32604..87bbe51 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
@@ -189,10 +189,8 @@ class JsonFilterReader extends Reader {
         throw new IllegalStateException();
       }
     }
-    if( bufferingLevel == null ) {
-      if( !startBuffering( child ) ) {
-        generator.writeStartObject();
-      }
+    if( bufferingLevel == null && !startBuffering( child ) ) {
+      generator.writeStartObject();
     }
   }
 
@@ -253,10 +251,8 @@ class JsonFilterReader extends Reader {
         throw new IllegalStateException();
       }
     }
-    if( bufferingLevel == null ) {
-      if( !startBuffering( child ) ) {
-        generator.writeStartArray();
-      }
+    if( bufferingLevel == null && !startBuffering( child ) ) {
+      generator.writeStartArray();
     }
   }
 
@@ -525,12 +521,10 @@ class JsonFilterReader extends Reader {
         List<JsonPath.Match> matches = path.evaluate( node.scopeNode );
         if( matches != null && !matches.isEmpty() ) {
           JsonPath.Match match = matches.get( 0 );
-          if( match.getNode().isTextual() ) {
-            if( selector instanceof UrlRewriteFilterApplyDescriptor ) {
-              UrlRewriteFilterApplyDescriptor apply = (UrlRewriteFilterApplyDescriptor)selector;
-              rule = apply.rule();
-              break;
-            }
+          if( match.getNode().isTextual() && selector instanceof UrlRewriteFilterApplyDescriptor ) {
+            UrlRewriteFilterApplyDescriptor apply = (UrlRewriteFilterApplyDescriptor)selector;
+            rule = apply.rule();
+            break;
           }
         }
       }
@@ -580,10 +574,8 @@ class JsonFilterReader extends Reader {
       JsonPath.Expression path = (JsonPath.Expression)selector.compiledPath( JPATH_COMPILER );
       List<JsonPath.Match> matches = path.evaluate( node.node );
       for( JsonPath.Match match : matches ) {
-        if( match.getNode().isTextual() ) {
-          if( selector instanceof UrlRewriteFilterApplyDescriptor ) {
-            filterBufferedValue( match, (UrlRewriteFilterApplyDescriptor)selector );
-          }
+        if( match.getNode().isTextual() && selector instanceof UrlRewriteFilterApplyDescriptor ) {
+          filterBufferedValue( match, (UrlRewriteFilterApplyDescriptor)selector );
         }
       }
     }
diff --git a/gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java b/gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java
index 5e7562c..6d3be5f 100644
--- a/gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java
+++ b/gateway-provider-security-authz-composite/src/main/java/org/apache/knox/gateway/deploy/impl/CompositeAuthzDeploymentContributor.java
@@ -43,11 +43,6 @@ public class CompositeAuthzDeploymentContributor extends ProviderDeploymentContr
   }
 
   @Override
-  public void initializeContribution(DeploymentContext context) {
-    super.initializeContribution(context);
-  }
-
-  @Override
   public void contributeProvider( DeploymentContext context, Provider provider ) {
   }
 
@@ -71,8 +66,7 @@ public class CompositeAuthzDeploymentContributor extends ProviderDeploymentContr
   }
 
   String[] parseProviderNames(String providerNames) {
-    String[] names = providerNames.split(",\\s*");
-    return names;
+    return providerNames.split(",\\s*");
   }
 
   void getProviderSpecificParams(ResourceDescriptor resource, List<FilterParamDescriptor> params,
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 60ac744..a783790 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
@@ -50,11 +50,7 @@ public class ShiroConfig {
   }
 
   private void addNameValueToSection(String name, String value, String sectionName) {
-    Map<String, String> section = sections.get(sectionName);
-    if (section == null) {
-      section = new LinkedHashMap<>();
-      sections.put(sectionName, section);
-    }
+    Map<String, String> section = sections.computeIfAbsent(sectionName, k -> new LinkedHashMap<>());
     section.put(name, value);
   }
 
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 db699fc..9fa36ae 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
@@ -126,6 +126,8 @@ public class GatewayServer {
   private static final Auditor auditor = AuditServiceFactory.getAuditService().getAuditor(AuditConstants.DEFAULT_AUDITOR_NAME,
       AuditConstants.KNOX_SERVICE_NAME, AuditConstants.KNOX_COMPONENT_NAME);
 
+  private static final String TOPOLOGY_EXTENSION = ".topo.";
+
   static final String KNOXSESSIONCOOKIENAME = "KNOXSESSIONID";
 
   private static GatewayServer server;
@@ -1032,7 +1034,7 @@ public class GatewayServer {
   }
 
   private String calculateDeploymentExtension() {
-    return ".topo.";
+    return TOPOLOGY_EXTENSION;
   }
 
   private String calculateDeploymentName( Topology topology ) {
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 844ea85..170c76b 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
@@ -137,11 +137,9 @@ public abstract class DeploymentFactory {
           }
           for( String url : urls ) {
             List<Application> dups = findApplicationsByUrl( topology, url );
-            if( dups != null ) {
-              for( Application dup : dups ) {
-                if( dup != app ) { //NOPMD - check for exact same object
-                  throw new DeploymentException( "Topology " + topology.getName() + " contains applications " + app.getName() + " and " + dup.getName() + " with the same url: " + url );
-                }
+            for( Application dup : dups ) {
+              if( dup != app ) { //NOPMD - check for exact same object
+                throw new DeploymentException( "Topology " + topology.getName() + " contains applications " + app.getName() + " and " + dup.getName() + " with the same url: " + url );
               }
             }
           }
@@ -153,9 +151,10 @@ public abstract class DeploymentFactory {
   // Verify that if there are services that there are no applications with a root url.
   static void validateNoAppsWithRootUrlsInServicesTopology( Topology topology ) {
     if( topology != null ) {
-      if( topology.getServices() != null && !topology.getServices().isEmpty() ) {
+      Collection<Service> services = topology.getServices();
+      if( services != null && !services.isEmpty() ) {
         List<Application> dups = findApplicationsByUrl( topology, "/" );
-        if( dups != null && !dups.isEmpty() ) {
+        if(!dups.isEmpty()) {
           throw new DeploymentException( "Topology " + topology.getName() + " contains both services and an application " + dups.get( 0 ).getName() + " with a root url." );
         }
       }
@@ -307,11 +306,7 @@ public abstract class DeploymentFactory {
   private static void collectDefaultProviders( Map<String,List<ProviderDeploymentContributor>> defaults ) {
     for( ProviderDeploymentContributor contributor : PROVIDER_CONTRIBUTORS ) {
       String role = contributor.getRole();
-      List<ProviderDeploymentContributor> list = defaults.get( role );
-      if( list == null ) {
-        list = new ArrayList<>();
-        defaults.put( role, list );
-      }
+      List<ProviderDeploymentContributor> list = defaults.computeIfAbsent(role, k -> new ArrayList<>());
       if( list.isEmpty() ) {
         list.add( contributor );
       }
@@ -327,11 +322,7 @@ public abstract class DeploymentFactory {
       String role = service.getRole();
       ServiceDeploymentContributor contributor = getServiceContributor( role, service.getName(), service.getVersion() );
       if( contributor != null ) {
-        List<ServiceDeploymentContributor> list = defaults.get( role );
-        if( list == null ) {
-          list = new ArrayList<>( 1 );
-          defaults.put( role, list );
-        }
+        List<ServiceDeploymentContributor> list = defaults.computeIfAbsent(role, k -> new ArrayList<>(1));
         if( !list.contains( contributor ) ) {
           list.add( contributor );
         }
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java
index c7bb39d..f113310 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/metrics/impl/instr/InstrHttpClientBuilderProvider.java
@@ -58,7 +58,7 @@ public class InstrHttpClientBuilderProvider implements
         RequestLine requestLine = request.getRequestLine();
         URIBuilder uriBuilder = new URIBuilder(requestLine.getUri());
         String resourcePath = InstrUtils.getResourcePath(uriBuilder.removeQuery().build().toString());
-        return MetricRegistry.name("service", new String[]{name, context + resourcePath, methodNameString(request)});
+        return MetricRegistry.name("service", name, context + resourcePath, methodNameString(request));
       } catch (URISyntaxException e) {
         throw new IllegalArgumentException(e);
       }
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultAliasService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultAliasService.java
index 7f40e3b..a3af2c5 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultAliasService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultAliasService.java
@@ -117,11 +117,9 @@ public class DefaultAliasService implements AliasService {
     char[] credential;
     try {
       credential = keystoreService.getCredentialForCluster(clusterName, alias);
-      if (credential == null) {
-        if (generate) {
-          generateAliasForCluster(clusterName, alias);
-          credential = keystoreService.getCredentialForCluster(clusterName, alias);
-        }
+      if (credential == null && generate) {
+        generateAliasForCluster(clusterName, alias);
+        credential = keystoreService.getCredentialForCluster(clusterName, alias);
       }
     } catch (KeystoreServiceException e) {
       LOG.failedToGetCredentialForCluster(clusterName, e);
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
index 3aea783..755eb60 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/security/impl/DefaultCryptoService.java
@@ -41,9 +41,10 @@ import org.apache.knox.gateway.services.ServiceLifecycleException;
 public class DefaultCryptoService implements CryptoService {
   private static final GatewayMessages LOG = MessagesFactory.get( GatewayMessages.class );
 
+  private static final Map<String,ConfigurableEncryptor> ENCRYPTOR_CACHE = new HashMap<>();
+
   private AliasService as;
   private KeystoreService ks;
-  private Map<String,ConfigurableEncryptor> encryptorCache = new HashMap<>();
   private GatewayConfig config;
 
   public void setKeystoreService(KeystoreService ks) {
@@ -162,12 +163,12 @@ public class DefaultCryptoService implements CryptoService {
   // The assumption here is that lock contention will be less of a performance issue than the cost of object creation.
   // We have seen via profiling that AESEncryptor instantiation is very expensive.
   private ConfigurableEncryptor getEncryptor( final String clusterName, final char[] password ) {
-    synchronized( encryptorCache ) {
-      ConfigurableEncryptor encryptor = encryptorCache.get( clusterName );
+    synchronized(ENCRYPTOR_CACHE) {
+      ConfigurableEncryptor encryptor = ENCRYPTOR_CACHE.get( clusterName );
       if( encryptor == null ) {
         encryptor = new ConfigurableEncryptor( String.valueOf( password ) );
         encryptor.init(config);
-        encryptorCache.put( clusterName, encryptor );
+        ENCRYPTOR_CACHE.put( clusterName, encryptor );
       }
       return encryptor;
     }
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
index b77e678..b3d6d24 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
@@ -31,7 +31,7 @@ import java.util.Set;
  */
 public class DefaultTokenStateService implements TokenStateService {
 
-  protected static final long DEFAULT_RENEWAL_INTERVAL = 24 * 60 * 60 * 1000; // 24 hours
+  protected static final long DEFAULT_RENEWAL_INTERVAL = 24 * 60 * 60 * 1000L; // 24 hours
 
   protected static final int MAX_RENEWALS = 7;
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
index 274f693..85470f9 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
@@ -998,13 +998,11 @@ public class DefaultTopologyService
         // Identify any descriptors associated with the cluster configuration change
         for (File descriptor : topologyService.getDescriptors()) {
           String descriptorContent = FileUtils.readFileToString(descriptor, StandardCharsets.UTF_8);
-          if (descriptorContent.contains(source)) {
-            if (descriptorContent.contains(clusterName)) {
-              affectedDescriptors = true;
-              log.triggeringTopologyRegeneration(source, clusterName, descriptor.getAbsolutePath());
-              // 'Touch' the descriptor to trigger re-generation of the associated topology
-              descriptor.setLastModified(System.currentTimeMillis());
-            }
+          if (descriptorContent.contains(source) && descriptorContent.contains(clusterName)) {
+            affectedDescriptors = true;
+            log.triggeringTopologyRegeneration(source, clusterName, descriptor.getAbsolutePath());
+            // 'Touch' the descriptor to trigger re-generation of the associated topology
+            descriptor.setLastModified(System.currentTimeMillis());
           }
         }
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorFactory.java b/gateway-server/src/main/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorFactory.java
index 6801ac5..15ab3f2 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorFactory.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/topology/monitor/RemoteConfigurationMonitorFactory.java
@@ -31,7 +31,7 @@ public class RemoteConfigurationMonitorFactory {
 
     private static RemoteConfigurationRegistryClientService remoteConfigRegistryClientService;
 
-    static void setClientService(RemoteConfigurationRegistryClientService clientService) {
+    static synchronized void setClientService(RemoteConfigurationRegistryClientService clientService) {
         remoteConfigRegistryClientService = clientService;
     }
 
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandler.java b/gateway-server/src/main/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandler.java
index fd8d7f7..34f2f5b 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandler.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/topology/simple/SimpleDescriptorHandler.java
@@ -554,10 +554,10 @@ public class SimpleDescriptorHandler {
                     // Params
                     Map<String, String> appParams = app.getParams();
                     if (appParams != null) {
-                        for (String paramName : appParams.keySet()) {
+                        for (Entry<String, String> entry : appParams.entrySet()) {
                             sw.write("        <param>\n");
-                            sw.write("            <name>" + paramName + "</name>\n");
-                            sw.write("            <value>" + appParams.get(paramName) + "</value>\n");
+                            sw.write("            <name>" + entry.getKey() + "</name>\n");
+                            sw.write("            <value>" + entry.getValue() + "</value>\n");
                             sw.write("        </param>\n");
                         }
                     }
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
index daae9f3..c4de38d 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
@@ -260,7 +260,7 @@ public class KnoxCLI extends Configured implements Tool {
           return -1;
         }
         this.value = args[++i];
-        if ( command != null && command instanceof MasterCreateCommand ) {
+        if ( command instanceof MasterCreateCommand ) {
           this.master = this.value;
         }
       } else if ( args[i].equals("version") ) {
@@ -290,7 +290,7 @@ public class KnoxCLI extends Configured implements Tool {
           command = new ServiceTestCommand();
         }
       } else if (args[i].equals("--generate")) {
-        if ( command != null && command instanceof MasterCreateCommand ) {
+        if ( command instanceof MasterCreateCommand ) {
           this.master = UUID.randomUUID().toString();
         } else {
           this.generate = "true";
@@ -898,7 +898,7 @@ public class KnoxCLI extends Configured implements Tool {
    private GatewayConfig getGatewayConfig() {
      GatewayConfig result;
      Configuration conf = getConf();
-     if( conf != null && conf instanceof GatewayConfig ) {
+     if( conf instanceof GatewayConfig ) {
        result = (GatewayConfig)conf;
      } else {
        result = new GatewayConfigImpl();
@@ -1649,7 +1649,7 @@ public class KnoxCLI extends Configured implements Tool {
   private GatewayConfig getGatewayConfig() {
     GatewayConfig result;
     Configuration conf = getConf();
-    if(conf != null && conf instanceof GatewayConfig) {
+    if(conf instanceof GatewayConfig) {
       result = (GatewayConfig) conf;
     } else {
       result = new GatewayConfigImpl();
diff --git a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDefinitionsResource.java b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDefinitionsResource.java
index c765baa..e6d669f 100644
--- a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDefinitionsResource.java
+++ b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDefinitionsResource.java
@@ -73,7 +73,7 @@ public class ServiceDefinitionsResource {
   @Produces({ APPLICATION_JSON, APPLICATION_XML })
   @Path("servicedefinitions")
   public ServiceDefinitionsWrapper getServiceDefinitions(@QueryParam("serviceOnly") @DefaultValue("false") boolean serviceOnly) {
-    return getServiceDefinitions((Predicate<? super ServiceDefinitionPair>) null, serviceOnly);
+    return getServiceDefinitions(null, serviceOnly);
   }
 
   @GET
diff --git a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDiscoveryResource.java b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDiscoveryResource.java
index 5cbea74..2845191 100644
--- a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDiscoveryResource.java
+++ b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/ServiceDiscoveryResource.java
@@ -93,10 +93,8 @@ public class ServiceDiscoveryResource {
     }
 
     void setKnoxServiceDiscoveries(Collection<ServiceDiscovery> serviceDiscoveries) {
-      serviceDiscoveries.forEach(serviceDiscovery -> {
-        this.knoxServiceDiscoveries.add(new KnoxServiceDiscovery(serviceDiscovery.getType(), serviceDiscovery.getClass().getCanonicalName()));
-
-      });
+      serviceDiscoveries.forEach(serviceDiscovery -> this.knoxServiceDiscoveries.add(
+          new KnoxServiceDiscovery(serviceDiscovery.getType(), serviceDiscovery.getClass().getCanonicalName())));
     }
   }
 }
diff --git a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
index 2199da4..00e4e28 100644
--- a/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
+++ b/gateway-service-admin/src/main/java/org/apache/knox/gateway/service/admin/TopologiesResource.java
@@ -500,9 +500,9 @@ public class TopologiesResource {
   private String getExtensionForMediaType(MediaType type) {
     String extension = null;
 
-    for (MediaType key : mediaTypeFileExtensions.keySet()) {
-      if (type.isCompatible(key)) {
-        extension = mediaTypeFileExtensions.get(key);
+    for (Map.Entry<MediaType, String> entry : mediaTypeFileExtensions.entrySet()) {
+      if (type.isCompatible(entry.getKey())) {
+        extension = entry.getValue();
         break;
       }
     }
@@ -521,19 +521,9 @@ public class TopologiesResource {
     return result;
   }
 
-
   private static boolean isValidResourceName(final String name) {
-    boolean isValid = false;
-
-    if (name != null) {
-      if (name.length() <= RESOURCE_NAME_LENGTH_MAX) {
-        if (RESOURCE_NAME_PATTERN.matcher(name).matches()) {
-          isValid = true;
-        }
-      }
-    }
-
-    return isValid;
+    return name != null && name.length() <= RESOURCE_NAME_LENGTH_MAX &&
+        RESOURCE_NAME_PATTERN.matcher(name).matches();
   }
 
 
diff --git a/gateway-service-admin/src/test/java/org/apache/knox/gateway/service/admin/TopologyResourceTest.java b/gateway-service-admin/src/test/java/org/apache/knox/gateway/service/admin/TopologyResourceTest.java
index 43f69d2..e49015e 100644
--- a/gateway-service-admin/src/test/java/org/apache/knox/gateway/service/admin/TopologyResourceTest.java
+++ b/gateway-service-admin/src/test/java/org/apache/knox/gateway/service/admin/TopologyResourceTest.java
@@ -42,7 +42,11 @@ public class TopologyResourceTest {
   private String reqPort = "9001";
   private String gatewayPath = "gateway-path";
   private String reqContext = "/" + gatewayPath + "/a-topology";
-  private String proto = "proto", port = "1337", server = "my-server", host = server + ":" + port, startContext = "/mycontext";
+  private String proto = "proto";
+  private String port = "1337";
+  private String server = "my-server";
+  private String host = server + ":" + port;
+  private String startContext = "/mycontext";
   private String fullContext = startContext + reqContext;
   private String pathInfo = "/api/version";
   private String topologyName = "topology-name";
diff --git a/gateway-service-definitions/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionComparator.java b/gateway-service-definitions/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionComparator.java
index e55365b..e006c4e 100644
--- a/gateway-service-definitions/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionComparator.java
+++ b/gateway-service-definitions/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionComparator.java
@@ -29,16 +29,19 @@ import java.util.Comparator;
  * </ol>
  */
 public class ServiceDefinitionComparator implements Comparator<ServiceDefinition> {
-
   @Override
   public int compare(ServiceDefinition serviceDefinition, ServiceDefinition otherServiceDefinition) {
     if (serviceDefinition == null || otherServiceDefinition == null) {
       throw new IllegalArgumentException("One (or both) of the supplied service definitions is null");
     }
     final int byName = serviceDefinition.getName().compareTo(otherServiceDefinition.getName());
+    if(byName != 0) {
+      return byName;
+    }
     final int byRole = serviceDefinition.getRole().compareTo(otherServiceDefinition.getRole());
-    final int byVersion = serviceDefinition.getVersion().compareTo(otherServiceDefinition.getVersion());
-    return byName != 0 ? byName : byRole != 0 ? byRole : byVersion;
+    if(byRole != 0) {
+      return byRole;
+    }
+    return serviceDefinition.getVersion().compareTo(otherServiceDefinition.getVersion());
   }
-
 }
diff --git a/gateway-service-impala/src/main/java/org/apache/knox/gateway/impala/ImpalaDispatch.java b/gateway-service-impala/src/main/java/org/apache/knox/gateway/impala/ImpalaDispatch.java
index 1b84ea6..7604a64 100644
--- a/gateway-service-impala/src/main/java/org/apache/knox/gateway/impala/ImpalaDispatch.java
+++ b/gateway-service-impala/src/main/java/org/apache/knox/gateway/impala/ImpalaDispatch.java
@@ -30,11 +30,6 @@ public class ImpalaDispatch extends DefaultDispatch {
   private boolean basicAuthPreemptive;
 
   @Override
-  public void init() {
-    super.init();
-  }
-
-  @Override
   protected void addCredentialsToRequest(HttpUriRequest request) {
     if( isBasicAuthPreemptive() ) {
       ImpalaDispatchUtils.addCredentialsToRequest(request);
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Credentials.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Credentials.java
index 13ac9bf..b0a66b7 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Credentials.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/Credentials.java
@@ -22,7 +22,7 @@ import java.util.List;
 import java.util.ServiceLoader;
 
 public class Credentials {
-  List<CredentialCollector> collectors = new ArrayList<CredentialCollector>();
+  List<CredentialCollector> collectors = new ArrayList<>();
 
   public Credentials add(String collectorType, String prompt, String name)
     throws CredentialCollectionException {
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ErrorResponse.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ErrorResponse.java
index bf625a3..c60ad00 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ErrorResponse.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/ErrorResponse.java
@@ -20,8 +20,7 @@ package org.apache.knox.gateway.shell;
 import org.apache.http.HttpResponse;
 
 public class ErrorResponse extends RuntimeException {
-
-  HttpResponse response;
+  private final HttpResponse response;
 
   ErrorResponse(String text, HttpResponse response) {
     super(text + response.getStatusLine());
@@ -31,5 +30,4 @@ public class ErrorResponse extends RuntimeException {
   public HttpResponse getResponse() {
     return response;
   }
-
 }
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
index 3952a1c..bbfb288 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxSession.java
@@ -328,10 +328,8 @@ public class KnoxSession implements Closeable {
 
       // (KNOX-2001) Log a warning if the useSubjectCredsOnly restriction is "relaxed"
       String useSubjectCredsOnly = System.getProperty("javax.security.auth.useSubjectCredsOnly");
-      if (useSubjectCredsOnly != null) {
-        if (!Boolean.valueOf(useSubjectCredsOnly)) {
-          LOG.useSubjectCredsOnlyIsFalse();
-        }
+      if (useSubjectCredsOnly != null && !Boolean.parseBoolean(useSubjectCredsOnly)) {
+        LOG.useSubjectCredsOnlyIsFalse();
       }
 
       final Registry<AuthSchemeProvider> authSchemeRegistry =
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/JoinKnoxShellTableBuilder.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/JoinKnoxShellTableBuilder.java
index 68e44ac..98665cc 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/JoinKnoxShellTableBuilder.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/JoinKnoxShellTableBuilder.java
@@ -63,17 +63,17 @@ public class JoinKnoxShellTableBuilder extends KnoxShellTableBuilder {
       this.table.title(title);
     }
 
-    this.table.headers.addAll(new ArrayList<String>(left.headers));
+    this.table.headers.addAll(new ArrayList<>(left.headers));
     for (List<Comparable<? extends Object>> row : left.rows) {
-      this.table.rows.add(new ArrayList<Comparable<? extends Object>>(row));
+      this.table.rows.add(new ArrayList<>(row));
     }
     List<Comparable<? extends Object>> row;
     Comparable<? extends Object> leftKey;
     int matchedIndex;
 
-    this.table.headers.addAll(new ArrayList<String>(right.headers));
+    this.table.headers.addAll(new ArrayList<>(right.headers));
     for (Iterator<List<Comparable<? extends Object>>> it = this.table.rows.iterator(); it.hasNext();) {
-      row = (List<Comparable<? extends Object>>) it.next();
+      row = it.next();
       leftKey = row.get(leftIndex);
       if (leftKey != null) {
         matchedIndex = right.values(rightIndex).indexOf(leftKey);
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTable.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTable.java
index 6365a14..560ac20 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTable.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTable.java
@@ -27,7 +27,6 @@ import javax.swing.SortOrder;
 import com.fasterxml.jackson.annotation.JsonFilter;
 import org.apache.commons.math3.stat.StatUtils;
 
-
 /**
  * Simple table representation and text based rendering of a table via
  * toString(). Headers are optional but when used must have the same count as
@@ -48,8 +47,8 @@ public class KnoxShellTable {
 
   private static final String LINE_SEPARATOR = System.getProperty("line.separator");
 
-  List<String> headers = new ArrayList<String>();
-  List<List<Comparable<? extends Object>>> rows = new ArrayList<List<Comparable<? extends Object>>>();
+  List<String> headers = new ArrayList<>();
+  List<List<Comparable<? extends Object>>> rows = new ArrayList<>();
   String title;
   long id;
 
@@ -68,7 +67,7 @@ public class KnoxShellTable {
   }
 
   public KnoxShellTable row() {
-    rows.add(new ArrayList<Comparable<? extends Object>>());
+    rows.add(new ArrayList<>());
     return this;
   }
 
@@ -84,14 +83,14 @@ public class KnoxShellTable {
   }
 
   public List<Comparable<? extends Object>> values(int colIndex) {
-    List<Comparable<? extends Object>> col = new ArrayList<Comparable<? extends Object>>();
+    List<Comparable<? extends Object>> col = new ArrayList<>();
     rows.forEach(row -> col.add(row.get(colIndex)));
     return col;
   }
 
   public List<Comparable<? extends Object>> values(String colName) {
     int colIndex = headers.indexOf(colName);
-    List<Comparable<? extends Object>> col = new ArrayList<Comparable<? extends Object>>();
+    List<Comparable<? extends Object>> col = new ArrayList<>();
     rows.forEach(row -> col.add(row.get(colIndex)));
     return col;
   }
@@ -140,25 +139,25 @@ public class KnoxShellTable {
       }
       switch (conversionMethod) {
         case DOUBLE:
-          colArray[i] = (double) ((Double) col.get(i));
+          colArray[i] = (Double) col.get(i);
           break;
         case INTEGER:
-          colArray[i] = (double) ((Integer) col.get(i)).intValue();
+          colArray[i] = (Integer) col.get(i);
           break;
         case FLOAT:
-          colArray[i] = (double) ((Float) col.get(i)).floatValue();
+          colArray[i] = (Float) col.get(i);
           break;
         case BYTE:
-          colArray[i] = (double) ((Byte) col.get(i)).byteValue();
+          colArray[i] = (Byte) col.get(i);
           break;
         case SHORT:
-          colArray[i] = (double) ((Short) col.get(i)).shortValue();
+          colArray[i] = (Short) col.get(i);
           break;
         case LONG:
-          colArray[i] = (double) ((Long) col.get(i)).longValue();
+          colArray[i] = (double) (Long) col.get(i);
           break;
         case STRING:
-          colArray[i] = (double) (Double.parseDouble((String) col.get(i)));
+          colArray[i] = Double.parseDouble((String) col.get(i));
           break;
       }
     }
@@ -207,7 +206,7 @@ public class KnoxShellTable {
    * @return mode
    */
   public double mode(String colName) {
-    return (double) StatUtils.mode(toDoubleArray(colName))[0];
+    return StatUtils.mode(toDoubleArray(colName))[0];
   }
 
   /**
@@ -312,11 +311,11 @@ public class KnoxShellTable {
   }
 
   public String getCallHistory() {
-    final StringBuilder callHistoryStringBuilder = new StringBuilder("Call history (id=" + id + ")" + LINE_SEPARATOR + LINE_SEPARATOR);
+    final StringBuilder callHistoryStringBuilder = new StringBuilder("Call history (id=")
+        .append(id).append(')').append(LINE_SEPARATOR).append(LINE_SEPARATOR);
     final AtomicInteger index = new AtomicInteger(1);
-    getCallHistoryList().forEach(callHistory -> {
-      callHistoryStringBuilder.append("Step ").append(index.getAndIncrement()).append(":" + LINE_SEPARATOR).append(callHistory).append(LINE_SEPARATOR);
-    });
+    getCallHistoryList().forEach(callHistory -> callHistoryStringBuilder.append("Step ")
+        .append(index.getAndIncrement()).append(':').append(LINE_SEPARATOR).append(callHistory).append(LINE_SEPARATOR));
     return callHistoryStringBuilder.toString();
   }
 
@@ -348,7 +347,7 @@ public class KnoxShellTable {
 
   public KnoxShellTable select(String cols) {
     KnoxShellTable table = new KnoxShellTable();
-    List<List<Comparable<? extends Object>>> columns = new ArrayList<List<Comparable<? extends Object>>>();
+    List<List<Comparable<? extends Object>>> columns = new ArrayList<>();
     String[] colnames = cols.split(",");
     for (String colName : colnames) {
       table.header(colName);
@@ -372,7 +371,7 @@ public class KnoxShellTable {
 
     Comparable<? extends Object> value;
     List<Comparable<? extends Object>> col = values(colName);
-    List<RowIndex> index = new ArrayList<RowIndex>();
+    List<RowIndex> index = new ArrayList<>();
     for (int i = 0; i < col.size(); i++) {
       value = col.get(i);
       index.add(new RowIndex(value, i));
@@ -381,11 +380,11 @@ public class KnoxShellTable {
       Collections.sort(index);
     }
     else {
-      Collections.sort(index, Collections.reverseOrder());
+      index.sort(Collections.reverseOrder());
     }
-    table.headers = new ArrayList<String>(headers);
+    table.headers = new ArrayList<>(headers);
     for (RowIndex i : index) {
-      table.rows.add(new ArrayList<Comparable<? extends Object>>(this.rows.get(i.index)));
+      table.rows.add(new ArrayList<>(this.rows.get(i.index)));
     }
     return table;
   }
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCall.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCall.java
index 5592124..6ef5c2d 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCall.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCall.java
@@ -63,7 +63,7 @@ class KnoxShellTableCall {
 
   @JsonIgnore
   Class<?>[] getParameterTypes() {
-    final List<Class<?>> parameterTypes = new ArrayList<Class<?>>(params.size());
+    final List<Class<?>> parameterTypes = new ArrayList<>(params.size());
     if (KNOX_SHELL_TABLE_FILTER_TYPE.equals(invokerClass) && builderMethod) {
       parameterTypes.add(Comparable.class);
     } else {
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCallHistory.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCallHistory.java
index da22495..77451de 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCallHistory.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableCallHistory.java
@@ -19,7 +19,6 @@ package org.apache.knox.gateway.shell.table;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
@@ -46,14 +45,14 @@ class KnoxShellTableCallHistory {
   private final Map<Long, List<KnoxShellTableCall>> callHistory = new ConcurrentHashMap<>();
 
   private KnoxShellTableCallHistory() {
-  };
+  }
 
   static KnoxShellTableCallHistory getInstance() {
     return INSTANCE;
   }
 
   void saveCall(long id, KnoxShellTableCall call) {
-    saveCalls(id, Arrays.asList(call));
+    saveCalls(id, Collections.singletonList(call));
   }
 
   void saveCalls(long id, List<KnoxShellTableCall> calls) {
@@ -64,9 +63,7 @@ class KnoxShellTableCallHistory {
   }
 
   void removeCallsById(long id) {
-    if (callHistory.containsKey(id)) {
-      callHistory.remove(id);
-    }
+    callHistory.remove(id);
   }
 
   public List<KnoxShellTableCall> getCallHistory(long id) {
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableJSONSerializer.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableJSONSerializer.java
index 748d71f..7ea1ce3 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableJSONSerializer.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableJSONSerializer.java
@@ -34,10 +34,13 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
  * Object</li>
  * <li>conditionally exclude certain fields from the serialized JSON
  * representation</li>
+ * </ol>
  */
 class KnoxShellTableJSONSerializer {
 
-   static final DateFormat JSON_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault());
+  // SimpleDateFormat is not thread safe must use as a ThreadLocal
+  static final ThreadLocal<DateFormat> JSON_DATE_FORMAT = ThreadLocal.withInitial(() ->
+       new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault()));
 
   /**
    * Serializes the given {@link KnoxShellTable}
@@ -57,7 +60,6 @@ class KnoxShellTableJSONSerializer {
     } else {
       filterProvider.addFilter("knoxShellTableFilter", SimpleBeanPropertyFilter.filterOutAllExcept("callHistoryList"));
     }
-    return JsonUtils.renderAsJsonString(table, filterProvider, JSON_DATE_FORMAT);
+    return JsonUtils.renderAsJsonString(table, filterProvider, JSON_DATE_FORMAT.get());
   }
-
 }
diff --git a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableRowDeserializer.java b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableRowDeserializer.java
index 2dc01d1..1838d45 100644
--- a/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableRowDeserializer.java
+++ b/gateway-shell/src/main/java/org/apache/knox/gateway/shell/table/KnoxShellTableRowDeserializer.java
@@ -31,7 +31,6 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.TreeNode;
 import com.fasterxml.jackson.databind.DeserializationContext;
 import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import com.fasterxml.jackson.databind.node.ObjectNode;
 
 /**
  * A custom @JsonDeserializer in order to be able to deserialize a previously
@@ -79,7 +78,7 @@ public class KnoxShellTableRowDeserializer extends StdDeserializer<KnoxShellTabl
   }
 
   private List<KnoxShellTableCall> parseCallHistoryListJSONNode(TreeNode callHistoryNode) throws IOException {
-    final List<KnoxShellTableCall> callHistoryList = new LinkedList<KnoxShellTableCall>();
+    final List<KnoxShellTableCall> callHistoryList = new LinkedList<>();
     TreeNode callNode;
     Map<Object, Class<?>> params;
     String invokerClass, method;
@@ -98,7 +97,7 @@ public class KnoxShellTableRowDeserializer extends StdDeserializer<KnoxShellTabl
   private Map<Object, Class<?>> fetchParameterMap(TreeNode paramsNode) throws IOException {
     try {
       final Map<Object, Class<?>> parameterMap = new HashMap<>();
-      final Iterator<String> paramsFieldNamesIterator = ((ObjectNode) paramsNode).fieldNames();
+      final Iterator<String> paramsFieldNamesIterator = paramsNode.fieldNames();
       String parameterValueAsString;
       Class<?> parameterType;
       while (paramsFieldNamesIterator.hasNext()) {
@@ -132,7 +131,7 @@ public class KnoxShellTableRowDeserializer extends StdDeserializer<KnoxShellTabl
     } else if (Boolean.class == type) {
       return Boolean.valueOf(valueAsString);
     } else if (Date.class == type) {
-      return KnoxShellTableJSONSerializer.JSON_DATE_FORMAT.parse(valueAsString);
+      return KnoxShellTableJSONSerializer.JSON_DATE_FORMAT.get().parse(valueAsString);
     }
 
     return type.cast(valueAsString); // may throw ClassCastException
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/DefaultDispatch.java b/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/DefaultDispatch.java
index 0f5d1f3..3cf9816 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/DefaultDispatch.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/DefaultDispatch.java
@@ -332,14 +332,14 @@ public class DefaultDispatch extends AbstractGatewayDispatch {
     if (excludedHeaderDirectives != null && excludedHeaderDirectives.containsKey(headerNameToCheck.toUpperCase(Locale.ROOT))) {
       final Set<String> excludedHeaderValues = excludedHeaderDirectives.get(headerNameToCheck.toUpperCase(Locale.ROOT));
       if (!excludedHeaderValues.isEmpty()) {
-        if (excludedHeaderValues.stream().filter(e -> e.equals(EXCLUDE_ALL)).findAny().isPresent()) {
+        if (excludedHeaderValues.stream().anyMatch(e -> e.equals(EXCLUDE_ALL))) {
           return ""; // we should exclude all -> there should not be any value added with this header
         } else {
           final String separator = SET_COOKIE.equalsIgnoreCase(headerNameToCheck) ? "; " : " ";
           Set<String> headerValuesToCheck = new HashSet<>(Arrays.asList(headerToCheck.getValue().trim().split("\\s+")));
           headerValuesToCheck = headerValuesToCheck.stream().map(h -> h.replaceAll(separator.trim(), "")).collect(Collectors.toSet());
           headerValuesToCheck.removeAll(excludedHeaderValues);
-          return headerValuesToCheck.isEmpty() ? "" : headerValuesToCheck.stream().collect(Collectors.joining(separator));
+          return headerValuesToCheck.isEmpty() ? "" : String.join(separator, headerValuesToCheck);
         }
       }
     }
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionPairComparator.java b/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionPairComparator.java
index 251a6a3..cea74c2 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionPairComparator.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/ServiceDefinitionPairComparator.java
@@ -20,17 +20,15 @@ package org.apache.knox.gateway.service.definition;
 import java.util.Comparator;
 
 public class ServiceDefinitionPairComparator implements Comparator<ServiceDefinitionPair> {
-
-  final ServiceDefinitionComparator serviceDefinitionComparator = new ServiceDefinitionComparator();
+  private static final ServiceDefinitionComparator SERVICE_DEFINITION_COMPARATOR = new ServiceDefinitionComparator();
 
   @Override
   public int compare(ServiceDefinitionPair serviceDefinitionPair, ServiceDefinitionPair otherServiceDefinitionPair) {
     final ServiceDefinition service = serviceDefinitionPair.getService();
     final ServiceDefinition otherService = otherServiceDefinitionPair.getService();
-    if (service == null || otherServiceDefinitionPair == null) {
+    if (service == null || otherService == null) {
       throw new IllegalArgumentException("One (or both) of the supplied service definitions is null");
     }
-    return serviceDefinitionComparator.compare(service, otherService);
+    return SERVICE_DEFINITION_COMPARATOR.compare(service, otherService);
   }
-
 }
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/UrlRewriteRulesDescriptorAdapter.java b/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/UrlRewriteRulesDescriptorAdapter.java
index 4928fbc..8acdf89 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/UrlRewriteRulesDescriptorAdapter.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/service/definition/UrlRewriteRulesDescriptorAdapter.java
@@ -61,7 +61,7 @@ public class UrlRewriteRulesDescriptorAdapter extends XmlAdapter<Object, UrlRewr
   @Override
   public Object marshal(UrlRewriteRulesDescriptor value) throws Exception {
     try (Writer writer = new StringWriter()) {
-      return (Node) xmlRewriteRulesExporter.store(value, writer, true);
+      return xmlRewriteRulesExporter.store(value, writer, true);
     }
   }
 }
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Topology.java b/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Topology.java
index 7b3066e..8f6e0e2 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Topology.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Topology.java
@@ -149,11 +149,7 @@ public class Topology {
   public void addProvider( Provider provider ) {
     providerList.add( provider );
     String role = provider.getRole();
-    Map<String,Provider> nameMap = providerMap.get( role );
-    if( nameMap == null ) {
-      nameMap = new HashMap<>();
-      providerMap.put( role, nameMap );
-    }
+    Map<String, Provider> nameMap = providerMap.computeIfAbsent(role, k -> new HashMap<>());
     nameMap.put( provider.getName(), provider );
   }
 
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/topology/discovery/ServiceDiscoveryFactory.java b/gateway-spi/src/main/java/org/apache/knox/gateway/topology/discovery/ServiceDiscoveryFactory.java
index 05b3398..c92cced 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/topology/discovery/ServiceDiscoveryFactory.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/topology/discovery/ServiceDiscoveryFactory.java
@@ -45,9 +45,8 @@ public abstract class ServiceDiscoveryFactory {
 
   public static Set<ServiceDiscovery> getAllServiceDiscoveries() {
     final Set<ServiceDiscovery> serviceDiscoveries = new HashSet<>();
-    ServiceLoader.load(ServiceDiscoveryType.class).forEach((serviceDiscoveryType) -> {
-      serviceDiscoveries.add(serviceDiscoveryType.newInstance());
-    });
+    ServiceLoader.load(ServiceDiscoveryType.class).forEach((serviceDiscoveryType) ->
+        serviceDiscoveries.add(serviceDiscoveryType.newInstance()));
     return serviceDiscoveries;
   }
 
@@ -59,16 +58,14 @@ public abstract class ServiceDiscoveryFactory {
   }
 
   private static void injectGatewayServices(final ServiceDiscovery serviceDiscovery, Service... gatewayServices) {
-    if (ArrayUtils.isNotEmpty(gatewayServices)) {
+    if (serviceDiscovery != null && ArrayUtils.isNotEmpty(gatewayServices)) {
       try {
         for (Field field : serviceDiscovery.getClass().getDeclaredFields()) {
           if (field.getDeclaredAnnotation(GatewayService.class) != null) {
             for (Service gatewayService : gatewayServices) {
-              if (gatewayService != null) {
-                if (field.getType().isAssignableFrom(gatewayService.getClass())) {
-                  field.setAccessible(true);
-                  field.set(serviceDiscovery, gatewayService);
-                }
+              if (gatewayService != null && field.getType().isAssignableFrom(gatewayService.getClass())) {
+                field.setAccessible(true);
+                field.set(serviceDiscovery, gatewayService);
               }
             }
           }
diff --git a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
index 60a2938..2f3d588 100644
--- a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
+++ b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
@@ -34,6 +34,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 public class GatewayTestConfig extends Configuration implements GatewayConfig {
 
@@ -67,7 +68,7 @@ public class GatewayTestConfig extends Configuration implements GatewayConfig {
   private String truststoreType = "jks";
   private String keystoreType = "jks";
   private boolean isTopologyPortMappingEnabled = true;
-  private ConcurrentHashMap<String, Integer> topologyPortMapping = new ConcurrentHashMap<>();
+  private ConcurrentMap<String, Integer> topologyPortMapping = new ConcurrentHashMap<>();
   private int backupVersionLimit = -1;
   private long backupAgeLimit = -1;
 
@@ -443,7 +444,7 @@ public class GatewayTestConfig extends Configuration implements GatewayConfig {
     return backupVersionLimit;
   }
 
-  public void setTopologyPortMapping(ConcurrentHashMap<String, Integer> topologyPortMapping) {
+  public void setTopologyPortMapping(ConcurrentMap<String, Integer> topologyPortMapping) {
     this.topologyPortMapping = topologyPortMapping;
   }
 
diff --git a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
index 4ee6a74..7c1cd1f 100644
--- a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
+++ b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
@@ -115,7 +115,7 @@ public class GatewayTestDriver {
   public void setupService( String role, String realUrl, String gatewayPath, boolean mock ) throws Exception {
     Service service = new Service( role, realUrl, gatewayPath, mock );
     services.put( role, service );
-    log.info( role + " port = " + service.server.getPort() );
+    log.info("{} port = {}", role, service.server.getPort());
   }
 
   /**
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/Console.java b/gateway-test-utils/src/main/java/org/apache/knox/test/Console.java
index e29c0d0..fe47efa 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/Console.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/Console.java
@@ -24,9 +24,12 @@ import java.nio.charset.StandardCharsets;
 
 public class Console {
 
-  PrintStream oldOut, newOut;
-  PrintStream oldErr, newErr;
-  ByteArrayOutputStream newOutBuf, newErrBuf;
+  PrintStream oldOut;
+  PrintStream newOut;
+  PrintStream oldErr;
+  PrintStream newErr;
+  ByteArrayOutputStream newOutBuf;
+  ByteArrayOutputStream newErrBuf;
 
   public void capture() throws UnsupportedEncodingException {
     oldErr = System.err;
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java b/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
index 163fd9a..63429cb 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
@@ -56,6 +56,9 @@ public class TestUtils {
   public static final long MEDIUM_TIMEOUT = 30 * 1000L;
   public static final long LONG_TIMEOUT = 60 * 1000L;
 
+  private TestUtils() {
+  }
+
   public static String getResourceName( Class clazz, String name ) {
     name = clazz.getName().replaceAll( "\\.", "/" ) + "/" + name;
     return name;
diff --git a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/DefaultConfigurationInjector.java b/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/DefaultConfigurationInjector.java
index ca57615..bfb191e 100755
--- a/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/DefaultConfigurationInjector.java
+++ b/gateway-util-configinjector/src/main/java/org/apache/knox/gateway/config/impl/DefaultConfigurationInjector.java
@@ -199,7 +199,7 @@ public class DefaultConfigurationInjector implements ConfigurationInjector {
   private static String getConfigName( String name, Annotation[] tags ) {
     if( tags != null ) {
       for( Annotation tag : tags ) {
-        if( tag != null && tag instanceof Alias ) {
+        if(tag instanceof Alias) {
           Alias aliasTag = (Alias) tag;
           String aliasValue = aliasTag.value().trim();
           if(!aliasValue.isEmpty()) {
diff --git a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Config.java b/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Config.java
index 20a26ff..b274e1f 100644
--- a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Config.java
+++ b/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Config.java
@@ -134,11 +134,7 @@ public class Config {
   public void set( String section, String name, String value ) {
     section = fixName( section );
     name = fixName( name );
-    Map<String,String> map = sections.get( section );
-    if( map == null ) {
-      map = new LinkedHashMap<>();
-      sections.put( section, map );
-    }
+    Map<String, String> map = sections.computeIfAbsent(section, k -> new LinkedHashMap<>());
     map.put( name, value );
   }
 
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
index 22f4a9e..b3878ec 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Template.java
@@ -336,7 +336,7 @@ public class Template {
   @Override
   public boolean equals(Object object ) {
     boolean equals = false;
-    if( object != null && object instanceof Template ) {
+    if(object instanceof Template) {
       String thisStr = toString();
       String thatStr = object.toString();
       equals = thisStr.equals( thatStr );
diff --git a/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/ParserTest.java b/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/ParserTest.java
index a89b0c0..16ab674 100644
--- a/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/ParserTest.java
+++ b/gateway-util-urltemplate/src/test/java/org/apache/knox/gateway/util/urltemplate/ParserTest.java
@@ -105,10 +105,9 @@ public class ParserTest {
   public void testCompleteUrl() throws URISyntaxException {
     String text;
     Template template;
-    Parser parser = new Parser();
 
     text = "foo://username:password@example.com:8042/over/there/index.dtb?type=animal&name=narwhal#nose";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, false, true, 3, 2 );
     assertThat( template.toString(), is( text ) );
   }
@@ -172,82 +171,81 @@ public class ParserTest {
 
   @Test
   public void testStaticPatterns() throws Exception {
-    Parser parser = new Parser();
     String text;
     Template template;
 
     text = "";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, false, 0, 0 );
     assertThat( template.toString(), is( text ) );
 
     text = "/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, false, 0, 0 );
     assertThat( template.toString(), is( text ) );
 
     text = "?";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, true, 0, 0 );
     assertThat( template.toString(), is( text ) );
 
     text = "#";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, false, 0, 0 );
     assertThat( template.hasFragment(), is( true ) );
     assertThat( template.getFragment(), nullValue() );
     assertThat( template.toString(), is( text ) );
 
     text = "path";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, false, 1, 0 );
     assertPath( template, 0, "", "path" );
     assertThat( template.toString(), is( text ) );
 
     text = "/path";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, false, false, 1, 0 );
     assertPath( template, 0, "", "path" );
     assertThat( template.toString(), is( text ) );
 
 //    text = "//path";
-//    template = parser.parseTemplate( text );
+//    template = Parser.parseTemplate( text );
 //    assertBasics( template, true, false, false, 1, 0 );
 //    assertPath( template, 0, "", "path" );
 
     text = "path/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, true, false, 1, 0 );
     assertPath( template, 0, "", "path" );
     assertThat( template.toString(), is( text ) );
 
     text = "path//";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, true, false, 1, 0 );
     assertPath( template, 0, "", "path" );
     //IMPROVE assertThat( template.toString(), is( text ) );
     assertThat( template.getPattern(), is( text ) );
 
     text = "/path/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, false, 1, 0 );
     assertPath( template, 0, "", "path" );
     assertThat( template.toString(), is( text ) );
 
 //    text = "//path//";
-//    template = parser.parseTemplate( text );
+//    template = Parser.parseTemplate( text );
 //    assertBasics( template, true, true, false, 1, 0 );
 //    assertPath( template, 0, "", "path" );
 
     text = "pathA/pathB";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
     assertThat( template.toString(), is( text ) );
 
     text = "pathA//pathB";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
@@ -255,14 +253,14 @@ public class ParserTest {
     assertThat( template.getPattern(), is( text ) );
 
     text = "/pathA/pathB";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, false, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
     assertThat( template.toString(), is( text ) );
 
     text = "/pathA//pathB";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, false, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
@@ -270,14 +268,14 @@ public class ParserTest {
     assertThat( template.getPattern(), is( text ) );
 
     text = "pathA/pathB/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, true, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
     assertThat( template.toString(), is( text ) );
 
     text = "pathA//pathB/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, true, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
@@ -285,14 +283,14 @@ public class ParserTest {
     assertThat( template.getPattern(), is( text ) );
 
     text = "/pathA/pathB/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
     assertThat( template.toString(), is( text ) );
 
     text = "/pathA//pathB/";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, false, 2, 0 );
     assertPath( template, 0, "", "pathA" );
     assertPath( template, 1, "", "pathB" );
@@ -300,29 +298,29 @@ public class ParserTest {
     assertThat( template.getPattern(), is( text ) );
 
     text = "/?";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, true, 0, 0 );
     assertThat( template.toString(), is( text ) );
 
 //    text = "//??";
-//    template = parser.parseTemplate( text );
+//    template = Parser.parseTemplate( text );
 //    assertBasics( template, true, true, true, 0, 0 );
 
     text = "?name=value";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, true, 0, 1 );
     assertQuery( template, "name", "", "value" );
     assertThat( template.toString(), is( text ) );
 
     text = "?name1=value1&name2=value2";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, true, 0, 2 );
     assertQuery( template, "name1", "", "value1" );
     assertQuery( template, "name2", "", "value2" );
     assertThat( template.toString(), is( text ) );
 
     text = "?name1=value1&&name2=value2";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, true, 0, 2 );
     assertQuery( template, "name1", "", "value1" );
     assertQuery( template, "name2", "", "value2" );
@@ -330,13 +328,13 @@ public class ParserTest {
     assertThat( template.getPattern(), is( text ) );
 
     text = "/?name=value";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, true, 0, 1 );
     assertQuery( template, "name", "", "value" );
     assertThat( template.toString(), is( text ) );
 
     text = "/?name1=value1&name2=value2";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, true, true, true, 0, 2 );
     assertQuery( template, "name1", "", "value1" );
     assertQuery( template, "name2", "", "value2" );
@@ -349,12 +347,11 @@ public class ParserTest {
    */
   @Test
   public void testEncodedChar() throws URISyntaxException {
-    Parser parser = new Parser();
     String text;
     Template template;
 
     text = "stage?id=007&amp;attempt=0";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, true, 1, 2 );
     assertQuery( template, "id", "", "007" );
     assertQuery( template, "attempt", "", "0" );
@@ -682,7 +679,6 @@ public class ParserTest {
 
   @Test
   public void testEdgeCases() throws URISyntaxException {
-    Parser parser = new Parser();
     String text;
     Template template;
 
@@ -733,7 +729,7 @@ public class ParserTest {
     assertThat( template.toString(), is( text ) );
 
     text = ":";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertBasics( template, false, false, false, 1, 0 );
     assertThat( template.hasScheme(), is( false ) );
     assertThat( template.getScheme(), nullValue() );
@@ -1045,14 +1041,12 @@ public class ParserTest {
 
   @Test
   public void testQueryNameWithoutValue() throws URISyntaxException {
-    Parser parser = new Parser();
     String text;
     Template template;
     String string;
-    Expander expander = new Expander();
 
     text = "*://*:*/**?X";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( true ) );
     assertThat( template.getScheme().getParamName(), is( "" ) );
     assertThat( template.getScheme().getFirstValue().getOriginalPattern(), is( "*" ) );
@@ -1070,7 +1064,7 @@ public class ParserTest {
     assertThat( template.hasAuthority(), is( true ) );
     assertThat( template, notNullValue() );
     assertThat( template.getQuery().get( "X" ), notNullValue() );
-    string = expander.expandToString( template, null, null );
+    string = Expander.expandToString( template, null, null );
     assertThat( string, is( text ) );
     assertThat( template.toString(), is( text ) );
 
@@ -1078,7 +1072,7 @@ public class ParserTest {
     template = Parser.parseTemplate( text );
     assertThat( template, notNullValue() );
     assertThat( template.getQuery().get( "X" ), notNullValue() );
-    string = expander.expandToString( template, null, null );
+    string = Expander.expandToString( template, null, null );
     assertThat( string, is( "*://*:*/**?X" ) );
     //IMPROVE assertThat( template.toString(), is( text ) );
     assertThat( template.getPattern(), is( text ) );
@@ -1087,7 +1081,7 @@ public class ParserTest {
     template = Parser.parseTemplate( text );
     assertThat( template, notNullValue() );
     assertThat( template.getQuery().get( "aG9zdD1sb2NhbGhvc3QmcG9ydD02MjEzOSZvcD1DUkVBVEUmdXNlci5uYW1lPWhkZnM" ), notNullValue() );
-    string = expander.expandToString( template, null, null );
+    string = Expander.expandToString( template, null, null );
     assertThat( string, is( "http://localhost:62142/gateway/cluster/webhdfs/data/v1/tmp/GatewayWebHdfsFuncTest/testBasicHdfsUseCase/dir/file?aG9zdD1sb2NhbGhvc3QmcG9ydD02MjEzOSZvcD1DUkVBVEUmdXNlci5uYW1lPWhkZnM" ) );
     assertThat( template.toString(), is( text ) );
 
@@ -1095,7 +1089,7 @@ public class ParserTest {
     template = Parser.parseTemplate( text );
     assertThat( template, notNullValue() );
     assertThat( template.getQuery().get( "aG9zdD1sb2NhbGhvc3QmcG9ydD02MjEzOSZvcD1DUkVBVEUmdXNlci5uYW1lPWhkZnM" ), notNullValue() );
-    string = expander.expandToString( template, null, null );
+    string = Expander.expandToString( template, null, null );
     assertThat( string, is( "http://localhost:62142/gateway/cluster/webhdfs/data/v1/tmp/GatewayWebHdfsFuncTest/testBasicHdfsUseCase/dir/file?aG9zdD1sb2NhbGhvc3QmcG9ydD02MjEzOSZvcD1DUkVBVEUmdXNlci5uYW1lPWhkZnM" ) );
     //IMPROVE assertThat( template.toString(), is( text ) );
     assertThat( template.getPattern(), is( text ) );
@@ -1105,10 +1099,9 @@ public class ParserTest {
   public void testTemplateWithOnlyAuthority() throws Exception {
     String text;
     Template template;
-    Parser parser = new Parser();
 
     text = "test-host:42";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( false ) );
     assertThat( template.getHost().getFirstValue().getOriginalPattern(), is( "test-host" ) );
     assertThat( template.getHost().getFirstValue().getEffectivePattern(), is( "test-host" ) );
@@ -1117,7 +1110,7 @@ public class ParserTest {
     assertThat( template.toString(), is( text ) );
 
     text = "{test-host}:{test-port}";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( false ) );
     assertThat( template.getHost().getParamName(), is( "test-host" ) );
     assertThat( template.getHost().getFirstValue().getToken().getOriginalPattern(), nullValue() );
@@ -1132,10 +1125,9 @@ public class ParserTest {
   public void testTemplateWithoutAuthority() throws Exception {
     String text;
     Template template;
-    Parser parser = new Parser();
 
     text = "test-scheme:/test-path";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( true ) );
     assertThat( template.getScheme().getFirstValue().getOriginalPattern(), is( "test-scheme" ) );
     assertThat( template.getScheme().getFirstValue().getEffectivePattern(), is( "test-scheme" ) );
@@ -1147,7 +1139,7 @@ public class ParserTest {
     assertThat( template.toString(), is( text ) );
 
     text = "test-scheme:///test-path";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( true ) );
     assertThat( template.getScheme().getFirstValue().getOriginalPattern(), is( "test-scheme" ) );
     assertThat( template.getScheme().getFirstValue().getEffectivePattern(), is( "test-scheme" ) );
@@ -1162,7 +1154,7 @@ public class ParserTest {
     assertThat( template.toString(), is( text ) );
 
     text = "{test-scheme}:/{test-path}";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( true ) );
     assertThat( template.getScheme().getParamName(), is( "test-scheme" ) );
     assertThat( template.getScheme().getFirstValue().getOriginalPattern(), nullValue() );
@@ -1176,7 +1168,7 @@ public class ParserTest {
     assertThat( template.toString(), is( text ) );
 
     text = "{test-scheme}:///{test-path}";
-    template = parser.parseTemplate( text );
+    template = Parser.parseTemplate( text );
     assertThat( template.hasScheme(), is( true ) );
     assertThat( template.getScheme().getParamName(), is( "test-scheme" ) );
     assertThat( template.getScheme().getFirstValue().getOriginalPattern(), nullValue() );
diff --git a/pom.xml b/pom.xml
index 8685f94..ed141a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -167,14 +167,14 @@
         <commons-configuration.version>1.10</commons-configuration.version>
         <commons-digester3.version>3.2</commons-digester3.version>
         <commons-io.version>2.6</commons-io.version>
-	<commons-lang.version>2.6</commons-lang.version>
+        <commons-lang.version>2.6</commons-lang.version>
         <commons-lang3.version>3.9</commons-lang3.version>
         <commons-logging.version>1.2</commons-logging.version>
         <commons-math3.version>3.6.1</commons-math3.version>
         <commons-net.version>3.6</commons-net.version>
         <commons-text.version>1.8</commons-text.version>
         <cors-filter.version>2.8</cors-filter.version>
-	<cryptacular.version>1.2.3</cryptacular.version>
+        <cryptacular.version>1.2.3</cryptacular.version>
         <curator.version>4.2.0</curator.version>
         <dependency-check-maven.version>5.2.2</dependency-check-maven.version>
         <dockerfile-maven-plugin.version>1.4.13</dockerfile-maven-plugin.version>


Mime
View raw message