knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [06/24] knox git commit: KNOX-1020 - Minor code improvements
Date Fri, 08 Sep 2017 15:14:59 GMT
KNOX-1020 - Minor code improvements


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

Branch: refs/heads/KNOX-998-Package_Restructuring
Commit: 6135abd3997fb5eaa08b83dec0158f67d1a13ae9
Parents: f4de856
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Sep 4 18:18:00 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Sep 4 18:18:00 2017 +0100

----------------------------------------------------------------------
 .../function/UsernameFunctionProcessor.java     |  2 +-
 .../filter/HadoopGroupProviderFilterTest.java   | 12 +++++------
 .../SwitchCaseIdentityAssertionFilter.java      |  2 +-
 .../rewrite/impl/FrontendFunctionProcessor.java |  2 +-
 .../impl/html/HtmlImportFunctionProcessor.java  |  2 +-
 .../rewrite/impl/html/HtmlPrefixProcessor.java  |  2 +-
 .../rewrite/impl/json/JsonFilterReader.java     |  4 ++--
 .../gateway/filter/AclsAuthorizationFilter.java |  6 +++---
 .../federation/AbstractJWTFilterTest.java       | 22 ++++++++++----------
 .../federation/SSOCookieProviderTest.java       |  4 ++--
 .../webappsec/deploy/WebAppSecContributor.java  |  6 +++---
 .../webappsec/XFrameOptionsFilterTest.java      | 12 +++++------
 .../apache/hadoop/gateway/GatewayServer.java    |  8 +++----
 .../impl/ApplicationDeploymentContributor.java  |  2 +-
 .../ServiceDefinitionDeploymentContributor.java |  2 +-
 .../gateway/dispatch/UrlConnectionDispatch.java |  2 +-
 .../topology/validation/TopologyValidator.java  |  2 +-
 .../org/apache/hadoop/gateway/util/KnoxCLI.java |  2 +-
 .../service/admin/TopologiesResource.java       |  2 +-
 .../hadoop/gateway/security/SubjectUtils.java   |  4 ++--
 .../security/principal/PrincipalMapperTest.java |  8 +++----
 .../hadoop/gateway/util/IpAddressValidator.java |  2 +-
 .../gateway/config/AdapterSampleTest.java       | 19 ++++++++++-------
 .../apache/hadoop/gateway/config/FuncTest.java  | 12 +++++------
 .../gateway/util/urltemplate/Expander.java      |  4 ++--
 .../gateway/util/urltemplate/Matcher.java       |  2 +-
 .../gateway/util/urltemplate/Template.java      |  2 +-
 27 files changed, 76 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
b/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
index cc5d39d..65fcedd 100644
--- a/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
+++ b/gateway-provider-identity-assertion-common/src/main/java/org/apache/hadoop/gateway/identityasserter/common/function/UsernameFunctionProcessor.java
@@ -63,7 +63,7 @@ public class UsernameFunctionProcessor
       results = new ArrayList<String>( 1 );
       String username = SubjectUtils.getEffectivePrincipalName(subject);
       results.add( username );
-    } else if( parameters != null && parameters.size() > 0 ) {
+    } else if( parameters != null && !parameters.isEmpty() ) {
       results = new ArrayList<String>( 1 );
       results.add( parameters.get( 0 ) );
     }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-identity-assertion-hadoop-groups/src/test/java/org/apache/hadoop/gateway/identityasserter/hadoop/groups/filter/HadoopGroupProviderFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-hadoop-groups/src/test/java/org/apache/hadoop/gateway/identityasserter/hadoop/groups/filter/HadoopGroupProviderFilterTest.java
b/gateway-provider-identity-assertion-hadoop-groups/src/test/java/org/apache/hadoop/gateway/identityasserter/hadoop/groups/filter/HadoopGroupProviderFilterTest.java
index c8305fa..529fe29 100644
--- a/gateway-provider-identity-assertion-hadoop-groups/src/test/java/org/apache/hadoop/gateway/identityasserter/hadoop/groups/filter/HadoopGroupProviderFilterTest.java
+++ b/gateway-provider-identity-assertion-hadoop-groups/src/test/java/org/apache/hadoop/gateway/identityasserter/hadoop/groups/filter/HadoopGroupProviderFilterTest.java
@@ -22,8 +22,8 @@ import static org.hamcrest.MatcherAssert.assertThat;
 
 import java.security.Principal;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
-import java.util.Vector;
 
 import javax.security.auth.Subject;
 import javax.servlet.FilterConfig;
@@ -38,7 +38,7 @@ import org.junit.Test;
 
 /**
  * Test for {@link HadoopGroupProviderFilter}
- * 
+ *
  * @since 0.11.0
  */
 public class HadoopGroupProviderFilterTest {
@@ -68,7 +68,7 @@ public class HadoopGroupProviderFilterTest {
 
   /**
    * Test that valid groups are retrieved for a legitimate user.
-   * 
+   *
    * @throws ServletException
    */
   @Test
@@ -102,7 +102,7 @@ public class HadoopGroupProviderFilterTest {
 
   /**
    * Test that no groups are retrieved for a dummy user.
-   * 
+   *
    * @throws ServletException
    */
   @Test
@@ -139,7 +139,7 @@ public class HadoopGroupProviderFilterTest {
    * back on {@link ShellBasedUnixGroupsMapping} because we explicitly use
    * {@link LdapGroupsMapping} and in case of bad config we get empty groups
    * (Hadoop way).
-   * 
+   *
    * @throws ServletException
    */
   @SuppressWarnings({ "unchecked", "rawtypes" })
@@ -189,7 +189,7 @@ public class HadoopGroupProviderFilterTest {
             "(&amp;(|(objectclass=person)(objectclass=applicationProcess))(cn={0}))")
         .anyTimes();
     EasyMock.expect(config.getInitParameterNames())
-        .andReturn(new Vector(keysList).elements()).anyTimes();
+        .andReturn(Collections.enumeration((keysList))).anyTimes();
 
     EasyMock.replay( config );
     EasyMock.replay( context );

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-identity-assertion-switchcase/src/main/java/org/apache/hadoop/gateway/identityasserter/switchcase/SwitchCaseIdentityAssertionFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-identity-assertion-switchcase/src/main/java/org/apache/hadoop/gateway/identityasserter/switchcase/SwitchCaseIdentityAssertionFilter.java
b/gateway-provider-identity-assertion-switchcase/src/main/java/org/apache/hadoop/gateway/identityasserter/switchcase/SwitchCaseIdentityAssertionFilter.java
index 09163b7..f29bad9 100644
--- a/gateway-provider-identity-assertion-switchcase/src/main/java/org/apache/hadoop/gateway/identityasserter/switchcase/SwitchCaseIdentityAssertionFilter.java
+++ b/gateway-provider-identity-assertion-switchcase/src/main/java/org/apache/hadoop/gateway/identityasserter/switchcase/SwitchCaseIdentityAssertionFilter.java
@@ -71,7 +71,7 @@ public class SwitchCaseIdentityAssertionFilter extends CommonIdentityAssertionFi
     String[] groupNames = null;
     if ( groupCase != SwitchCase.NONE ) {
       Set<GroupPrincipal> groups = subject.getPrincipals( GroupPrincipal.class );
-      if( groups != null && groups.size() > 0 ) {
+      if( groups != null && !groups.isEmpty() ) {
         groupNames = new String[ groups.size() ];
         int i = 0;
         for( GroupPrincipal group : groups ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
index be1eca5..45271f0 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/FrontendFunctionProcessor.java
@@ -77,7 +77,7 @@ public class FrontendFunctionProcessor implements UrlRewriteFunctionProcessor<Fr
   @Override
   public List<String> resolve( UrlRewriteContext context, List<String> parameters
) throws Exception {
     String parameter = "url";
-    if( parameters != null && parameters.size() > 0 ) {
+    if( parameters != null && !parameters.isEmpty() ) {
       String first = parameters.get( 0 );
       if( first != null ) {
         parameter = first;

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
index 27d6ef5..2a0e28f 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlImportFunctionProcessor.java
@@ -73,7 +73,7 @@ public class HtmlImportFunctionProcessor implements UrlRewriteFunctionProcessor<
     StringBuffer buffer = new StringBuffer(IMPORT_LITERAL);
     buffer.append(" ");
     buffer.append(prefix);
-    if ( frontendValues != null && frontendValues.size() > 0 ) {
+    if ( frontendValues != null && !frontendValues.isEmpty() ) {
       for ( String value : frontendValues ) {
         buffer.append(value);
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
index 8ded069..82d4298 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/html/HtmlPrefixProcessor.java
@@ -93,7 +93,7 @@ public class HtmlPrefixProcessor
 
     final StringBuffer buffer = new StringBuffer();
     buffer.append(prefix);
-    if (frontendValues != null && frontendValues.size() > 0) {
+    if (frontendValues != null && !frontendValues.isEmpty()) {
       for (final String value : frontendValues) {
         buffer.append(value);
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReader.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReader.java
b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReader.java
index 10fc9b8..5fee26e 100644
--- a/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReader.java
+++ b/gateway-provider-rewrite/src/main/java/org/apache/hadoop/gateway/filter/rewrite/impl/json/JsonFilterReader.java
@@ -481,7 +481,7 @@ class JsonFilterReader extends Reader {
       for( UrlRewriteFilterPathDescriptor selector : scope.getSelectors() ) {
         JsonPath.Expression path = (JsonPath.Expression)selector.compiledPath( JPATH_COMPILER
);
         List<JsonPath.Match> matches = path.evaluate( node.scopeNode );
-        if( matches != null && matches.size() > 0 ) {
+        if( matches != null && !matches.isEmpty() ) {
           if( selector instanceof UrlRewriteFilterBufferDescriptor ) {
             bufferingLevel = node;
             bufferingConfig = (UrlRewriteFilterBufferDescriptor)selector;
@@ -508,7 +508,7 @@ class JsonFilterReader extends Reader {
       for( UrlRewriteFilterPathDescriptor selector : scope.getSelectors() ) {
         JsonPath.Expression path = (JsonPath.Expression)selector.compiledPath( JPATH_COMPILER
);
         List<JsonPath.Match> matches = path.evaluate( node.scopeNode );
-        if( matches != null && matches.size() > 0 ) {
+        if( matches != null && !matches.isEmpty() ) {
           JsonPath.Match match = matches.get( 0 );
           if( match.getNode().isTextual() ) {
             if( selector instanceof UrlRewriteFilterApplyDescriptor ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-security-authz-acls/src/main/java/org/apache/hadoop/gateway/filter/AclsAuthorizationFilter.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-authz-acls/src/main/java/org/apache/hadoop/gateway/filter/AclsAuthorizationFilter.java
b/gateway-provider-security-authz-acls/src/main/java/org/apache/hadoop/gateway/filter/AclsAuthorizationFilter.java
index 343d87f..c26c7f4 100644
--- a/gateway-provider-security-authz-acls/src/main/java/org/apache/hadoop/gateway/filter/AclsAuthorizationFilter.java
+++ b/gateway-provider-security-authz-acls/src/main/java/org/apache/hadoop/gateway/filter/AclsAuthorizationFilter.java
@@ -132,7 +132,7 @@ public class AclsAuthorizationFilter implements Filter {
       // it true if there is an anyGroup acl
       // for AND mode and acls like *;*;127.0.0.* we need to
       // make it pass
-      if (parser.anyGroup && aclProcessingMode.equals("AND")) {
+      if (parser.anyGroup && "AND".equals(aclProcessingMode)) {
         groupAccess = true;
       }
     }
@@ -140,7 +140,7 @@ public class AclsAuthorizationFilter implements Filter {
     ipAddrAccess = checkRemoteIpAcls(req.getRemoteAddr());
     log.remoteIPAddressHasAccess(ipAddrAccess);
     
-    if (aclProcessingMode.equals("OR")) {
+    if ("OR".equals(aclProcessingMode)) {
       // need to interpret '*' as excluded for OR semantics
       // to make sense and not grant access to everyone by mistake.
       // exclusion in OR is equivalent to denied
@@ -151,7 +151,7 @@ public class AclsAuthorizationFilter implements Filter {
       
       return (userAccess || groupAccess || ipAddrAccess);
     }
-    else if (aclProcessingMode.equals("AND")) {
+    else if ("AND".equals(aclProcessingMode)) {
       return (userAccess && groupAccess && ipAddrAccess);
     }
     return false;

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/AbstractJWTFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/AbstractJWTFilterTest.java
b/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/AbstractJWTFilterTest.java
index 26d477f..471c7d3 100644
--- a/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/AbstractJWTFilterTest.java
+++ b/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/AbstractJWTFilterTest.java
@@ -131,9 +131,9 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == true);
+      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled );
       Set<PrimaryPrincipal> principals = chain.subject.getPrincipals(PrimaryPrincipal.class);
-      Assert.assertTrue("No PrimaryPrincipal", principals.size() > 0);
+      Assert.assertTrue("No PrimaryPrincipal", !principals.isEmpty());
       Assert.assertEquals("Not the expected principal", "alice", ((Principal)principals.toArray()[0]).getName());
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");
@@ -162,9 +162,9 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == true);
+      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled );
       Set<PrimaryPrincipal> principals = chain.subject.getPrincipals(PrimaryPrincipal.class);
-      Assert.assertTrue("No PrimaryPrincipal", principals.size() > 0);
+      Assert.assertTrue("No PrimaryPrincipal", !principals.isEmpty());
       Assert.assertEquals("Not the expected principal", "alice", ((Principal)principals.toArray()[0]).getName());
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");
@@ -195,7 +195,7 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be true.", chain.doFilterCalled == false);
+      Assert.assertTrue("doFilterCalled should not be true.", !chain.doFilterCalled);
       Assert.assertTrue("No Subject should be returned.", chain.subject == null);
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");
@@ -229,9 +229,9 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == true);
+      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled );
       Set<PrimaryPrincipal> principals = chain.subject.getPrincipals(PrimaryPrincipal.class);
-      Assert.assertTrue("No PrimaryPrincipal", principals.size() > 0);
+      Assert.assertTrue("No PrimaryPrincipal", !principals.isEmpty());
       Assert.assertEquals("Not the expected principal", "alice", ((Principal)principals.toArray()[0]).getName());
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");
@@ -259,7 +259,7 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == false);
+      Assert.assertTrue("doFilterCalled should not be false.", !chain.doFilterCalled);
       Assert.assertTrue("No Subject should be returned.", chain.subject == null);
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");
@@ -287,9 +287,9 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == true);
+      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled );
       Set<PrimaryPrincipal> principals = chain.subject.getPrincipals(PrimaryPrincipal.class);
-      Assert.assertTrue("No PrimaryPrincipal", principals.size() > 0);
+      Assert.assertTrue("No PrimaryPrincipal", !principals.isEmpty());
       Assert.assertEquals("Not the expected principal", "alice", ((Principal)principals.toArray()[0]).getName());
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");
@@ -317,7 +317,7 @@ public abstract class AbstractJWTFilterTest  {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == false);
+      Assert.assertTrue("doFilterCalled should not be false.", !chain.doFilterCalled);
       Assert.assertTrue("No Subject should be returned.", chain.subject == null);
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/SSOCookieProviderTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/SSOCookieProviderTest.java
b/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/SSOCookieProviderTest.java
index 396aec9..27a3f31 100644
--- a/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/SSOCookieProviderTest.java
+++ b/gateway-provider-security-jwt/src/test/java/org/apache/hadoop/gateway/provider/federation/SSOCookieProviderTest.java
@@ -89,9 +89,9 @@ public class SSOCookieProviderTest extends AbstractJWTFilterTest {
 
       TestFilterChain chain = new TestFilterChain();
       handler.doFilter(request, response, chain);
-      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled == true);
+      Assert.assertTrue("doFilterCalled should not be false.", chain.doFilterCalled );
       Set<PrimaryPrincipal> principals = chain.subject.getPrincipals(PrimaryPrincipal.class);
-      Assert.assertTrue("No PrimaryPrincipal returned.", principals.size() > 0);
+      Assert.assertTrue("No PrimaryPrincipal returned.", !principals.isEmpty());
       Assert.assertEquals("Not the expected principal", "alice", ((Principal)principals.toArray()[0]).getName());
     } catch (ServletException se) {
       fail("Should NOT have thrown a ServletException.");

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-security-webappsec/src/main/java/org/apache/hadoop/gateway/webappsec/deploy/WebAppSecContributor.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/main/java/org/apache/hadoop/gateway/webappsec/deploy/WebAppSecContributor.java
b/gateway-provider-security-webappsec/src/main/java/org/apache/hadoop/gateway/webappsec/deploy/WebAppSecContributor.java
index 50a6767..3904ff1 100644
--- a/gateway-provider-security-webappsec/src/main/java/org/apache/hadoop/gateway/webappsec/deploy/WebAppSecContributor.java
+++ b/gateway-provider-security-webappsec/src/main/java/org/apache/hadoop/gateway/webappsec/deploy/WebAppSecContributor.java
@@ -72,7 +72,7 @@ public class WebAppSecContributor extends
       Map<String, String> providerParams = provider.getParams();
       // CORS support
       String corsEnabled = map.get(CORS_ENABLED);
-      if ( corsEnabled != null && corsEnabled.equals("true")) {
+      if ( corsEnabled != null && "true".equals(corsEnabled)) {
         provisionConfig(resource, providerParams, params, "cors.");
         resource.addFilter().name( getName() + CORS_SUFFIX ).role( getRole() ).impl( CORS_FILTER_CLASSNAME
).params( params );
       }
@@ -80,7 +80,7 @@ public class WebAppSecContributor extends
       // CRSF
       params = new ArrayList<FilterParamDescriptor>();
       String csrfEnabled = map.get(CSRF_ENABLED);
-      if ( csrfEnabled != null && csrfEnabled.equals("true")) {
+      if ( csrfEnabled != null && "true".equals(csrfEnabled)) {
         provisionConfig(resource, providerParams, params, "csrf.");
         resource.addFilter().name( getName() + CSRF_SUFFIX ).role( getRole() ).impl( CSRF_FILTER_CLASSNAME
).params( params );
       }
@@ -88,7 +88,7 @@ public class WebAppSecContributor extends
       // X-Frame-Options - clickjacking protection
       params = new ArrayList<FilterParamDescriptor>();
       String xframeOptionsEnabled = map.get(XFRAME_OPTIONS_ENABLED);
-      if ( xframeOptionsEnabled != null && xframeOptionsEnabled.equals("true")) {
+      if ( xframeOptionsEnabled != null && "true".equals(xframeOptionsEnabled)) {
         provisionConfig(resource, providerParams, params, "xframe.");
         resource.addFilter().name( getName() + XFRAME_OPTIONS_SUFFIX ).role( getRole() ).impl(
XFRAME_OPTIONS_FILTER_CLASSNAME ).params( params );
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-provider-security-webappsec/src/test/java/org/apache/hadoop/gateway/webappsec/XFrameOptionsFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-webappsec/src/test/java/org/apache/hadoop/gateway/webappsec/XFrameOptionsFilterTest.java
b/gateway-provider-security-webappsec/src/test/java/org/apache/hadoop/gateway/webappsec/XFrameOptionsFilterTest.java
index cda73f6..b82bf57 100644
--- a/gateway-provider-security-webappsec/src/test/java/org/apache/hadoop/gateway/webappsec/XFrameOptionsFilterTest.java
+++ b/gateway-provider-security-webappsec/src/test/java/org/apache/hadoop/gateway/webappsec/XFrameOptionsFilterTest.java
@@ -67,9 +67,9 @@ public class XFrameOptionsFilterTest {
       TestFilterChain chain = new TestFilterChain();
       filter.doFilter(request, response, chain);
       Assert.assertTrue("doFilterCalled should not be false.",
-          chain.doFilterCalled == true);
+          chain.doFilterCalled );
       Assert.assertTrue("Options value incorrect should be DENY but is: "
-          + options, options.equals("DENY"));
+          + options, "DENY".equals(options));
 
       Assert.assertTrue("X-Frame-Options count not equal to 1.", headers.size() == 1);
     } catch (ServletException se) {
@@ -96,9 +96,9 @@ public class XFrameOptionsFilterTest {
       TestFilterChain chain = new TestFilterChain();
       filter.doFilter(request, response, chain);
       Assert.assertTrue("doFilterCalled should not be false.",
-          chain.doFilterCalled == true);
+          chain.doFilterCalled );
       Assert.assertTrue("Options value incorrect should be SAMEORIGIN but is: "
-          + options, options.equals("SAMEORIGIN"));
+          + options, "SAMEORIGIN".equals(options));
 
       Assert.assertTrue("X-Frame-Options count not equal to 1.", headers.size() == 1);
     } catch (ServletException se) {
@@ -125,9 +125,9 @@ public class XFrameOptionsFilterTest {
 //      TestFilterChain chain = new TestFilterChain();
 //      filter.doFilter(request, response, chain);
 //      Assert.assertTrue("doFilterCalled should not be false.",
-//          chain.doFilterCalled == true);
+//          chain.doFilterCalled );
 //      Assert.assertTrue("Options value incorrect should be SAMEORIGIN but is: "
-//          + options, options.equals("SAMEORIGIN"));
+//          + options, "SAMEORIGIN".equals(options));
 //
 //      Assert.assertTrue("X-Frame-Options count not equal to 1.", headers.size() == 1);
 //    } catch (ServletException se) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
index 2fa803f..9fcb78d 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/GatewayServer.java
@@ -461,7 +461,7 @@ public class GatewayServer {
 
     handlers.addHandler(logHandler);
 
-    if (config.isWebsocketEnabled()) {      
+    if (config.isWebsocketEnabled()) {
       final GatewayWebsocketHandler websocketHandler = new GatewayWebsocketHandler(
           config, services);
       websocketHandler.setHandler(portMappingHandler);
@@ -501,7 +501,7 @@ public class GatewayServer {
     // if topology name is blank which means we have all topologies listening on this port
     if (StringUtils.isBlank(topologyName)) {
       // If we have Default Topology old and new configuration (Port Mapping) throw error.
-      if (config.getGatewayPortMappings().containsValue(new Integer(port))
+      if (config.getGatewayPortMappings().containsValue(Integer.valueOf(port))
           && !StringUtils.isBlank(config.getDefaultTopologyName())) {
         log.portAlreadyInUse(port);
         throw new IOException(String.format(
@@ -742,7 +742,7 @@ public class GatewayServer {
           originalRoot.appendChild( importedNode );
         }
       }
-      
+
       XmlUtils.writeXml( webXmlDoc, new FileWriter(webXmlFile) );
     }
   }
@@ -1008,7 +1008,7 @@ public class GatewayServer {
 
   private static class FileModificationTimeDescendingComparator implements Comparator<File>,
Serializable {
     /**
-     * 
+     *
      */
     private static final long serialVersionUID = -2269785204848916823L;
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ApplicationDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ApplicationDeploymentContributor.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ApplicationDeploymentContributor.java
index 4686c22..d872707 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ApplicationDeploymentContributor.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ApplicationDeploymentContributor.java
@@ -199,7 +199,7 @@ public class ApplicationDeploymentContributor extends ServiceDeploymentContribut
         throw new IllegalArgumentException("Policy defined has no role for service " + service.getName());
       }
       role = role.trim().toLowerCase();
-      if ( role.equals("rewrite") ) {
+      if ( "rewrite".equals(role) ) {
         addRewriteFilter(context, service, filterParams, params, resource);
       } else if ( topologyContainsProviderType(context, role) ) {
         context.contributeFilter(service, resource, role, policyBinding.getName(), null);

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
index 7b23715..53a7e23 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/deploy/impl/ServiceDefinitionDeploymentContributor.java
@@ -152,7 +152,7 @@ public class ServiceDefinitionDeploymentContributor extends ServiceDeploymentCon
         throw new IllegalArgumentException("Policy defined has no role for service " + service.getName());
       }
       role = role.trim().toLowerCase();
-      if ( role.equals("rewrite") ) {
+      if ( "rewrite".equals(role) ) {
         addRewriteFilter(context, service, filterParams, params, resource);
       } else if ( topologyContainsProviderType(context, role) ) {
         context.contributeFilter(service, resource, role, policyBinding.getName(), null);

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/UrlConnectionDispatch.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/UrlConnectionDispatch.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/UrlConnectionDispatch.java
index 80cb4ea..1e6d49a 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/UrlConnectionDispatch.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/dispatch/UrlConnectionDispatch.java
@@ -66,7 +66,7 @@ public class UrlConnectionDispatch extends AbstractGatewayFilter {
   @Override
   protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain
chain) throws IOException, ServletException {
     String method = request.getMethod().toUpperCase();
-    if (method.equals("GET")) {
+    if ("GET".equals(method)) {
       try {
         doGet(getDispatchUrl(request), request, response);
       } catch ( URISyntaxException e ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/validation/TopologyValidator.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/validation/TopologyValidator.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/validation/TopologyValidator.java
index 548f013..adcaefc 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/validation/TopologyValidator.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/topology/validation/TopologyValidator.java
@@ -77,7 +77,7 @@ public class TopologyValidator {
 
       File xml = new File(filePath);
       validator.validate(new StreamSource(xml));
-      if(exceptions.size() > 0) {
+      if(!exceptions.isEmpty()) {
         for (SAXParseException e : exceptions) {
           errors.add("Line: " + e.getLineNumber() + " -- " + e.getMessage());
         }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java b/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
index e1620d0..afc6ee0 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/util/KnoxCLI.java
@@ -664,7 +664,7 @@ public class KnoxCLI extends Configured implements Tool {
        out.println(name + " has been successfully created.");
      }
      else {
-       if (generate.equals("true")) {
+       if ("true".equals(generate)) {
          as.generateAliasForCluster(cluster, name);
          out.println(name + " has been successfully generated.");
        }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-service-admin/src/main/java/org/apache/hadoop/gateway/service/admin/TopologiesResource.java
----------------------------------------------------------------------
diff --git a/gateway-service-admin/src/main/java/org/apache/hadoop/gateway/service/admin/TopologiesResource.java
b/gateway-service-admin/src/main/java/org/apache/hadoop/gateway/service/admin/TopologiesResource.java
index 22d976c..1504eca 100644
--- a/gateway-service-admin/src/main/java/org/apache/hadoop/gateway/service/admin/TopologiesResource.java
+++ b/gateway-service-admin/src/main/java/org/apache/hadoop/gateway/service/admin/TopologiesResource.java
@@ -125,7 +125,7 @@ public class TopologiesResource {
   @Path("topologies/{id}")
   public Response deleteTopology(@PathParam("id") String id) {
     boolean deleted = false;
-    if(!id.equals("admin")) {
+    if(!"admin".equals(id)) {
       GatewayServices services = (GatewayServices) request.getServletContext()
           .getAttribute(GatewayServices.GATEWAY_SERVICES_ATTRIBUTE);
 

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-spi/src/main/java/org/apache/hadoop/gateway/security/SubjectUtils.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/main/java/org/apache/hadoop/gateway/security/SubjectUtils.java
b/gateway-spi/src/main/java/org/apache/hadoop/gateway/security/SubjectUtils.java
index 5d8c8a7..1ec9ce6 100644
--- a/gateway-spi/src/main/java/org/apache/hadoop/gateway/security/SubjectUtils.java
+++ b/gateway-spi/src/main/java/org/apache/hadoop/gateway/security/SubjectUtils.java
@@ -35,7 +35,7 @@ public class SubjectUtils {
     String name = null;
 
     Set<PrimaryPrincipal> primaryPrincipals = subject.getPrincipals(PrimaryPrincipal.class);
-    if (primaryPrincipals.size() > 0) {
+    if (!primaryPrincipals.isEmpty()) {
       return ((PrimaryPrincipal)primaryPrincipals.toArray()[0]).getName();
     }
 
@@ -63,7 +63,7 @@ public class SubjectUtils {
     String name = null;
 
     Set<ImpersonatedPrincipal> impPrincipals = subject.getPrincipals(ImpersonatedPrincipal.class);
-    if (impPrincipals.size() > 0) {
+    if (!impPrincipals.isEmpty()) {
       return ((Principal)impPrincipals.toArray()[0]).getName();
     }
     

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-spi/src/test/java/org/apache/hadoop/gateway/security/principal/PrincipalMapperTest.java
----------------------------------------------------------------------
diff --git a/gateway-spi/src/test/java/org/apache/hadoop/gateway/security/principal/PrincipalMapperTest.java
b/gateway-spi/src/test/java/org/apache/hadoop/gateway/security/principal/PrincipalMapperTest.java
index 6676629..8572310 100644
--- a/gateway-spi/src/test/java/org/apache/hadoop/gateway/security/principal/PrincipalMapperTest.java
+++ b/gateway-spi/src/test/java/org/apache/hadoop/gateway/security/principal/PrincipalMapperTest.java
@@ -70,9 +70,9 @@ public class PrincipalMapperTest {
     assertTrue(mapper.mapUserPrincipal("lmccay").equals("lmccay"));
     assertTrue(mapper.mapGroupPrincipal("hdfs")[0].equals("users"));
     String group = mapper.mapGroupPrincipal("lmccay")[0];
-    assertTrue(group.equals("users") || group.equals("mrgroup"));
+    assertTrue("users".equals(group) || "mrgroup".equals(group));
     group = mapper.mapGroupPrincipal("lmccay")[1];
-    assertTrue(group.equals("users") || group.equals("mrgroup"));
+    assertTrue("users".equals(group) || "mrgroup".equals(group));
   }
 
   @Test
@@ -92,9 +92,9 @@ public class PrincipalMapperTest {
     assertTrue(mapper.mapGroupPrincipal("hdfs")[0].equals("users"));
     assertTrue(mapper.mapGroupPrincipal("lmccay").length == 2);
     String group = mapper.mapGroupPrincipal("lmccay")[0];
-    assertTrue(group.equals("users") || group.equals("mrgroup"));
+    assertTrue("users".equals(group) || "mrgroup".equals(group));
     group = mapper.mapGroupPrincipal("lmccay")[1];
-    assertTrue(group.equals("users") || group.equals("mrgroup"));
+    assertTrue("users".equals(group) || "mrgroup".equals(group));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-util-common/src/main/java/org/apache/hadoop/gateway/util/IpAddressValidator.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/main/java/org/apache/hadoop/gateway/util/IpAddressValidator.java
b/gateway-util-common/src/main/java/org/apache/hadoop/gateway/util/IpAddressValidator.java
index 6382975..ca39186 100644
--- a/gateway-util-common/src/main/java/org/apache/hadoop/gateway/util/IpAddressValidator.java
+++ b/gateway-util-common/src/main/java/org/apache/hadoop/gateway/util/IpAddressValidator.java
@@ -87,7 +87,7 @@ public class IpAddressValidator {
       }
       else {
         // check for wildcards if there are wildcardIP acls configured
-        if (wildCardIPs.size() > 0) {
+        if (!wildCardIPs.isEmpty()) {
           for (String ip : wildCardIPs) {
             if (addr.startsWith(ip)) {
               valid = true;

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/AdapterSampleTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/AdapterSampleTest.java
b/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/AdapterSampleTest.java
index f3e392e..bc94a69 100755
--- a/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/AdapterSampleTest.java
+++ b/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/AdapterSampleTest.java
@@ -19,21 +19,22 @@ package org.apache.hadoop.gateway.config;
 
 import org.junit.Test;
 
-import java.util.Hashtable;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 
 public class AdapterSampleTest {
 
-  public static class Target {
+  private static class Target {
     @Configure
     private String username = null;
   }
 
-  public static class Adapter implements ConfigurationAdapter {
-    private Hashtable config;
-    public Adapter( Hashtable config ) {
+  private static class Adapter implements ConfigurationAdapter {
+    private Map<String, Object> config;
+    public Adapter( Map<String, Object> config ) {
       this.config = config;
     }
     @Override
@@ -43,13 +44,15 @@ public class AdapterSampleTest {
     }
   }
 
-  static Hashtable config = new Hashtable();
-  static{ config.put( "USERNAME", "somebody" ); }
+  private static final Map<String, Object> CONFIG = new ConcurrentHashMap<>();
+  static {
+    CONFIG.put( "USERNAME", "somebody" );
+  }
 
   @Test
   public void sample() {
     Target target = new Target();
-    Adapter adapter = new Adapter( config );
+    Adapter adapter = new Adapter( CONFIG );
     ConfigurationInjectorBuilder.configuration().target( target ).source( adapter ).inject();
     assertThat( target.username, is( "somebody" ) );
   }

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/FuncTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/FuncTest.java
b/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/FuncTest.java
index 6002dc3..e35f2d4 100755
--- a/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/FuncTest.java
+++ b/gateway-util-configinjector/src/test/java/org/apache/hadoop/gateway/config/FuncTest.java
@@ -98,7 +98,7 @@ public class FuncTest {
 
     assertThat( testBean.stringMember, is( "stringValue" ) );
     assertThat( testBean.intMember, is( 2 ) );
-    assertThat( testBean.integerMember, is( new Integer(2) ) );
+    assertThat( testBean.integerMember, is( Integer.valueOf(2) ) );
     assertThat( testBean.stringPropField, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAlt, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAltArg, is( "stringValue" ) );
@@ -127,7 +127,7 @@ public class FuncTest {
 
     assertThat( testBean.stringMember, is( "stringValue" ) );
     assertThat( testBean.intMember, is( 2 ) );
-    assertThat( testBean.integerMember, is( new Integer(2) ) );
+    assertThat( testBean.integerMember, is( Integer.valueOf(2) ) );
     assertThat( testBean.stringPropField, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAlt, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAltArg, is( "stringValue" ) );
@@ -171,7 +171,7 @@ public class FuncTest {
 
     assertThat( testBean.stringMember, is( "stringValue" ) );
     assertThat( testBean.intMember, is( 2 ) );
-    assertThat( testBean.integerMember, is( new Integer(2) ) );
+    assertThat( testBean.integerMember, is( Integer.valueOf(2) ) );
     assertThat( testBean.stringPropField, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAlt, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAltArg, is( "stringValue" ) );
@@ -186,12 +186,12 @@ public class FuncTest {
     Map<Object,Object> testConfig = new HashMap<>();
     testConfig.put( "stringMember", "stringValue" );
     testConfig.put( "intMember", 42 );
-    testConfig.put( "integerMember", new Integer(42) );
+    testConfig.put( "integerMember", Integer.valueOf(42) );
     testConfig.put( "stringProp", "stringValue" );
     testConfig.put( "altStringProp", "stringValue" );
     testConfig.put( "altArgStringProp", "stringValue" );
     testConfig.put( "multiArg1", "stringValue" );
-    testConfig.put( "multiArg2", new Integer(42) );
+    testConfig.put( "multiArg2", Integer.valueOf(42) );
     testConfig.put( "multiArg3", "42" );
 
     TestBean testBean = new TestBean();
@@ -200,7 +200,7 @@ public class FuncTest {
 
     assertThat( testBean.stringMember, is( "stringValue" ) );
     assertThat( testBean.intMember, is( 42 ) );
-    assertThat( testBean.integerMember, is( new Integer(42) ) );
+    assertThat( testBean.integerMember, is( Integer.valueOf(42) ) );
     assertThat( testBean.stringPropField, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAlt, is( "stringValue" ) );
     assertThat( testBean.stringPropFieldAltArg, is( "stringValue" ) );

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Expander.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Expander.java
b/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Expander.java
index d373c49..307c6c3 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Expander.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Expander.java
@@ -129,14 +129,14 @@ public class Expander {
           break;
       }
     }
-    if( template.isDirectory() && path.size() > 0 ) {
+    if( template.isDirectory() && !path.isEmpty() ) {
       builder.append( "/" );
     }
   }
 
   //TODO: This needs to handle multiple values but only to the limit of the segment.
   private static void expandPathValues( Path segment, List<String> values, StringBuilder
builder ) {
-    if( values != null && values.size() > 0 ) {
+    if( values != null && !values.isEmpty() ) {
       int type = segment.getFirstValue().getType();
       if( type == Segment.GLOB || type == Segment.DEFAULT ) {
         for( int i=0, n=values.size(); i<n; i++ ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Matcher.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Matcher.java
b/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Matcher.java
index b818774..139535c 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Matcher.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Matcher.java
@@ -490,7 +490,7 @@ public class Matcher<V> {
     }
 
     private boolean hasQueries() {
-      return( queries != null && queries.size() > 0 );
+      return( queries != null && !queries.isEmpty() );
     }
 
     private boolean matches( Segment segment ) {

http://git-wip-us.apache.org/repos/asf/knox/blob/6135abd3/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Template.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Template.java
b/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Template.java
index 3cce86a..0de20f1 100644
--- a/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Template.java
+++ b/gateway-util-urltemplate/src/main/java/org/apache/hadoop/gateway/util/urltemplate/Template.java
@@ -225,7 +225,7 @@ public class Template {
         b.append( firstValue.getOriginalPattern() );
       }
     }
-    if( isDirectory && ( !isAbsolute || path.size() > 0 ) ) {
+    if( isDirectory && ( !isAbsolute || !path.isEmpty() ) ) {
       b.append( '/' );
     }
   }


Mime
View raw message