Repository: knox Updated Branches: refs/heads/master 78c3bad46 -> 121da5440
KNOX-1539 - Put the array declaration after the type Project: http://git-wip-us.apache.org/repos/asf/knox/repo Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/121da544 Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/121da544 Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/121da544 Branch: refs/heads/master Commit: 121da5440e4ca318bd7f8378c338219673b4f8b7 Parents: 78c3bad Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Wed Oct 24 10:19:21 2018 +0100 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Wed Oct 24 10:19:21 2018 +0100 ---------------------------------------------------------------------- .../services/topology/DefaultTopologyServiceTest.java | 2 +- .../org/apache/knox/gateway/util/KnoxCLITest.java | 14 +++++++------- .../knox/gateway/dispatch/CappedBufferHttpEntity.java | 2 +- .../dispatch/PartiallyRepeatableHttpEntity.java | 2 +- .../org/apache/knox/gateway/topology/Version.java | 2 +- .../gateway/dispatch/CappedBufferHttpEntityTest.java | 2 +- .../dispatch/PartiallyRepeatableHttpEntityTest.java | 2 +- .../org/apache/knox/gateway/GatewayBasicFuncTest.java | 10 +++++----- .../knox/gateway/KnoxCliLdapFuncTestNegative.java | 6 +++--- .../knox/gateway/KnoxCliLdapFuncTestPositive.java | 10 +++++----- .../org/apache/knox/gateway/KnoxCliSysBindTest.java | 10 +++++----- .../apache/knox/gateway/util/urltemplate/Parser.java | 2 +- 12 files changed, 32 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java ---------------------------------------------------------------------- diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java b/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java index e63a6c8..cb7437f 100644 --- a/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java +++ b/gateway-server/src/test/java/org/apache/knox/gateway/services/topology/DefaultTopologyServiceTest.java @@ -566,7 +566,7 @@ public class DefaultTopologyServiceTest { public void testProviderParamsOrderIsPreserved() { Provider provider = new Provider(); - String names[] = {"ldapRealm=", + String[] names = {"ldapRealm=", "ldapContextFactory", "ldapRealm.contextFactory", "ldapGroupRealm", http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java ---------------------------------------------------------------------- diff --git a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java index 861c050..e64adb2 100644 --- a/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java +++ b/gateway-server/src/test/java/org/apache/knox/gateway/util/KnoxCLITest.java @@ -846,7 +846,7 @@ public class KnoxCLITest { GatewayConfigMock config = new GatewayConfigMock(); URL topoURL = ClassLoader.getSystemResource("conf-demo/conf/topologies/admin.xml"); config.setConfDir( new File(topoURL.getFile()).getParentFile().getParent() ); - String args[] = {"list-topologies", "--master", "knox"}; + String[] args = {"list-topologies", "--master", "knox"}; KnoxCLI cli = new KnoxCLI(); cli.setConf( config ); @@ -962,7 +962,7 @@ public class KnoxCLITest { GatewayConfigMock config = new GatewayConfigMock(); URL topoURL = ClassLoader.getSystemResource("conf-demo/conf/topologies/admin.xml"); config.setConfDir( new File(topoURL.getFile()).getParentFile().getParent() ); - String args[] = {"validate-topology", "--master", "knox", "--cluster", "sandbox"}; + String[] args = {"validate-topology", "--master", "knox", "--cluster", "sandbox"}; KnoxCLI cli = new KnoxCLI(); cli.setConf( config ); @@ -974,21 +974,21 @@ public class KnoxCLITest { outContent.reset(); - String args2[] = {"validate-topology", "--master", "knox", "--cluster", "NotATopology"}; + String[] args2 = {"validate-topology", "--master", "knox", "--cluster", "NotATopology"}; cli.run(args2); assertThat(outContent.toString("UTF-8"), containsString("NotATopology")); assertThat(outContent.toString("UTF-8"), containsString("does not exist")); outContent.reset(); - String args3[] = {"validate-topology", "--master", "knox", "--path", config.getGatewayTopologyDir() + "/admin.xml"}; + String[] args3 = {"validate-topology", "--master", "knox", "--path", config.getGatewayTopologyDir() + "/admin.xml"}; cli.run(args3); assertThat(outContent.toString("UTF-8"), containsString("admin")); assertThat(outContent.toString("UTF-8"), containsString("success")); outContent.reset(); - String args4[] = {"validate-topology", "--master", "knox", "--path", "not/a/path"}; + String[] args4 = {"validate-topology", "--master", "knox", "--path", "not/a/path"}; cli.run(args4); assertThat(outContent.toString("UTF-8"), containsString("does not exist")); assertThat(outContent.toString("UTF-8"), containsString("not/a/path")); @@ -1003,7 +1003,7 @@ public class KnoxCLITest { GatewayConfigMock config = new GatewayConfigMock(); URL topoURL = ClassLoader.getSystemResource("conf-demo/conf/topologies/admin.xml"); config.setConfDir( new File(topoURL.getFile()).getParentFile().getParent() ); - String args[] = {"validate-topology", "--master", "knox", "--cluster", "test-cluster-bad"}; + String[] args = {"validate-topology", "--master", "knox", "--cluster", "test-cluster-bad"}; KnoxCLI cli = new KnoxCLI(); cli.setConf( config ); @@ -1018,7 +1018,7 @@ public class KnoxCLITest { outContent.reset(); - String args2[] = {"validate-topology", "--master", "knox", "--cluster", "test-cluster-good"}; + String[] args2 = {"validate-topology", "--master", "knox", "--cluster", "test-cluster-good"}; cli.run(args2); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntity.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntity.java b/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntity.java index a1796ec..b7f104f 100644 --- a/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntity.java +++ b/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntity.java @@ -121,7 +121,7 @@ public class CappedBufferHttpEntity extends HttpEntityWrapper { return b; } - public int read( byte buffer[], int offset, int limit ) throws IOException { + public int read( byte[] buffer, int offset, int limit ) throws IOException { int count = -1; // If we can read from the buffer do so. if( replayReadIndex < replayWriteIndex ) { http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntity.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntity.java b/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntity.java index 9d732ce..a882e02 100644 --- a/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntity.java +++ b/gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntity.java @@ -129,7 +129,7 @@ public class PartiallyRepeatableHttpEntity extends HttpEntityWrapper { return b; } - public int read( byte buffer[], int offset, int limit ) throws IOException { + public int read( byte[] buffer, int offset, int limit ) throws IOException { int count = -1; if( finalStream != null && finalStream != this ) { throw new IOException( "Replay stream taken over by another consumer." ); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Version.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Version.java b/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Version.java index 5143e29..e2151ac 100644 --- a/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Version.java +++ b/gateway-spi/src/main/java/org/apache/knox/gateway/topology/Version.java @@ -69,7 +69,7 @@ public class Version implements Comparable<Version> { } private void parseVersion(String version) { - String parts[] = version.split("\\."); + String[] parts = version.split("\\."); int length = parts.length; if (length >= 1) { major = Integer.parseInt(parts[0]); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntityTest.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntityTest.java b/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntityTest.java index 1b5b638..14c22a1 100644 --- a/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntityTest.java +++ b/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/CappedBufferHttpEntityTest.java @@ -833,7 +833,7 @@ public class CappedBufferHttpEntityTest { private static String blockRead( InputStream stream, Charset charset, int total, int chunk ) throws IOException { StringBuilder string = null; - byte buffer[] = new byte[ chunk ]; + byte[] buffer = new byte[ chunk ]; int count = 0; if( total < 0 ) { total = Integer.MAX_VALUE; http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntityTest.java ---------------------------------------------------------------------- diff --git a/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntityTest.java b/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntityTest.java index 916307e..c10a02c 100644 --- a/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntityTest.java +++ b/gateway-spi/src/test/java/org/apache/knox/gateway/dispatch/PartiallyRepeatableHttpEntityTest.java @@ -853,7 +853,7 @@ public class PartiallyRepeatableHttpEntityTest { private static String blockRead( InputStream stream, Charset charset, int total, int chunk ) throws IOException { StringBuilder string = null; - byte buffer[] = new byte[ chunk ]; + byte[] buffer = new byte[ chunk ]; int count = 0; if( total < 0 ) { total = Integer.MAX_VALUE; http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java ---------------------------------------------------------------------- diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java index c0d7922..2fe73b6 100644 --- a/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java +++ b/gateway-test/src/test/java/org/apache/knox/gateway/GatewayBasicFuncTest.java @@ -3663,7 +3663,7 @@ public class GatewayBasicFuncTest { final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent, false, "UTF-8")); - String args[] = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", gatewayAddress.getHostName(), + String[] args = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", gatewayAddress.getHostName(), "--port", Integer.toString(gatewayAddress.getPort()), "--u", "kminder","--p", "kminder-password" }; KnoxCLI cli = new KnoxCLI(); cli.run(args); @@ -3676,7 +3676,7 @@ public class GatewayBasicFuncTest { setupResources(); - String args2[] = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", gatewayAddress.getHostName(), + String[] args2 = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", gatewayAddress.getHostName(), "--port", Integer.toString(gatewayAddress.getPort()) }; cli = new KnoxCLI(); @@ -3685,7 +3685,7 @@ public class GatewayBasicFuncTest { outContent.reset(); - String args3[] = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", "bad-host", + String[] args3 = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", "bad-host", "--port", "0", "--u", "guest", "--p", "guest-password" }; cli = new KnoxCLI(); @@ -3695,7 +3695,7 @@ public class GatewayBasicFuncTest { .or(containsString("//bad-host:0/"))); outContent.reset(); - String args4[] = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", gatewayAddress.getHostName(), + String[] args4 = {"service-test", "--master", "knox", "--cluster", driver.clusterName, "--hostname", gatewayAddress.getHostName(), "--port", "543", "--u", "mapred", "--p", "mapred-password" }; cli = new KnoxCLI(); @@ -3704,7 +3704,7 @@ public class GatewayBasicFuncTest { outContent.reset(); - String args5[] = {"service-test", "--master", "knox", "--hostname", gatewayAddress.getHostName(), + String[] args5 = {"service-test", "--master", "knox", "--hostname", gatewayAddress.getHostName(), "--port", "543", "--u", "mapred", "--p", "mapred-password" }; cli = new KnoxCLI(); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java ---------------------------------------------------------------------- diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java index f3ac53d..8d6c261 100644 --- a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java +++ b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestNegative.java @@ -244,7 +244,7 @@ public class KnoxCliLdapFuncTestNegative { KnoxCLI cli = new KnoxCLI(); cli.setConf(config); - String args1[] = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster", + String[] args1 = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster", "--u", username, "--p", password, "--g" }; cli.run( args1 ); @@ -260,7 +260,7 @@ public class KnoxCliLdapFuncTestNegative { cli = new KnoxCLI(); cli.setConf( config ); - String args2[] = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster", + String[] args2 = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster", "--u", username, "--p", password, "--g" }; Enumeration<Appender> before = NoOpAppender.setUp(); try { @@ -278,7 +278,7 @@ public class KnoxCliLdapFuncTestNegative { cli = new KnoxCLI(); cli.setConf( config ); - String args3[] = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster", + String[] args3 = {"user-auth-test", "--master", "knox", "--cluster", "bad-cluster", "--u", username, "--p", password, "--g" }; cli.run( args3 ); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java ---------------------------------------------------------------------- diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java index e71e08f..1c46d26 100644 --- a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java +++ b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliLdapFuncTestPositive.java @@ -231,7 +231,7 @@ public class KnoxCliLdapFuncTestPositive { outContent.reset(); String username = "sam"; String password = "sam-password"; - String args[] = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password, + String[] args = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password, "--g"}; KnoxCLI cli = new KnoxCLI(); cli.setConf(config); @@ -246,7 +246,7 @@ public class KnoxCliLdapFuncTestPositive { cli.setConf(config); username = "bad-name"; password = "bad-password"; - String args2[] = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password}; + String[] args2 = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password}; Enumeration<Appender> before = NoOpAppender.setUp(); try { cli.run( args2 ); @@ -261,7 +261,7 @@ public class KnoxCliLdapFuncTestPositive { cli.setConf(config); username = "guest"; password = "guest-password"; - String args3[] = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", + String[] args3 = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password, "--g" }; cli.run(args3); assertThat(outContent.toString("UTF-8"), containsString("LDAP authentication success")); @@ -273,7 +273,7 @@ public class KnoxCliLdapFuncTestPositive { cli.setConf(config); username = "guest"; password = "guest-password"; - String args4[] = {"user-auth-test", "--master", "knox", "--cluster", "cluster-dne", + String[] args4 = {"user-auth-test", "--master", "knox", "--cluster", "cluster-dne", "--u", username, "--p", password }; cli.run(args4); assertThat(outContent.toString("UTF-8"), containsString("Topology cluster-dne does not exist")); @@ -285,7 +285,7 @@ public class KnoxCliLdapFuncTestPositive { cli.setConf(config); username = "guest"; password = "guest-password"; - String args5[] = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", + String[] args5 = {"user-auth-test", "--master", "knox", "--cluster", "test-cluster", "--u", username, "--p", password }; cli.run( args5 ); assertThat(outContent.toString("UTF-8"), containsString("LDAP authentication success")); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java ---------------------------------------------------------------------- diff --git a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java index e220f49..0d28a78 100644 --- a/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java +++ b/gateway-test/src/test/java/org/apache/knox/gateway/KnoxCliSysBindTest.java @@ -233,7 +233,7 @@ public class KnoxCliSysBindTest { // Test 1: Make sure authentication is successful outContent.reset(); - String args[] = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-1", "--d" }; + String[] args = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-1", "--d" }; KnoxCLI cli = new KnoxCLI(); cli.setConf(config); cli.run(args); @@ -241,7 +241,7 @@ public class KnoxCliSysBindTest { // Test 2: Make sure authentication fails outContent.reset(); - String args2[] = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-2", "--d" }; + String[] args2 = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-2", "--d" }; cli = new KnoxCLI(); cli.setConf(config); cli.run(args2); @@ -250,7 +250,7 @@ public class KnoxCliSysBindTest { // Test 3: Make sure authentication is successful outContent.reset(); - String args3[] = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-3", "--d" }; + String[] args3 = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-3", "--d" }; cli = new KnoxCLI(); cli.setConf(config); Enumeration<Appender> before = NoOpAppender.setUp(); @@ -264,7 +264,7 @@ public class KnoxCliSysBindTest { // Test 4: Assert that we get a username/password not present error is printed outContent.reset(); - String args4[] = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-4" }; + String[] args4 = { "system-user-auth-test", "--master", "knox", "--cluster", "test-cluster-4" }; cli = new KnoxCLI(); cli.setConf(config); cli.run(args4); @@ -274,7 +274,7 @@ public class KnoxCliSysBindTest { // Test 5: Assert that we get a username/password not present error is printed outContent.reset(); - String args5[] = { "system-user-auth-test", "--master", "knox", "--cluster", "not-a-cluster" }; + String[] args5 = { "system-user-auth-test", "--master", "knox", "--cluster", "not-a-cluster" }; cli = new KnoxCLI(); cli.setConf(config); cli.run(args5); http://git-wip-us.apache.org/repos/asf/knox/blob/121da544/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Parser.java ---------------------------------------------------------------------- diff --git a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Parser.java b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Parser.java index e5cdead..fe1db82 100644 --- a/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Parser.java +++ b/gateway-util-urltemplate/src/main/java/org/apache/knox/gateway/util/urltemplate/Parser.java @@ -266,7 +266,7 @@ public class Parser { builder.addQuery( paramName, new Token( paramName, paramPattern.originalPattern, builder.isLiteral() ) ); } } else { - String nameValue[] = split( token, '=' ); + String[] nameValue = split( token, '=' ); if( nameValue.length == 1 ) { String queryName = nameValue[ 0 ]; builder.addQuery( queryName, new Token( Segment.ANONYMOUS_PARAM, null, builder.isLiteral() ) );