knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kris...@apache.org
Subject knox git commit: KNOX-1667 - Enable PMD error prone ruleset
Date Tue, 11 Dec 2018 15:21:13 GMT
Repository: knox
Updated Branches:
  refs/heads/master be7f4f37e -> f7eb4538b


KNOX-1667 - Enable PMD error prone ruleset

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


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

Branch: refs/heads/master
Commit: f7eb4538bcd49905944fbd665cf689b1beda85d9
Parents: be7f4f3
Author: Kevin Risden <krisden@apache.org>
Authored: Mon Dec 10 18:34:56 2018 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Tue Dec 11 09:43:50 2018 -0500

----------------------------------------------------------------------
 .../resources/build-tools/pmd/pmd-ruleset.xml   | 29 ++++++++---
 .../discovery/ambari/AmbariCluster.java         |  3 +-
 .../i18n/resources/ResourcesInvoker.java        |  2 +-
 .../rewrite/impl/json/JsonFilterReader.java     |  4 +-
 .../org/apache/knox/gateway/GatewayFilter.java  | 20 ++++----
 .../knox/gateway/deploy/DeploymentFactory.java  | 12 ++---
 .../topology/impl/DefaultTopologyService.java   | 20 ++++----
 .../knox/gateway/trace/AccessHandler.java       |  2 +-
 .../apache/knox/gateway/trace/TraceInput.java   |  6 +--
 .../apache/knox/gateway/trace/TraceOutput.java  |  5 +-
 .../apache/knox/gateway/trace/TraceRequest.java |  5 +-
 .../knox/gateway/trace/TraceResponse.java       |  6 +--
 .../apache/knox/gateway/GatewayTestDriver.java  |  3 +-
 .../java/org/apache/knox/test/TestUtils.java    |  3 +-
 .../org/apache/knox/test/mock/MockServer.java   |  3 +-
 .../apache/knox/gateway/launcher/Streamer.java  | 52 --------------------
 16 files changed, 64 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
----------------------------------------------------------------------
diff --git a/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml b/build-tools/src/main/resources/build-tools/pmd/pmd-ruleset.xml
index 1f659dc..a36e899 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
@@ -42,12 +42,29 @@ limitations under the License.
     <!--<rule ref="category/java/codestyle.xml" />-->
     <!--<rule ref="category/java/design.xml" />-->
     <!--<rule ref="category/java/documentation.xml" />-->
-    <!--<rule ref="category/java/errorprone.xml">-->
-        <!--<exclude name="AvoidFieldNameMatchingMethodName" />-->
-        <!--<exclude name="BeanMembersShouldSerialize" />-->
-        <!--<exclude name="DataflowAnomalyAnalysis" />-->
-        <!--<exclude name="EmptyCatchBlock" />-->
-    <!--</rule>-->
+    <rule ref="category/java/errorprone.xml">
+        <exclude name="AssignmentInOperand" />
+        <exclude name="AssignmentToNonFinalStatic" />
+        <exclude name="AvoidBranchingStatementAsLastInLoop" />
+        <exclude name="AvoidCatchingNPE" />
+        <exclude name="AvoidCatchingThrowable" />
+        <exclude name="AvoidDuplicateLiterals" />
+        <exclude name="AvoidFieldNameMatchingMethodName" />
+        <exclude name="AvoidLiteralsInIfCondition" />
+        <exclude name="BeanMembersShouldSerialize" />
+        <exclude name="ConstructorCallsOverridableMethod" />
+        <exclude name="DataflowAnomalyAnalysis" />
+        <exclude name="DoNotCallSystemExit" />
+        <exclude name="EmptyCatchBlock" />
+        <exclude name="EmptyIfStmt" />
+        <exclude name="LoggerIsNotStaticFinal" />
+        <exclude name="MissingBreakInSwitch" />
+        <exclude name="MissingSerialVersionUID" />
+        <exclude name="MoreThanOneLogger" />
+        <exclude name="NullAssignment" />
+        <exclude name="ReturnEmptyArrayRatherThanNull" />
+        <exclude name="UseProperClassLoader" />
+    </rule>
     <!--<rule ref="category/java/multithreading.xml" />-->
     <rule ref="category/java/performance.xml">
         <exclude name="AvoidInstantiatingObjectsInLoops" />

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
----------------------------------------------------------------------
diff --git a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
index be47d63..7a46133 100644
--- a/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
+++ b/gateway-discovery-ambari/src/main/java/org/apache/knox/gateway/topology/discovery/ambari/AmbariCluster.java
@@ -262,7 +262,8 @@ class AmbariCluster implements ServiceDiscovery.Cluster {
                     host = host.substring(0, portIndex);
                 }
                 updatedEnsemble.append(host).append(':').append(port);
-                if (++index < hosts.length) {
+                index += 1;
+                if (index < hosts.length) {
                     updatedEnsemble.append(',');
                 }
             }

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
----------------------------------------------------------------------
diff --git a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
index 02000c0..307d5fa 100644
--- a/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
+++ b/gateway-i18n/src/main/java/org/apache/knox/gateway/i18n/resources/ResourcesInvoker.java
@@ -143,7 +143,7 @@ public class ResourcesInvoker implements InvocationHandler {
   protected final ResourceBundle findBundle() {
     final Locale locale = Locale.getDefault();
     ResourceBundle bundle = bundles.get( locale );
-    if( bundle == MISSING_BUNDLE ) {
+    if( MISSING_BUNDLE.equals(bundle) ) {
       bundle = null;
     } else if ( bundle == null ) {
       try {

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
b/gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java
index d3592c3..669ed90 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
@@ -200,7 +200,7 @@ class JsonFilterReader extends Reader {
     Level child;
     Level parent;
     child = stack.pop();
-    if( bufferingLevel == child ) {
+    if( child.equals(bufferingLevel) ) {
       filterBufferedNode( child );
       mapper.writeTree( generator, child.node );
       bufferingLevel = null;
@@ -264,7 +264,7 @@ class JsonFilterReader extends Reader {
     Level child;
     Level parent;
     child = stack.pop();
-    if( bufferingLevel == child ) {
+    if( child.equals(bufferingLevel) ) {
       filterBufferedNode( child );
       mapper.writeTree( generator, child.node );
       bufferingLevel = null;

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
index aabce03..2c730b7 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
@@ -218,7 +218,7 @@ public class GatewayFilter implements Filter {
       chain.setResourceRole( holder.getResourceRole() );
       chains.add( holder.template, chain );
     }
-    chain.chain.add( holder );
+    chain.chainList.add( holder );
   }
 
   public void addFilter( String path, String name, Filter filter, Map<String,String>
params, String resourceRole ) throws URISyntaxException {
@@ -244,30 +244,29 @@ public class GatewayFilter implements Filter {
   }
 
   private class Chain implements FilterChain {
-
-    private List<Holder> chain;
+    private List<Holder> chainList;
     private String resourceRole;
 
     Chain() {
-      this.chain = new ArrayList<>();
+      this.chainList = new ArrayList<>();
     }
 
-    Chain( List<Holder> chain ) {
-      this.chain = chain;
+    Chain( List<Holder> chainList) {
+      this.chainList = chainList;
     }
 
     @Override
     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse )
throws IOException, ServletException {
-      if( chain != null && !chain.isEmpty() ) {
-        final Filter filter = chain.get( 0 );
+      if( chainList != null && !chainList.isEmpty() ) {
+        final Filter filter = chainList.get( 0 );
         final FilterChain chain = subChain();
         filter.doFilter( servletRequest, servletResponse, chain );
       }
     }
 
     private FilterChain subChain() {
-      if( chain != null && chain.size() > 1 ) {
-        return new Chain( chain.subList( 1, chain.size() ) );
+      if( chainList != null && chainList.size() > 1 ) {
+        return new Chain( chainList.subList( 1, chainList.size() ) );
       } else {
         return EMPTY_CHAIN;
       }
@@ -280,7 +279,6 @@ public class GatewayFilter implements Filter {
     private void setResourceRole( String resourceRole ) {
       this.resourceRole = resourceRole;
     }
-
   }
 
   private class Holder implements Filter, FilterConfig {

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
b/gateway-server/src/main/java/org/apache/knox/gateway/deploy/DeploymentFactory.java
index 59f014f..ae6fbb1 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
@@ -125,7 +125,7 @@ public abstract class DeploymentFactory {
             List<Application> dups = findApplicationsByUrl( topology, url );
             if( dups != null ) {
               for( Application dup : dups ) {
-                if( dup != app ) {
+                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 );
                 }
               }
@@ -182,7 +182,7 @@ public abstract class DeploymentFactory {
     DeploymentContext context = createDeploymentContext( config, "/", topology, providers
);
     initialize( context, providers, services, null );
     contribute( context, providers, services, null );
-    finalize( context, providers, services, null );
+    finish( context, providers, services, null );
     return context.getWebArchive();
   }
 
@@ -195,7 +195,7 @@ public abstract class DeploymentFactory {
     DeploymentContext context = createDeploymentContext( config, appPath, topology, providers
);
     initialize( context, providers, null, application );
     contribute( context, providers, null, application );
-    finalize( context, providers, null, application );
+    finish( context, providers, null, application );
     return context.getWebArchive();
   }
 
@@ -563,7 +563,7 @@ public abstract class DeploymentFactory {
     return contributor;
   }
 
-  private static void finalize(
+  private static void finish(
       DeploymentContext context,
       Map<String,List<ProviderDeploymentContributor>> providers,
       Map<String,List<ServiceDeploymentContributor>> services,
@@ -622,7 +622,7 @@ public abstract class DeploymentFactory {
           } catch( Exception e ) {
             // Maybe it makes sense to throw exception
             log.failedToFinalizeContribution( e );
-            throw new DeploymentException( "Failed to finalize contribution.", e );
+            throw new DeploymentException( "Failed to finish contribution.", e );
           }
         }
       }
@@ -639,7 +639,7 @@ public abstract class DeploymentFactory {
           } catch( Exception e ) {
             // Maybe it makes sense to throw exception
             log.failedToFinalizeContribution( e );
-            throw new DeploymentException( "Failed to finalize contribution.", e );
+            throw new DeploymentException( "Failed to finish contribution.", e );
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/services/topology/impl/DefaultTopologyService.java
----------------------------------------------------------------------
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 2d501f1..a3b9021 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
@@ -846,11 +846,11 @@ public class DefaultTopologyService
         // When a simple descriptor has been created or modified, generate the new topology
descriptor
         Map<String, File> result = SimpleDescriptorHandler.handle(gatewayConfig, file,
topologiesDir, aliasService);
         log.generatedTopologyForDescriptorChange(result.get(SimpleDescriptorHandler.RESULT_TOPOLOGY).getName(),
-                                                 file.getName());
+            file.getName());
 
         // Add the provider config reference relationship for handling updates to the provider
config
         String providerConfig =
-                      FilenameUtils.normalize(result.get(SimpleDescriptorHandler.RESULT_REFERENCE).getAbsolutePath());
+            FilenameUtils.normalize(result.get(SimpleDescriptorHandler.RESULT_REFERENCE).getAbsolutePath());
         if (!providerConfigReferences.containsKey(providerConfig)) {
           providerConfigReferences.put(providerConfig, new ArrayList<>());
         }
@@ -866,20 +866,18 @@ public class DefaultTopologyService
           refs.add(descriptorName);
           log.addedProviderConfigurationReference(descriptorName, providerConfig);
         }
-      } catch (Exception e) {
+      } catch (IllegalArgumentException e) {
         log.simpleDescriptorHandlingError(file.getName(), e);
 
         // If the referenced provider configuration is invalid, remove any existing reference
relationships for the
         // referencing descriptor.
-        if (e instanceof IllegalArgumentException) {
-          String descriptorName = FilenameUtils.normalize(file.getAbsolutePath());
-          // Need to check if descriptor had previously referenced another provider config,
so it can be removed
-          for (List<String> descs : providerConfigReferences.values()) {
-            if (descs.contains(descriptorName)) {
-              descs.remove(descriptorName);
-            }
-          }
+        String descriptorName = FilenameUtils.normalize(file.getAbsolutePath());
+        // Need to check if descriptor had previously referenced another provider config,
so it can be removed
+        for (List<String> descs : providerConfigReferences.values()) {
+          descs.remove(descriptorName);
         }
+      } catch (Exception e) {
+        log.simpleDescriptorHandlingError(file.getName(), e);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
b/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
index 53eef68..4411dbd 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/AccessHandler.java
@@ -24,7 +24,7 @@ import org.eclipse.jetty.server.Response;
 import org.eclipse.jetty.util.component.AbstractLifeCycle;
 
 public class AccessHandler extends AbstractLifeCycle implements RequestLog {
-  private static Logger log = Logger.getLogger( "org.apache.knox.gateway.access" );
+  private static final Logger log = Logger.getLogger( "org.apache.knox.gateway.access" );
 
   @Override
   public void log( Request request, Response response ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
index 1840cef..1e146e5 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceInput.java
@@ -25,9 +25,8 @@ import java.io.IOException;
 import java.util.Locale;
 
 class TraceInput extends SynchronousServletInputStreamAdapter {
-
-  private static Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
-  private static Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_BODY_LOGGER
);
+  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
+  private static final Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_BODY_LOGGER
);
 
   private ServletInputStream delegate;
 
@@ -68,5 +67,4 @@ class TraceInput extends SynchronousServletInputStreamAdapter {
       }
     }
   }
-
 }

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
index 38ff2fb..6fb6ed9 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceOutput.java
@@ -25,9 +25,8 @@ import java.io.IOException;
 import java.util.Locale;
 
 class TraceOutput extends SynchronousServletOutputStreamAdapter {
-
-  private static Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
-  private static Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_BODY_LOGGER
);
+  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
+  private static final Logger bodyLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_BODY_LOGGER
);
 
   private ServletOutputStream delegate;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
index a48501e..4fbbf64 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceRequest.java
@@ -27,9 +27,8 @@ import java.util.Enumeration;
 import java.util.Locale;
 
 class TraceRequest extends HttpServletRequestWrapper {
-
-  private static Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
-  private static Logger headLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_HEADER_LOGGER
);
+  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_REQUEST_LOGGER );
+  private static final Logger headLog = Logger.getLogger( TraceHandler.HTTP_REQUEST_HEADER_LOGGER
);
 
   private ServletInputStream input;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
index 8605199..ac1e3c4 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/trace/TraceResponse.java
@@ -28,9 +28,8 @@ import java.util.Locale;
 import java.util.Set;
 
 class TraceResponse extends HttpServletResponseWrapper {
-
-  private static Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
-  private static Logger headLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_HEADER_LOGGER
);
+  private static final Logger log = Logger.getLogger( TraceHandler.HTTP_RESPONSE_LOGGER );
+  private static final Logger headLog = Logger.getLogger( TraceHandler.HTTP_RESPONSE_HEADER_LOGGER
);
 
   private ServletOutputStream output;
   private Set<Integer> filter;
@@ -73,7 +72,6 @@ class TraceResponse extends HttpServletResponseWrapper {
       }
     }
   }
-
 }
 
 

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestDriver.java
----------------------------------------------------------------------
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 8b95648..f55ace2 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
@@ -62,8 +62,7 @@ import com.mycila.xmltool.XMLTag;
  * 4) Provides methods to access test resources.
  */
 public class GatewayTestDriver {
-
-  private static Logger log = LoggerFactory.getLogger( GatewayTestDriver.class );
+  private static final Logger log = LoggerFactory.getLogger( GatewayTestDriver.class );
 
   public Class<?> resourceBaseClass;
   public Map<String,Service> services = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
----------------------------------------------------------------------
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 f17668d..b7f204c 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
@@ -50,8 +50,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 
 public class TestUtils {
-
-  private static Logger LOG = Logger.getLogger(TestUtils.class);
+  private static final Logger LOG = Logger.getLogger(TestUtils.class);
 
   public static final long SHORT_TIMEOUT = 1000L;
   public static final long MEDIUM_TIMEOUT = 30 * 1000L;

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
----------------------------------------------------------------------
diff --git a/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java b/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
index fb8afa1..6808d66 100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/mock/MockServer.java
@@ -44,8 +44,7 @@ import java.util.Queue;
  * The whole idea was modeled after how the REST testing framework REST-assured and aims
to be a server side equivalent.
  */
 public class MockServer {
-
-  private Logger log = LoggerFactory.getLogger( this.getClass() );
+  private static final Logger log = LoggerFactory.getLogger( MockServer.class );
 
   private String name;
   private Server jetty;

http://git-wip-us.apache.org/repos/asf/knox/blob/f7eb4538/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Streamer.java
----------------------------------------------------------------------
diff --git a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Streamer.java
b/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Streamer.java
deleted file mode 100644
index 90fa9da..0000000
--- a/gateway-util-launcher/src/main/java/org/apache/knox/gateway/launcher/Streamer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.knox.gateway.launcher;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class Streamer extends Thread {
-
-  InputStream input;
-  OutputStream output;
-  byte[] buffer;
-
-  private Streamer( String name, InputStream input, OutputStream output, int buffer, int
priority ) {
-    this.buffer = new byte[ buffer ];
-    this.setName( name );
-    this.setPriority( priority );
-    this.start();
-    this.input = input;
-    this.output = output;
-  }
-
-  @Override
-  public void run() {
-    try {
-      int read = input.read( buffer );
-      while( read >= 0 ) {
-        output.write( buffer, 0, read );
-        read = input.read( buffer );
-      }
-    } catch( IOException e ) {
-      e.printStackTrace(); // I18N not possible/required.
-    }
-  }
-
-}


Mime
View raw message