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-1663 - Checkstyle - Enable EqualsAvoidNullCheck and don't instantiate Boolean
Date Tue, 18 Dec 2018 11:36:31 GMT
Repository: knox
Updated Branches:
  refs/heads/master c8cfa3309 -> 7cda49a71


KNOX-1663 - Checkstyle - Enable EqualsAvoidNullCheck and don't instantiate Boolean

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

Branch: refs/heads/master
Commit: 7cda49a71c05a65a3b28f2ee4532fb83d8ea9a14
Parents: c8cfa33
Author: Kevin Risden <krisden@apache.org>
Authored: Mon Dec 17 10:32:29 2018 -0500
Committer: Kevin Risden <krisden@apache.org>
Committed: Tue Dec 18 06:00:25 2018 -0500

----------------------------------------------------------------------
 .../src/main/resources/build-tools/checkstyle/checker.xml    | 8 +++++---
 .../src/main/java/org/apache/knox/gateway/GatewayFilter.java | 2 +-
 .../org/apache/knox/gateway/deploy/DeploymentFactory.java    | 2 +-
 .../src/main/java/org/apache/knox/gateway/util/KnoxCLI.java  | 4 ++--
 4 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/7cda49a7/build-tools/src/main/resources/build-tools/checkstyle/checker.xml
----------------------------------------------------------------------
diff --git a/build-tools/src/main/resources/build-tools/checkstyle/checker.xml b/build-tools/src/main/resources/build-tools/checkstyle/checker.xml
index 268259d..b2a960e 100644
--- a/build-tools/src/main/resources/build-tools/checkstyle/checker.xml
+++ b/build-tools/src/main/resources/build-tools/checkstyle/checker.xml
@@ -66,10 +66,12 @@ limitations under the License.
         <module name="EqualsHashCode"/>
         <!-- Enforce array type style -->
         <module name="ArrayTypeStyle"/>
+        <!-- Constant on left of equals -->
+        <module name="EqualsAvoidNullCheck"/>
         <!-- Disallow unnecessary instantiation of Boolean, String -->
-        <!--<module name="IllegalInstantiation">
-            <property name="classes" value="java.lang.Boolean, java.lang.String"/>
-        </module>-->
+        <module name="IllegalInstantiation">
+            <property name="classes" value="java.lang.Boolean"/>
+        </module>
         <!-- Switch statements should be complete and with independent cases -->
         <!--<module name="FallThrough"/>-->
         <module name="SimplifyBooleanExpression"/>

http://git-wip-us.apache.org/repos/asf/knox/blob/7cda49a7/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 2c730b7..afd2ba7 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/GatewayFilter.java
@@ -134,7 +134,7 @@ public class GatewayFilter implements Filter {
             match = chains.match(Parser.parseLiteral(newPathWithQuery));
             String origUrl = ((HttpServletRequest) servletRequest).getRequestURL().toString();
             String url = origUrl;
-            if (path == null || path.equals("/")) {
+            if (path == null || "/".equals(path)) {
               url += defaultServicePath;
             } else {
               int index = origUrl.indexOf(path);

http://git-wip-us.apache.org/repos/asf/knox/blob/7cda49a7/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 d6d54da..1c2a6c2 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
@@ -347,7 +347,7 @@ public abstract class DeploymentFactory {
           urls.add( "/" + name );
         }
         for( String url : urls ) {
-          if( url == null || url.isEmpty() || url.equals( "/" ) ) {
+          if( url == null || url.isEmpty() || "/".equals(url) ) {
             if( !topology.getServices().isEmpty() ) {
               throw new DeploymentException( String.format(Locale.ROOT,
                   "Topologies with services cannot contain an application (%s) with a root
url.", name ) );

http://git-wip-us.apache.org/repos/asf/knox/blob/7cda49a7/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java
----------------------------------------------------------------------
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 4a68365..8987db9 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
@@ -208,7 +208,7 @@ public class KnoxCLI extends Configured implements Tool {
           alias = args[++i];
         }
         command = new AliasDeleteCommand(alias);
-        if (alias == null || alias.equals("--help")) {
+        if (alias == null || "--help".equals(alias)) {
           printKnoxShellUsage();
           return -1;
         }
@@ -218,7 +218,7 @@ public class KnoxCLI extends Configured implements Tool {
           alias = args[++i];
         }
         command = new AliasCreateCommand(alias);
-        if (alias == null || alias.equals("--help")) {
+        if (alias == null || "--help".equals(alias)) {
           printKnoxShellUsage();
           return -1;
         }


Mime
View raw message