From bb7fb48f08ba8b5d7dd589952e914876cc87af09 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 3 Jul 2019 16:42:20 +0200 Subject: [PATCH] Fix checkstyle warnings for tests. (#3846) Signed-off-by: Jan Bartel --- .../GlobalWebappConfigBindingTest.java | 4 +- .../jetty/deploy/test/XmlConfiguredJetty.java | 4 +- .../eclipse/jetty/http/HttpCookieTest.java | 8 +- .../jetty/http/MultiPartCaptureTest.java | 2 +- .../org/eclipse/jetty/http/SyntaxTest.java | 8 +- .../UriTemplatePathSpecBadSpecsTest.java | 2 +- .../jetty/security/ConstraintTest.java | 2 +- .../jetty/server/CookieCutterTest.java | 24 ++--- .../jetty/server/HttpConnectionTest.java | 4 +- .../server/HttpManyWaysToCommitTest.java | 2 +- .../org/eclipse/jetty/server/StressTest.java | 4 +- .../jetty/server/ThreadStarvationTest.java | 2 +- .../handler/AllowSymLinkAliasCheckerTest.java | 2 +- .../server/handler/ResourceHandlerTest.java | 2 +- .../handler/SecuredRedirectHandlerTest.java | 2 +- .../server/handler/StatisticsHandlerTest.java | 10 +- .../jetty/servlet/DefaultServletTest.java | 2 +- .../jetty/server/handler/gzip/GzipTester.java | 2 +- .../jetty/server/handler/gzip/Hex.java | 4 +- .../jetty/start/ModuleGraphWriterTest.java | 2 +- .../org/eclipse/jetty/start/ModuleTest.java | 2 +- .../org/eclipse/jetty/start/ModulesTest.java | 6 +- .../jetty/start/config/ConfigSourcesTest.java | 14 +-- .../start/util/CorrectMavenCentralRefs.java | 2 +- .../eclipse/jetty/util/BufferUtilTest.java | 4 +- .../org/eclipse/jetty/util/LazyListTest.java | 102 +++++++++--------- .../org/eclipse/jetty/util/MultiMapTest.java | 6 +- .../eclipse/jetty/util/PathWatcherTest.java | 2 +- .../java/org/eclipse/jetty/util/TrieTest.java | 2 +- .../org/eclipse/jetty/util/URIUtilTest.java | 2 +- .../jetty/util/Utf8AppendableTest.java | 2 +- .../eclipse/jetty/util/log/Slf4jHelper.java | 4 +- .../util/resource/FileSystemResourceTest.java | 2 +- .../websocket/jsr356/LargeMessageTest.java | 2 +- .../jsr356/MessageReceivingTest.java | 2 +- .../jsr356/encoders/ValidDualEncoder.java | 2 +- .../websocket/jsr356/utils/TypeTree.java | 2 +- .../jsr356/server/LargeAnnotatedTest.java | 2 +- .../server/LargeClientContainerServlet.java | 2 +- .../jsr356/server/LargeContainerTest.java | 2 +- .../LargeOnOpenSessionConfiguredTest.java | 2 +- ...rverContainerAsClientContainerServlet.java | 2 +- .../server/browser/JsrBrowserSocket.java | 14 +-- .../samples/pong/PongMessageEndpoint.java | 2 +- .../server/samples/pong/PongSocket.java | 2 +- .../tests/client/WebSocketClientTest.java | 2 +- .../websocket/client/HttpClientInitTest.java | 2 +- .../client/TomcatServerQuirksTest.java | 2 +- .../websocket/client/examples/TestClient.java | 2 +- .../compress/CompressExtension.java | 2 +- .../websocket/common/AcceptHashTest.java | 2 +- .../jetty/websocket/common/CloseInfoTest.java | 2 +- .../common/ClosePayloadParserTest.java | 2 +- .../common/GeneratorParserRoundtripTest.java | 2 +- .../jetty/websocket/common/GeneratorTest.java | 18 ++-- .../jetty/websocket/common/ParserTest.java | 6 +- .../common/RFC6455ExamplesGeneratorTest.java | 4 +- .../common/TextPayloadParserTest.java | 10 +- .../common/WebSocketRemoteEndpointTest.java | 2 +- .../websocket/common/ab/TestABCase1_1.java | 2 +- .../websocket/common/ab/TestABCase7_3.java | 2 +- .../common/extensions/ExtensionTool.java | 4 +- .../extensions/FragmentExtensionTest.java | 2 +- .../compress/ByteAccumulatorTest.java | 18 ++-- .../compress/DeflateFrameExtensionTest.java | 20 ++-- .../io/payload/DeMaskProcessorTest.java | 2 +- .../message/MessageInputStreamTest.java | 8 +- .../message/MessageOutputStreamTest.java | 2 +- .../common/message/MessageWriterTest.java | 2 +- .../common/message/Utf8CharBufferTest.java | 12 +-- .../test/BlockheadClientConnection.java | 2 +- .../common/test/ByteBufferAssert.java | 4 +- .../common/test/RawFrameBuilder.java | 2 +- .../websocket/common/test/UnitParser.java | 2 +- .../jetty/websocket/common/util/Hex.java | 4 +- .../server/AnnotatedMaxMessageSizeTest.java | 2 +- .../server/FragmentExtensionTest.java | 4 +- .../PerMessageDeflateExtensionTest.java | 2 +- .../websocket/server/TooFastClientTest.java | 4 +- .../server/WebSocketServletRFCTest.java | 4 +- .../websocket/server/ab/TestABCase1.java | 28 ++--- .../websocket/server/ab/TestABCase2.java | 10 +- .../websocket/server/ab/TestABCase3.java | 6 +- .../websocket/server/ab/TestABCase4.java | 2 +- .../websocket/server/ab/TestABCase6.java | 12 +-- .../websocket/server/ab/TestABCase7.java | 8 +- .../websocket/server/ab/TestABCase9.java | 30 +++--- .../server/browser/BrowserSocket.java | 14 +-- .../websocket/server/helper/SafariD00.java | 10 +- .../jetty/xml/XmlConfigurationTest.java | 4 +- .../jetty/test/rfcs/RFC2616BaseTest.java | 4 +- .../jetty/test/support/JettyDistro.java | 4 +- .../jetty/test/support/StringUtil.java | 2 +- 93 files changed, 287 insertions(+), 287 deletions(-) diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBindingTest.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBindingTest.java index 78e720192e1..540bba05b37 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBindingTest.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/bindings/GlobalWebappConfigBindingTest.java @@ -89,8 +89,8 @@ public class GlobalWebappConfigBindingTest WebAppContext context = contexts.get(0); assertNotNull(context, "Context should not be null"); - String defaultClasses[] = context.getDefaultServerClasses(); - String currentClasses[] = context.getServerClasses(); + String[] defaultClasses = context.getDefaultServerClasses(); + String[] currentClasses = context.getServerClasses(); String addedClass = "org.eclipse.foo."; // What was added by the binding assertThat("Default Server Classes", addedClass, not(is(in(defaultClasses)))); diff --git a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java index caa382d1b9a..f226fd8bdbf 100644 --- a/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java +++ b/jetty-deploy/src/test/java/org/eclipse/jetty/deploy/test/XmlConfiguredJetty.java @@ -309,7 +309,7 @@ public class XmlConfiguredJetty { List contexts = new ArrayList<>(); HandlerCollection handlers = (HandlerCollection)_server.getHandler(); - Handler children[] = handlers.getChildHandlers(); + Handler[] children = handlers.getChildHandlers(); for (Handler handler : children) { @@ -396,7 +396,7 @@ public class XmlConfiguredJetty // Find the active server port. _serverPort = -1; - Connector connectors[] = _server.getConnectors(); + Connector[] connectors = _server.getConnectors(); for (int i = 0; _serverPort < 0 && i < connectors.length; i++) { if (connectors[i] instanceof NetworkConnector) diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java index 358bb397033..e58550bee61 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpCookieTest.java @@ -90,7 +90,7 @@ public class HttpCookieTest httpCookie = new HttpCookie("everything", "value", "domain", "path", 0, true, true, null, -1); assertEquals("everything=value; Path=path; Domain=domain; Expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Secure; HttpOnly", httpCookie.getRFC6265SetCookie()); - String badNameExamples[] = { + String[] badNameExamples = { "\"name\"", "name\t", "na me", @@ -118,7 +118,7 @@ public class HttpCookieTest } } - String badValueExamples[] = { + String[] badValueExamples = { "va\tlue", "\t", "value\u0000", @@ -147,7 +147,7 @@ public class HttpCookieTest } } - String goodNameExamples[] = { + String[] goodNameExamples = { "name", "n.a.m.e", "na-me", @@ -163,7 +163,7 @@ public class HttpCookieTest // should not throw an exception } - String goodValueExamples[] = { + String[] goodValueExamples = { "value", "", null, diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartCaptureTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartCaptureTest.java index aee5b6fb4cb..15006461dca 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartCaptureTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/MultiPartCaptureTest.java @@ -245,7 +245,7 @@ public class MultiPartCaptureTest continue; } - String split[] = line.split("\\|"); + String[] split = line.split("\\|"); switch (split[0]) { case "Request-Header": diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java index 1f18cf82e17..019aa158214 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/SyntaxTest.java @@ -30,7 +30,7 @@ public class SyntaxTest @Test public void testRequireValidRFC2616Token_Good() { - String tokens[] = { + String[] tokens = { "name", "", null, @@ -52,7 +52,7 @@ public class SyntaxTest @Test public void testRequireValidRFC2616Token_Bad() { - String tokens[] = { + String[] tokens = { "\"name\"", "name\t", "na me", @@ -83,7 +83,7 @@ public class SyntaxTest @Test public void testRequireValidRFC6265CookieValue_Good() { - String values[] = { + String[] values = { "value", "", null, @@ -104,7 +104,7 @@ public class SyntaxTest @Test public void testRequireValidRFC6265CookieValue_Bad() { - String values[] = { + String[] values = { "va\tlue", "\t", "value\u0000", diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecBadSpecsTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecBadSpecsTest.java index 55f3989a8b5..13d52dcd615 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecBadSpecsTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/pathmap/UriTemplatePathSpecBadSpecsTest.java @@ -33,7 +33,7 @@ public class UriTemplatePathSpecBadSpecsTest { public static Stream data() { - String badSpecs[] = new String[]{ + String[] badSpecs = new String[]{ "/a/b{var}", // bad syntax - variable does not encompass whole path segment "a/{var}", // bad syntax - no start slash "/a/{var/b}", // path segment separator in variable name diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java index 421bda3d050..36e3d4d6cc6 100644 --- a/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java +++ b/jetty-security/src/test/java/org/eclipse/jetty/security/ConstraintTest.java @@ -1652,7 +1652,7 @@ public class ConstraintTest private static String authBase64(String authorization) { - byte raw[] = authorization.getBytes(ISO_8859_1); + byte[] raw = authorization.getBytes(ISO_8859_1); return Base64.getEncoder().encodeToString(raw); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java index 1d03509f7c7..957d7be4916 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/CookieCutterTest.java @@ -58,7 +58,7 @@ public class CookieCutterTest { String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(1)); assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme"); @@ -75,7 +75,7 @@ public class CookieCutterTest { String rawCookie = "$Version=\"1\";Customer=\"WILE_E_COYOTE\";$Path=\"/acme\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(1)); assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme"); @@ -91,7 +91,7 @@ public class CookieCutterTest "Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " + "Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(2)); assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme"); @@ -109,7 +109,7 @@ public class CookieCutterTest "Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"; " + "Shipping=\"FedEx\"; $Path=\"/acme\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(3)); assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme"); @@ -127,7 +127,7 @@ public class CookieCutterTest "Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " + "Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(2)); assertCookie("Cookies[0]", cookies[0], "Part_Number", "Riding_Rocket_0023", 1, "/acme/ammo"); @@ -144,7 +144,7 @@ public class CookieCutterTest "session_id=\"1234\"; " + "session_id=\"1111\"; $Domain=\".cracker.edu\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(2)); assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null); @@ -160,7 +160,7 @@ public class CookieCutterTest String rawCookie = "$Version=\"1\"; session_id=\"1234\", " + "$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\""; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie); assertThat("Cookies.length", cookies.length, is(2)); assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null); @@ -180,7 +180,7 @@ public class CookieCutterTest { String rawCookie = "SID=31d4d96e407aad42"; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); assertThat("Cookies.length", cookies.length, is(1)); assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null); @@ -194,7 +194,7 @@ public class CookieCutterTest { String rawCookie = "SID=31d4d96e407aad42; lang=en-US"; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); assertThat("Cookies.length", cookies.length, is(2)); assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null); @@ -212,7 +212,7 @@ public class CookieCutterTest { String rawCookie = "SID=31d4d96e407aad42;lang=en-US"; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); assertThat("Cookies.length", cookies.length, is(2)); assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null); @@ -227,7 +227,7 @@ public class CookieCutterTest { String rawCookie = "key=value"; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); assertThat("Cookies.length", cookies.length, is(1)); assertCookie("Cookies[0]", cookies[0], "key", "value", 0, null); @@ -241,7 +241,7 @@ public class CookieCutterTest { String rawCookie = "$key=value"; - Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); + Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie); assertThat("Cookies.length", cookies.length, is(0)); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java index 31e3e7ca146..04dfe7af23e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpConnectionTest.java @@ -246,7 +246,7 @@ public class HttpConnectionTest StringBuilder request = new StringBuilder(); request.append("POST /?id=").append(Integer.toString(x)).append(" HTTP/1.1\r\n"); request.append("Host: local\r\n"); - int clen[] = contentLengths[x]; + int[] clen = contentLengths[x]; for (int n = 0; n < clen.length; n++) { request.append("Content-Length: ").append(Integer.toString(clen[n])).append("\r\n"); @@ -280,7 +280,7 @@ public class HttpConnectionTest StringBuilder request = new StringBuilder(); request.append("POST /?id=").append(Integer.toString(x)).append(" HTTP/1.1\r\n"); request.append("Host: local\r\n"); - int clen[] = contentLengths[x]; + int[] clen = contentLengths[x]; for (int n = 0; n < clen.length; n++) { if (clen[n] == -1) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java index 4c53c3340c7..4878907cf8e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpManyWaysToCommitTest.java @@ -442,7 +442,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest HttpTester.Response response = executeRequest(httpVersion); assertThat("response code", response.getStatus(), is(200)); assertThat(response, containsHeaderValue("content-length", "6")); - byte content[] = response.getContentBytes(); + byte[] content = response.getContentBytes(); assertThat("content bytes", content.length, is(0)); assertTrue(response.isEarlyEOF(), "response eof"); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java index 65bf507def3..e948feb1ae7 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java @@ -266,8 +266,8 @@ public class StressTest // System.err.println(); final int quantums = 48; final int[][] count = new int[_latencies.length][quantums]; - final int length[] = new int[_latencies.length]; - final int other[] = new int[_latencies.length]; + final int[] length = new int[_latencies.length]; + final int[] other = new int[_latencies.length]; long total = 0; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java index 2daf9e233d6..a145c2c2782 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ThreadStarvationTest.java @@ -317,7 +317,7 @@ public class ThreadStarvationTest long bodyCount = 0; long len; - byte buf[] = new byte[1024]; + byte[] buf = new byte[1024]; try { diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowSymLinkAliasCheckerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowSymLinkAliasCheckerTest.java index 690b72d5135..fc2fd37f1db 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowSymLinkAliasCheckerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowSymLinkAliasCheckerTest.java @@ -55,7 +55,7 @@ public class AllowSymLinkAliasCheckerTest { List data = new ArrayList<>(); - String dirs[] = { + String[] dirs = { "/workDir/", "/testdirlnk/", "/testdirprefixlnk/", "/testdirsuffixlnk/", "/testdirwraplnk/" }; diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java index cb0c5495348..fd88b48552d 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java @@ -102,7 +102,7 @@ public class ResourceHandlerTest try (BufferedReader reader = Files.newBufferedReader(big.toPath(), StandardCharsets.UTF_8)) { // a buffer large enough to capture at least 1 EOL - char cbuf[] = new char[128]; + char[] cbuf = new char[128]; reader.read(cbuf); String sample = new String(cbuf); if (sample.contains("\r\n")) diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java index 62888e4f92c..4dd9dfbfa1a 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java @@ -100,7 +100,7 @@ public class SecuredRedirectHandlerTest server.setConnectors(new Connector[]{httpConnector, httpsConnector}); // Wire up contexts - String secureHosts[] = new String[]{"@secured"}; + String[] secureHosts = new String[]{"@secured"}; ContextHandler test1Context = new ContextHandler(); test1Context.setContextPath("/test1"); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/StatisticsHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/StatisticsHandlerTest.java index 688428c21ca..c2c4a2fd4fc 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/StatisticsHandlerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/StatisticsHandlerTest.java @@ -82,7 +82,7 @@ public class StatisticsHandlerTest @Test public void testRequest() throws Exception { - final CyclicBarrier barrier[] = {new CyclicBarrier(2), new CyclicBarrier(2)}; + final CyclicBarrier[] barrier = {new CyclicBarrier(2), new CyclicBarrier(2)}; _statsHandler.setHandler(new AbstractHandler() { @@ -175,7 +175,7 @@ public class StatisticsHandlerTest @Test public void testTwoRequests() throws Exception { - final CyclicBarrier barrier[] = {new CyclicBarrier(3), new CyclicBarrier(3)}; + final CyclicBarrier[] barrier = {new CyclicBarrier(3), new CyclicBarrier(3)}; _latchHandler.reset(2); _statsHandler.setHandler(new AbstractHandler() { @@ -239,7 +239,7 @@ public class StatisticsHandlerTest final long dispatchTime = 10; final long requestTime = 50; final AtomicReference asyncHolder = new AtomicReference<>(); - final CyclicBarrier barrier[] = {new CyclicBarrier(2), new CyclicBarrier(2), new CyclicBarrier(2)}; + final CyclicBarrier[] barrier = {new CyclicBarrier(2), new CyclicBarrier(2), new CyclicBarrier(2)}; _statsHandler.setHandler(new AbstractHandler() { @Override @@ -369,7 +369,7 @@ public class StatisticsHandlerTest final long dispatchTime = 10; final long timeout = 100; final AtomicReference asyncHolder = new AtomicReference<>(); - final CyclicBarrier barrier[] = {new CyclicBarrier(2), new CyclicBarrier(2), new CyclicBarrier(2)}; + final CyclicBarrier[] barrier = {new CyclicBarrier(2), new CyclicBarrier(2), new CyclicBarrier(2)}; _statsHandler.setHandler(new AbstractHandler() { @Override @@ -483,7 +483,7 @@ public class StatisticsHandlerTest { final long dispatchTime = 10; final AtomicReference asyncHolder = new AtomicReference<>(); - final CyclicBarrier barrier[] = {new CyclicBarrier(2), new CyclicBarrier(2)}; + final CyclicBarrier[] barrier = {new CyclicBarrier(2), new CyclicBarrier(2)}; final CountDownLatch latch = new CountDownLatch(1); _statsHandler.setHandler(new AbstractHandler() diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java index 47596c6399e..5b41d82917e 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java @@ -113,7 +113,7 @@ public class DefaultServletTest connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false); File extraJarResources = MavenTestingUtils.getTestResourceFile(ODD_JAR); - URL urls[] = new URL[]{extraJarResources.toURI().toURL()}; + URL[] urls = new URL[]{extraJarResources.toURI().toURL()}; ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader extraClassLoader = new URLClassLoader(urls, parentClassLoader); diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipTester.java b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipTester.java index 09f07fb6a96..36215b33e9b 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipTester.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/GzipTester.java @@ -151,7 +151,7 @@ public class GzipTester digester = new DigestOutputStream(uncompressedStream, digest); IO.copy(in, digester); - byte output[] = uncompressedStream.toByteArray(); + byte[] output = uncompressedStream.toByteArray(); String actualSha1Sum = Hex.asHex(digest.digest()); return new ContentMetadata(output.length, actualSha1Sum); } diff --git a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/Hex.java b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/Hex.java index ea2f852d443..9366b7b9631 100644 --- a/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/Hex.java +++ b/jetty-servlets/src/test/java/org/eclipse/jetty/server/handler/gzip/Hex.java @@ -29,7 +29,7 @@ public final class Hex throw new IllegalArgumentException(String.format("Invalid ID length of <%d> expected range of <0> to <%d>", id.length(), (size * 2))); } - byte buf[] = new byte[size]; + byte[] buf = new byte[size]; byte hex; int len = id.length(); @@ -60,7 +60,7 @@ public final class Hex public static String asHex(byte buf[]) { int len = buf.length; - char out[] = new char[len * 2]; + char[] out = new char[len * 2]; for (int i = 0; i < len; i++) { out[i * 2] = hexcodes[(buf[i] & 0xF0) >> 4]; diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java index 60004dce4fc..41bf133b69b 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleGraphWriterTest.java @@ -45,7 +45,7 @@ public class ModuleGraphWriterTest // Test Env Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home"); Path baseDir = testdir.getEmptyPathDir(); - String cmdLine[] = new String[]{"jetty.version=TEST"}; + String[] cmdLine = new String[]{"jetty.version=TEST"}; // Configuration CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleTest.java index c7b8bfa5538..efdf39c01aa 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModuleTest.java @@ -48,7 +48,7 @@ public class ModuleTest // Test Env Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home"); Path baseDir = testdir.getEmptyPathDir(); - String cmdLine[] = new String[]{"jetty.version=TEST"}; + String[] cmdLine = new String[]{"jetty.version=TEST"}; // Configuration CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java index d5bc62fa1b3..45252d3abaa 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/ModulesTest.java @@ -50,7 +50,7 @@ public class ModulesTest // Test Env File homeDir = MavenTestingUtils.getTestResourceDir("dist-home"); File baseDir = testdir.getEmptyPathDir().toFile(); - String cmdLine[] = new String[]{"jetty.version=TEST"}; + String[] cmdLine = new String[]{"jetty.version=TEST"}; // Configuration CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); @@ -109,7 +109,7 @@ public class ModulesTest // intentionally setup top level resources dir (as this would have many // deep references) File baseDir = MavenTestingUtils.getTestResourcesDir(); - String cmdLine[] = new String[]{"jetty.version=TEST"}; + String[] cmdLine = new String[]{"jetty.version=TEST"}; // Configuration CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); @@ -146,7 +146,7 @@ public class ModulesTest // Test Env File homeDir = MavenTestingUtils.getTestResourceDir("dist-home"); File baseDir = testdir.getEmptyPathDir().toFile(); - String cmdLine[] = new String[]{"jetty.version=TEST"}; + String[] cmdLine = new String[]{"jetty.version=TEST"}; // Configuration CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java index 4510812c006..cd1dd21220e 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/config/ConfigSourcesTest.java @@ -297,7 +297,7 @@ public class ConfigSourcesTest ConfigSources sources = new ConfigSources(); - String cmdLine[] = new String[0]; + String[] cmdLine = new String[0]; sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyBaseConfigSource(base)); @@ -337,7 +337,7 @@ public class ConfigSourcesTest ConfigSources sources = new ConfigSources(); - String cmdLine[] = new String[0]; + String[] cmdLine = new String[0]; sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyBaseConfigSource(base)); @@ -383,7 +383,7 @@ public class ConfigSourcesTest ConfigSources sources = new ConfigSources(); - String cmdLine[] = new String[0]; + String[] cmdLine = new String[0]; sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyBaseConfigSource(base)); @@ -431,7 +431,7 @@ public class ConfigSourcesTest ConfigSources sources = new ConfigSources(); - String cmdLine[] = new String[0]; + String[] cmdLine = new String[0]; sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyBaseConfigSource(base)); @@ -485,7 +485,7 @@ public class ConfigSourcesTest ConfigSources sources = new ConfigSources(); - String cmdLine[] = new String[]{ + String[] cmdLine = new String[]{ // command line provided include-jetty-dir ref "--include-jetty-dir=" + devops.toString() }; @@ -536,7 +536,7 @@ public class ConfigSourcesTest ConfigSources sources = new ConfigSources(); - String cmdLine[] = new String[]{ + String[] cmdLine = new String[]{ // command line property should override all others "jetty.http.port=7070" }; @@ -594,7 +594,7 @@ public class ConfigSourcesTest UsageException e = assertThrows(UsageException.class, () -> { - String cmdLine[] = new String[0]; + String[] cmdLine = new String[0]; sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyBaseConfigSource(base)); diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/util/CorrectMavenCentralRefs.java b/jetty-start/src/test/java/org/eclipse/jetty/start/util/CorrectMavenCentralRefs.java index 16b7da590ab..708096b6ae7 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/util/CorrectMavenCentralRefs.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/util/CorrectMavenCentralRefs.java @@ -167,7 +167,7 @@ public class CorrectMavenCentralRefs String rawpath = line.substring(idx + keyword.length(), pipe); String destpath = line.substring(pipe + 1); - String parts[] = rawpath.split("/"); + String[] parts = rawpath.split("/"); int rev = parts.length; String filename = parts[--rev]; diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java index 4d2765ebd55..49fdd144a6d 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java @@ -194,7 +194,7 @@ public class BufferUtilTest @Test public void testToBuffer_Array() { - byte arr[] = new byte[128]; + byte[] arr = new byte[128]; Arrays.fill(arr, (byte)0x44); ByteBuffer buf = BufferUtil.toBuffer(arr); @@ -212,7 +212,7 @@ public class BufferUtilTest @Test public void testToBuffer_ArrayOffsetLength() { - byte arr[] = new byte[128]; + byte[] arr = new byte[128]; Arrays.fill(arr, (byte)0xFF); // fill whole thing with FF int offset = 10; int length = 100; diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java index dcac73a88cf..2e32f886b64 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/LazyListTest.java @@ -421,7 +421,7 @@ public class LazyListTest @Test public void testAddArray_NullInput_NullArray() { - String arr[] = null; + String[] arr = null; Object list = LazyList.addArray(null, arr); assertNull(list); } @@ -432,7 +432,7 @@ public class LazyListTest @Test public void testAddArray_NullInput_EmptyArray() { - String arr[] = new String[0]; + String[] arr = new String[0]; Object list = LazyList.addArray(null, arr); if (STRICT) { @@ -447,7 +447,7 @@ public class LazyListTest @Test public void testAddArray_NullInput_SingleArray() { - String arr[] = new String[]{"a"}; + String[] arr = new String[]{"a"}; Object list = LazyList.addArray(null, arr); assertNotNull(list); if (STRICT) @@ -464,7 +464,7 @@ public class LazyListTest @Test public void testAddArray_NullInput_Array() { - String arr[] = new String[]{"a", "b", "c"}; + String[] arr = new String[]{"a", "b", "c"}; Object list = LazyList.addArray(null, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -481,7 +481,7 @@ public class LazyListTest public void testAddArray_NonListInput_NullArray() { String input = "z"; - String arr[] = null; + String[] arr = null; Object list = LazyList.addArray(input, arr); assertNotNull(list); if (STRICT) @@ -499,7 +499,7 @@ public class LazyListTest public void testAddArray_NonListInput_EmptyArray() { String input = "z"; - String arr[] = new String[0]; + String[] arr = new String[0]; Object list = LazyList.addArray(input, arr); assertNotNull(list); if (STRICT) @@ -517,7 +517,7 @@ public class LazyListTest public void testAddArray_NonListInput_SingleArray() { String input = "z"; - String arr[] = new String[]{"a"}; + String[] arr = new String[]{"a"}; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -533,7 +533,7 @@ public class LazyListTest public void testAddArray_NonListInput_Array() { String input = "z"; - String arr[] = new String[]{"a", "b", "c"}; + String[] arr = new String[]{"a", "b", "c"}; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -554,7 +554,7 @@ public class LazyListTest input = LazyList.add(input, "y"); input = LazyList.add(input, "z"); - String arr[] = null; + String[] arr = null; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -574,7 +574,7 @@ public class LazyListTest input = LazyList.add(input, "y"); input = LazyList.add(input, "z"); - String arr[] = new String[0]; + String[] arr = new String[0]; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -594,7 +594,7 @@ public class LazyListTest input = LazyList.add(input, "y"); input = LazyList.add(input, "z"); - String arr[] = new String[]{"a"}; + String[] arr = new String[]{"a"}; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -615,7 +615,7 @@ public class LazyListTest input = LazyList.add(input, "y"); input = LazyList.add(input, "z"); - String arr[] = new String[]{"a", "b", "c"}; + String[] arr = new String[]{"a", "b", "c"}; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -639,7 +639,7 @@ public class LazyListTest input.add("y"); input.add("z"); - String arr[] = null; + String[] arr = null; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -660,7 +660,7 @@ public class LazyListTest input.add("y"); input.add("z"); - String arr[] = new String[0]; + String[] arr = new String[0]; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -681,7 +681,7 @@ public class LazyListTest input.add("y"); input.add("z"); - String arr[] = new String[]{"a"}; + String[] arr = new String[]{"a"}; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -703,7 +703,7 @@ public class LazyListTest input.add("y"); input.add("z"); - String arr[] = new String[]{"a", "b", "c"}; + String[] arr = new String[]{"a", "b", "c"}; Object list = LazyList.addArray(input, arr); assertNotNull(list); assertTrue(list instanceof List); @@ -1285,7 +1285,7 @@ public class LazyListTest assertTrue(arr.getClass().isArray()); assertTrue(arr instanceof String[]); - String strs[] = (String[])arr; + String[] strs = (String[])arr; assertEquals(1, strs.length); assertEquals("a", strs[0]); } @@ -1305,7 +1305,7 @@ public class LazyListTest assertTrue(arr.getClass().isArray()); assertTrue(arr instanceof String[]); - String strs[] = (String[])arr; + String[] strs = (String[])arr; assertEquals(3, strs.length); assertEquals("a", strs[0]); assertEquals("b", strs[1]); @@ -1328,7 +1328,7 @@ public class LazyListTest assertTrue(arr.getClass().isArray()); assertTrue(arr instanceof int[]); - int nums[] = (int[])arr; + int[] nums = (int[])arr; assertEquals(4, nums.length); assertEquals(22, nums[0]); assertEquals(333, nums[1]); @@ -1352,7 +1352,7 @@ public class LazyListTest assertTrue(arr.getClass().isArray()); assertTrue(arr instanceof String[]); - String strs[] = (String[])arr; + String[] strs = (String[])arr; assertEquals(3, strs.length); assertEquals("a", strs[0]); assertEquals("b", strs[1]); @@ -1832,7 +1832,7 @@ public class LazyListTest @Test public void testArray2List_NullInput() { - Object input[] = null; + Object[] input = null; Object list = ArrayUtil.asMutableList(input); assertNotNull(list); @@ -1846,7 +1846,7 @@ public class LazyListTest @Test public void testArray2List_EmptyInput() { - String input[] = new String[0]; + String[] input = new String[0]; Object list = ArrayUtil.asMutableList(input); assertNotNull(list); @@ -1860,7 +1860,7 @@ public class LazyListTest @Test public void testArray2List_SingleInput() { - String input[] = new String[]{"a"}; + String[] input = new String[]{"a"}; Object list = ArrayUtil.asMutableList(input); assertNotNull(list); @@ -1875,7 +1875,7 @@ public class LazyListTest @Test public void testArray2List_MultiInput() { - String input[] = new String[]{"a", "b", "c"}; + String[] input = new String[]{"a", "b", "c"}; Object list = ArrayUtil.asMutableList(input); assertNotNull(list); @@ -1892,7 +1892,7 @@ public class LazyListTest @Test public void testArray2List_GenericsInput() { - String input[] = new String[]{"a", "b", "c"}; + String[] input = new String[]{"a", "b", "c"}; // Test the Generics definitions for array2List List list = ArrayUtil.asMutableList(input); @@ -1910,9 +1910,9 @@ public class LazyListTest @Test public void testAddToArray_NullInput_NullItem() { - Object input[] = null; + Object[] input = null; - Object arr[] = ArrayUtil.addToArray(input, null, Object.class); + Object[] arr = ArrayUtil.addToArray(input, null, Object.class); assertNotNull(arr); if (STRICT) { @@ -1935,9 +1935,9 @@ public class LazyListTest assumeTrue(STRICT); // Harsh test case. - Object input[] = null; + Object[] input = null; - Object arr[] = ArrayUtil.addToArray(input, null, null); + Object[] arr = ArrayUtil.addToArray(input, null, null); assertNotNull(arr); if (STRICT) { @@ -1956,9 +1956,9 @@ public class LazyListTest @Test public void testAddToArray_NullInput_SimpleItem() { - Object input[] = null; + Object[] input = null; - Object arr[] = ArrayUtil.addToArray(input, "a", String.class); + Object[] arr = ArrayUtil.addToArray(input, "a", String.class); assertNotNull(arr); assertEquals(1, arr.length); assertEquals("a", arr[0]); @@ -1976,9 +1976,9 @@ public class LazyListTest @Test public void testAddToArray_EmptyInput_NullItem() { - String input[] = new String[0]; + String[] input = new String[0]; - String arr[] = ArrayUtil.addToArray(input, null, Object.class); + String[] arr = ArrayUtil.addToArray(input, null, Object.class); assertNotNull(arr); if (STRICT) { @@ -1997,9 +1997,9 @@ public class LazyListTest @Test public void testAddToArray_EmptyInput_SimpleItem() { - String input[] = new String[0]; + String[] input = new String[0]; - String arr[] = ArrayUtil.addToArray(input, "a", String.class); + String[] arr = ArrayUtil.addToArray(input, "a", String.class); assertNotNull(arr); assertEquals(1, arr.length); assertEquals("a", arr[0]); @@ -2011,9 +2011,9 @@ public class LazyListTest @Test public void testAddToArray_SingleInput_NullItem() { - String input[] = new String[]{"z"}; + String[] input = new String[]{"z"}; - String arr[] = ArrayUtil.addToArray(input, null, Object.class); + String[] arr = ArrayUtil.addToArray(input, null, Object.class); assertNotNull(arr); if (STRICT) { @@ -2034,9 +2034,9 @@ public class LazyListTest @Test public void testAddToArray_SingleInput_SimpleItem() { - String input[] = new String[]{"z"}; + String[] input = new String[]{"z"}; - String arr[] = ArrayUtil.addToArray(input, "a", String.class); + String[] arr = ArrayUtil.addToArray(input, "a", String.class); assertNotNull(arr); assertEquals(2, arr.length); assertEquals("z", arr[0]); @@ -2049,9 +2049,9 @@ public class LazyListTest @Test public void testRemoveFromArray_NullInput_NullItem() { - Object input[] = null; + Object[] input = null; - Object arr[] = ArrayUtil.removeFromArray(input, null); + Object[] arr = ArrayUtil.removeFromArray(input, null); assertNull(arr); } @@ -2061,9 +2061,9 @@ public class LazyListTest @Test public void testRemoveFromArray_NullInput_SimpleItem() { - Object input[] = null; + Object[] input = null; - Object arr[] = ArrayUtil.removeFromArray(input, "a"); + Object[] arr = ArrayUtil.removeFromArray(input, "a"); assertNull(arr); } @@ -2073,9 +2073,9 @@ public class LazyListTest @Test public void testRemoveFromArray_EmptyInput_NullItem() { - String input[] = new String[0]; + String[] input = new String[0]; - String arr[] = ArrayUtil.removeFromArray(input, null); + String[] arr = ArrayUtil.removeFromArray(input, null); assertNotNull(arr, "Should not be null"); assertEquals(0, arr.length); } @@ -2086,9 +2086,9 @@ public class LazyListTest @Test public void testRemoveFromArray_EmptyInput_SimpleItem() { - String input[] = new String[0]; + String[] input = new String[0]; - String arr[] = ArrayUtil.removeFromArray(input, "a"); + String[] arr = ArrayUtil.removeFromArray(input, "a"); assertNotNull(arr, "Should not be null"); assertEquals(0, arr.length); } @@ -2099,9 +2099,9 @@ public class LazyListTest @Test public void testRemoveFromArray_SingleInput() { - String input[] = new String[]{"a"}; + String[] input = new String[]{"a"}; - String arr[] = ArrayUtil.removeFromArray(input, null); + String[] arr = ArrayUtil.removeFromArray(input, null); assertNotNull(arr, "Should not be null"); assertEquals(1, arr.length); assertEquals("a", arr[0]); @@ -2118,9 +2118,9 @@ public class LazyListTest @Test public void testRemoveFromArray_MultiInput() { - String input[] = new String[]{"a", "b", "c"}; + String[] input = new String[]{"a", "b", "c"}; - String arr[] = ArrayUtil.removeFromArray(input, null); + String[] arr = ArrayUtil.removeFromArray(input, null); assertNotNull(arr, "Should not be null"); assertEquals(3, arr.length); assertEquals("a", arr[0]); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java index bec6bc2031f..6f84a33188c 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/MultiMapTest.java @@ -136,7 +136,7 @@ public class MultiMapTest String key = "formats"; - String input[] = {"gzip", "jar", "pack200"}; + String[] input = {"gzip", "jar", "pack200"}; mm.putValues(key, input); assertMapSize(mm, 1); assertValues(mm, key, "gzip", "jar", "pack200"); @@ -245,7 +245,7 @@ public class MultiMapTest assertValues(mm, key, "gzip"); // Add to the key - String extras[] = {"jar", "pack200", "zip"}; + String[] extras = {"jar", "pack200", "zip"}; mm.addValues(key, extras); assertMapSize(mm, 1); @@ -268,7 +268,7 @@ public class MultiMapTest assertValues(mm, key, "gzip"); // Add to the key - String extras[] = new String[0]; + String[] extras = new String[0]; mm.addValues(key, extras); assertMapSize(mm, 1); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java index 871407421d4..ecd5fee8bdc 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/PathWatcherTest.java @@ -262,7 +262,7 @@ public class PathWatcherTest // average chunk buffer int chunkBufLen = 16; - byte chunkBuf[] = new byte[chunkBufLen]; + byte[] chunkBuf = new byte[chunkBufLen]; Arrays.fill(chunkBuf, (byte)'x'); long end = System.nanoTime() + timeUnit.toNanos(timeDuration); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/TrieTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/TrieTest.java index 3107efa0ec9..e23ccbcb208 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/TrieTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/TrieTest.java @@ -83,7 +83,7 @@ public class TrieTest @MethodSource("implementations") public void testKeySet(Trie trie) throws Exception { - String values[] = new String[]{ + String[] values = new String[]{ "hello", "He", "HELL", diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java index 44e304a9c0c..c2e7ad56c7d 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/URIUtilTest.java @@ -85,7 +85,7 @@ public class URIUtilTest assertEquals("f\u0629\u0629%23;,:=b a r", URIUtil.decodePath("f%d8%a9%d8%a9%2523%3b%2c:%3db%20a%20r")); // Test for null character (real world ugly test case) - byte oddBytes[] = {'/', 0x00, '/'}; + byte[] oddBytes = {'/', 0x00, '/'}; String odd = new String(oddBytes, StandardCharsets.ISO_8859_1); assertEquals(odd, URIUtil.decodePath("/%00/")); } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java index 8c0c5ce5bbc..200d226e938 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/Utf8AppendableTest.java @@ -258,7 +258,7 @@ public class Utf8AppendableTest @TestFactory public Iterator testBadUtf8() { - String samples[] = new String[]{ + String[] samples = new String[]{ "c0af", "EDA080", "f08080af", diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/Slf4jHelper.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/Slf4jHelper.java index 6930f2d7e54..529da51c3bb 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/Slf4jHelper.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/Slf4jHelper.java @@ -35,7 +35,7 @@ public final class Slf4jHelper File testJarDir = MavenTestingUtils.getTargetFile("test-jars"); assumeTrue(testJarDir.exists()); // trigger @Ignore if dir not there - File jarfiles[] = testJarDir.listFiles(new FileFilter() + File[] jarfiles = testJarDir.listFiles(new FileFilter() { public boolean accept(File path) { @@ -49,7 +49,7 @@ public final class Slf4jHelper assumeTrue(jarfiles.length > 0); // trigger @Ignore if no jar files. - URL urls[] = new URL[jarfiles.length]; + URL[] urls = new URL[jarfiles.length]; for (int i = 0; i < jarfiles.length; i++) { urls[i] = jarfiles[i].toURI().toURL(); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java index 4a1fd81866f..9fa220d6402 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java @@ -621,7 +621,7 @@ public class FileSystemResourceTest try (Resource base = newResource(resourceClass, dir.toFile())) { - String list[] = base.list(); + String[] list = base.list(); List actual = Arrays.asList(list); assertEquals(expected.size(), actual.size()); diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java index 9981cd4f4d6..99a9bd4a345 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/LargeMessageTest.java @@ -92,7 +92,7 @@ public class LargeMessageTest // Issue connect using instance of class that extends Endpoint Session session = container.connectToServer(echoer, wsUri); - byte buf[] = new byte[LARGER_THAN_DEFAULT_SIZE]; + byte[] buf = new byte[LARGER_THAN_DEFAULT_SIZE]; Arrays.fill(buf, (byte)'x'); String message = new String(buf, UTF_8); session.getBasicRemote().sendText(message); diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageReceivingTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageReceivingTest.java index 563503e327c..1a66eae99f8 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageReceivingTest.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/MessageReceivingTest.java @@ -63,7 +63,7 @@ public class MessageReceivingTest public MessageReceivingTest() { - byte raw[] = new byte[1024 * 1024]; + byte[] raw = new byte[1024 * 1024]; Arrays.fill(raw, (byte)'x'); VERY_LONG_STRING = new String(raw, StandardCharsets.UTF_8); } diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/encoders/ValidDualEncoder.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/encoders/ValidDualEncoder.java index 5de3ba4b6a7..ffb78c1553a 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/encoders/ValidDualEncoder.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/encoders/ValidDualEncoder.java @@ -43,7 +43,7 @@ public class ValidDualEncoder implements Encoder.Text, Encoder.BinarySt @Override public void encode(Long object, OutputStream os) throws EncodeException, IOException { - byte b[] = new byte[8]; + byte[] b = new byte[8]; long v = object; b[0] = (byte)(v >>> 56); b[1] = (byte)(v >>> 48); diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/TypeTree.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/TypeTree.java index 653ff847c9b..d8c9a71502a 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/TypeTree.java +++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/utils/TypeTree.java @@ -80,7 +80,7 @@ public class TypeTree System.out.printf("%s (ParameterizedType) = %s%n", indent, ReflectUtils.toShortName(ptype)); // dumpTree(indent + ".ownerType()",ptype.getOwnerType()); dumpTree(indent + ".rawType(" + ReflectUtils.toShortName(ptype.getRawType()) + ")", ptype.getRawType()); - Type args[] = ptype.getActualTypeArguments(); + Type[] args = ptype.getActualTypeArguments(); if (args != null) { System.out.printf("%s.actualTypeArguments[].length = %d%n", indent, args.length); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeAnnotatedTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeAnnotatedTest.java index 08ed7b9d221..ac7ca83c96b 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeAnnotatedTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeAnnotatedTest.java @@ -90,7 +90,7 @@ public class LargeAnnotatedTest // wait for connect foo.get(1, TimeUnit.SECONDS); // The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies - byte txt[] = new byte[100 * 1024]; + byte[] txt = new byte[100 * 1024]; Arrays.fill(txt, (byte)'o'); String msg = new String(txt, StandardCharsets.UTF_8); clientEcho.sendMessage(msg); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeClientContainerServlet.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeClientContainerServlet.java index 62194a92a20..76a1e9af85e 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeClientContainerServlet.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeClientContainerServlet.java @@ -79,7 +79,7 @@ public class LargeClientContainerServlet extends HttpServlet size = Integer.parseInt(sizeParam); } - byte buf[] = new byte[size]; + byte[] buf = new byte[size]; Arrays.fill(buf, (byte)'x'); String destUrl = req.getParameter("destUrl"); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeContainerTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeContainerTest.java index ff8dea2e580..2571bf35507 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeContainerTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeContainerTest.java @@ -77,7 +77,7 @@ public class LargeContainerTest // wait for connect foo.get(1, TimeUnit.SECONDS); // The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies - byte txt[] = new byte[100 * 1024]; + byte[] txt = new byte[100 * 1024]; Arrays.fill(txt, (byte)'o'); String msg = new String(txt, StandardCharsets.UTF_8); clientEcho.sendMessage(msg); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeOnOpenSessionConfiguredTest.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeOnOpenSessionConfiguredTest.java index 4a462bdc4aa..974f48e95f7 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeOnOpenSessionConfiguredTest.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeOnOpenSessionConfiguredTest.java @@ -85,7 +85,7 @@ public class LargeOnOpenSessionConfiguredTest // wait for connect foo.get(1, TimeUnit.SECONDS); // The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies - byte txt[] = new byte[100 * 1024]; + byte[] txt = new byte[100 * 1024]; Arrays.fill(txt, (byte)'o'); String msg = new String(txt, StandardCharsets.UTF_8); clientEcho.sendMessage(msg); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeServerContainerAsClientContainerServlet.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeServerContainerAsClientContainerServlet.java index 122a4e6aec5..085384756ee 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeServerContainerAsClientContainerServlet.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/LargeServerContainerAsClientContainerServlet.java @@ -78,7 +78,7 @@ public class LargeServerContainerAsClientContainerServlet extends HttpServlet size = Integer.parseInt(sizeParam); } - byte buf[] = new byte[size]; + byte[] buf = new byte[size]; Arrays.fill(buf, (byte)'x'); String destUrl = req.getParameter("destUrl"); diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java index 7c5bc5294eb..0576550300e 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/browser/JsrBrowserSocket.java @@ -55,9 +55,9 @@ public class JsrBrowserSocket @Override public void run() { - char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); + char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); int lettersLen = letters.length; - char randomText[] = new char[size]; + char[] randomText = new char[size]; Random rand = new Random(42); String msg; @@ -141,7 +141,7 @@ public class JsrBrowserSocket } case "many": { - String parts[] = StringUtil.csvSplit(val); + String[] parts = StringUtil.csvSplit(val); int size = Integer.parseInt(parts[0]); int count = Integer.parseInt(parts[1]); @@ -150,12 +150,12 @@ public class JsrBrowserSocket } case "manythreads": { - String parts[] = StringUtil.csvSplit(val); + String[] parts = StringUtil.csvSplit(val); int threadCount = Integer.parseInt(parts[0]); int size = Integer.parseInt(parts[1]); int count = Integer.parseInt(parts[2]); - Thread threads[] = new Thread[threadCount]; + Thread[] threads = new Thread[threadCount]; // Setup threads for (int n = 0; n < threadCount; n++) @@ -194,9 +194,9 @@ public class JsrBrowserSocket private void writeManyAsync(int size, int count) { - char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); + char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); int lettersLen = letters.length; - char randomText[] = new char[size]; + char[] randomText = new char[size]; Random rand = new Random(42); for (int n = 0; n < count; n++) diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongMessageEndpoint.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongMessageEndpoint.java index 18119e8b39b..776167da6fc 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongMessageEndpoint.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongMessageEndpoint.java @@ -43,7 +43,7 @@ public class PongMessageEndpoint extends Endpoint implements MessageHandler.Whol @Override public void onMessage(PongMessage pong) { - byte buf[] = BufferUtil.toArray(pong.getApplicationData()); + byte[] buf = BufferUtil.toArray(pong.getApplicationData()); String message = new String(buf, StandardCharsets.UTF_8); this.session.getAsyncRemote().sendText("PongMessage[" + path + "]:" + message); } diff --git a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java index 27ab9958898..14db41fe243 100644 --- a/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java +++ b/jetty-websocket/javax-websocket-server-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/server/samples/pong/PongSocket.java @@ -49,7 +49,7 @@ public class PongSocket { if (LOG.isDebugEnabled()) LOG.debug("onPong(): PongMessage.appData={}", BufferUtil.toDetailString(pong.getApplicationData())); - byte buf[] = BufferUtil.toArray(pong.getApplicationData()); + byte[] buf = BufferUtil.toArray(pong.getApplicationData()); String message = new String(buf, StandardCharsets.UTF_8); this.session.getAsyncRemote().sendText("@OnMessage(PongMessage)[" + path + "]:" + message); } diff --git a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java index 1d930bef58a..3b843c0e98f 100644 --- a/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java +++ b/jetty-websocket/jetty-websocket-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/WebSocketClientTest.java @@ -284,7 +284,7 @@ public class WebSocketClientTest // Create string that is larger than default size of 64k // but smaller than maxMessageSize of 100k int size = 80 * 1024; - byte buf[] = new byte[size]; + byte[] buf = new byte[size]; Arrays.fill(buf, (byte)'x'); String msg = StringUtil.toUTF8String(buf, 0, buf.length); diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/HttpClientInitTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/HttpClientInitTest.java index 4d138add151..15d1b9a0952 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/HttpClientInitTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/HttpClientInitTest.java @@ -98,7 +98,7 @@ public class HttpClientInitTest public void testXmlResourceInit() throws Exception { ClassLoader parent = Thread.currentThread().getContextClassLoader(); - URL urls[] = new URL[]{ + URL[] urls = new URL[]{ MavenTestingUtils.getTestResourceDir("httpclient/simple").toURI().toURL() }; URLClassLoader classLoader = new URLClassLoader(urls, parent); diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java index 04e7fea2232..cafa9d20e79 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/TomcatServerQuirksTest.java @@ -123,7 +123,7 @@ public class TomcatServerQuirksTest try (BlockheadConnection serverConn = serverConnFut.get(Timeouts.CONNECT, Timeouts.CONNECT_UNIT)) { // Have server write frame. - byte payload[] = new byte[bufferSize / 2]; + byte[] payload = new byte[bufferSize / 2]; Arrays.fill(payload, (byte)'x'); ByteBuffer serverFrame = BufferUtil.allocate(bufferSize); BufferUtil.flipToFill(serverFrame); diff --git a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java index 571c4eef1da..c41b536ea9a 100644 --- a/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java +++ b/jetty-websocket/websocket-client/src/test/java/org/eclipse/jetty/websocket/client/examples/TestClient.java @@ -200,7 +200,7 @@ public class TestClient op = OpCode.BINARY; } - byte data[] = null; + byte[] data = null; switch (op) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java index 129fe6220ca..4e3a16545f8 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressExtension.java @@ -521,7 +521,7 @@ public abstract class CompressExtension extends AbstractExtension { // Handle tail bytes generated by SYNC_FLUSH. if (LOG.isDebugEnabled()) - LOG.debug("compressed bytes[] = {}", BufferUtil.toDetailString(payload)); + LOG.debug("compressed[] bytes = {}", BufferUtil.toDetailString(payload)); if (tailDrop == TAIL_DROP_ALWAYS) { diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/AcceptHashTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/AcceptHashTest.java index b5213301235..f392567d711 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/AcceptHashTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/AcceptHashTest.java @@ -31,7 +31,7 @@ public class AcceptHashTest @Test public void testHash() { - byte key[] = TypeUtil.fromHexString("00112233445566778899AABBCCDDEEFF"); + byte[] key = TypeUtil.fromHexString("00112233445566778899AABBCCDDEEFF"); assertThat("Key size", key.length, is(16)); // what the client sends diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/CloseInfoTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/CloseInfoTest.java index 6351d53e31a..74fb4a49180 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/CloseInfoTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/CloseInfoTest.java @@ -121,7 +121,7 @@ public class CloseInfoTest private ByteBuffer asByteBuffer(int statusCode, String reason) { int len = 2; // status code length - byte utf[] = null; + byte[] utf = null; if (StringUtil.isNotBlank(reason)) { utf = StringUtil.getUtf8Bytes(reason); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java index d138d2d21ee..9fc8871f7dc 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ClosePayloadParserTest.java @@ -39,7 +39,7 @@ public class ClosePayloadParserTest { String expectedReason = "Game Over"; - byte utf[] = expectedReason.getBytes(StandardCharsets.UTF_8); + byte[] utf = expectedReason.getBytes(StandardCharsets.UTF_8); ByteBuffer payload = ByteBuffer.allocate(utf.length + 2); payload.putChar((char)StatusCode.NORMAL); payload.put(utf, 0, utf.length); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorParserRoundtripTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorParserRoundtripTest.java index bd7e11bcfa1..ad531650199 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorParserRoundtripTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorParserRoundtripTest.java @@ -93,7 +93,7 @@ public class GeneratorParserRoundtripTest WebSocketFrame frame = new TextFrame().setPayload(message); // Add masking - byte mask[] = new byte[4]; + byte[] mask = new byte[4]; Arrays.fill(mask, (byte)0xFF); frame.setMask(mask); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java index 35c54e9e22b..d0797746283 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/GeneratorTest.java @@ -115,7 +115,7 @@ public class GeneratorTest private String asMaskedHex(String str, byte[] maskingKey) { - byte utf[] = StringUtil.getUtf8Bytes(str); + byte[] utf = StringUtil.getUtf8Bytes(str); mask(utf, maskingKey); return Hex.asHex(utf); } @@ -156,7 +156,7 @@ public class GeneratorTest public void testText_Hello() { WebSocketFrame frame = new TextFrame().setPayload("Hello"); - byte utf[] = StringUtil.getUtf8Bytes("Hello"); + byte[] utf = StringUtil.getUtf8Bytes("Hello"); assertGeneratedBytes("8105" + Hex.asHex(utf), frame); } @@ -164,7 +164,7 @@ public class GeneratorTest public void testText_Masked() { WebSocketFrame frame = new TextFrame().setPayload("Hello"); - byte maskingKey[] = Hex.asByteArray("11223344"); + byte[] maskingKey = Hex.asByteArray("11223344"); frame.setMask(maskingKey); // what is expected @@ -190,7 +190,7 @@ public class GeneratorTest // payload does not start at position 0. LOG.debug("Payload = {}", BufferUtil.toDetailString(payload)); WebSocketFrame frame = new TextFrame().setPayload(payload); - byte maskingKey[] = Hex.asByteArray("11223344"); + byte[] maskingKey = Hex.asByteArray("11223344"); frame.setMask(maskingKey); // what is expected @@ -219,7 +219,7 @@ public class GeneratorTest frames[pingCount] = new CloseInfo(StatusCode.NORMAL).asFrame(); // Mask All Frames - byte maskingKey[] = Hex.asByteArray("11223344"); + byte[] maskingKey = Hex.asByteArray("11223344"); for (WebSocketFrame f : frames) { f.setMask(maskingKey); @@ -232,7 +232,7 @@ public class GeneratorTest expected.append("8986").append("11223344"); expected.append(asMaskedHex("ping-1", maskingKey)); // ping 1 expected.append("8882").append("11223344"); - byte closure[] = Hex.asByteArray("03E8"); + byte[] closure = Hex.asByteArray("03E8"); mask(closure, maskingKey); expected.append(Hex.asHex(closure)); // normal closure @@ -246,7 +246,7 @@ public class GeneratorTest public void testWindowedGenerate() { // A decent sized frame, no masking - byte payload[] = new byte[10240]; + byte[] payload = new byte[10240]; Arrays.fill(payload, (byte)0x44); WebSocketFrame frame = new BinaryFrame().setPayload(payload); @@ -271,10 +271,10 @@ public class GeneratorTest public void testWindowedGenerateWithMasking() { // A decent sized frame, with masking - byte payload[] = new byte[10240]; + byte[] payload = new byte[10240]; Arrays.fill(payload, (byte)0x55); - byte mask[] = new byte[] + byte[] mask = new byte[] {0x2A, (byte)0xF0, 0x0F, 0x00}; WebSocketFrame frame = new BinaryFrame().setPayload(payload); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java index 2faa089ac3c..3b5a233e6ed 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ParserTest.java @@ -145,14 +145,14 @@ public class ParserTest public void testParseCase6_2_3() { String utf8 = "Hello-\uC2B5@\uC39F\uC3A4\uC3BC\uC3A0\uC3A1-UTF-8!!"; - byte msg[] = StringUtil.getUtf8Bytes(utf8); + byte[] msg = StringUtil.getUtf8Bytes(utf8); List send = new ArrayList<>(); int textCount = 0; int continuationCount = 0; int len = msg.length; boolean continuation = false; - byte mini[]; + byte[] mini; for (int i = 0; i < len; i++) { DataFrame frame = null; @@ -207,7 +207,7 @@ public class ParserTest public void testWindowedParseLargeFrame() { // Create frames - byte payload[] = new byte[65536]; + byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)'*'); List frames = new ArrayList<>(); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java index 77696319993..291c9a8fc5d 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/RFC6455ExamplesGeneratorTest.java @@ -104,7 +104,7 @@ public class RFC6455ExamplesGeneratorTest int dataSize = 256; BinaryFrame binary = new BinaryFrame(); - byte payload[] = new byte[dataSize]; + byte[] payload = new byte[dataSize]; Arrays.fill(payload, (byte)0x44); binary.setPayload(ByteBuffer.wrap(payload)); @@ -133,7 +133,7 @@ public class RFC6455ExamplesGeneratorTest int dataSize = 1024 * 64; BinaryFrame binary = new BinaryFrame(); - byte payload[] = new byte[dataSize]; + byte[] payload = new byte[dataSize]; Arrays.fill(payload, (byte)0x44); binary.setPayload(ByteBuffer.wrap(payload)); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java index 8f1b661d050..ea4a13b5a82 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/TextPayloadParserTest.java @@ -47,7 +47,7 @@ public class TextPayloadParserTest policy.setInputBufferSize(1024); // read buffer policy.setMaxTextMessageBufferSize(1024); // streaming buffer (not used in this test) policy.setMaxTextMessageSize(1024); // actual maximum text message size policy - byte utf[] = new byte[2048]; + byte[] utf = new byte[2048]; Arrays.fill(utf, (byte)'a'); assertThat("Must be a medium length payload", utf.length, allOf(greaterThan(0x7E), lessThan(0xFFFF))); @@ -78,7 +78,7 @@ public class TextPayloadParserTest sb.append(". The end."); String expectedText = sb.toString(); - byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8); + byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8); assertThat("Must be a long length payload", utf.length, greaterThan(0xFFFF)); @@ -114,7 +114,7 @@ public class TextPayloadParserTest sb.append(". The end."); String expectedText = sb.toString(); - byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8); + byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8); assertThat("Must be a medium length payload", utf.length, allOf(greaterThan(0x7E), lessThan(0xFFFF))); @@ -180,7 +180,7 @@ public class TextPayloadParserTest public void testShortMaskedText() throws Exception { String expectedText = "Hello World"; - byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8); + byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8); ByteBuffer buf = ByteBuffer.allocate(24); buf.put((byte)0x81); @@ -205,7 +205,7 @@ public class TextPayloadParserTest { String expectedText = "Hell\uFF4f W\uFF4Frld"; - byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8); + byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8); ByteBuffer buf = ByteBuffer.allocate(24); buf.put((byte)0x81); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpointTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpointTest.java index 68fffa02c53..41fe708a7d4 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpointTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpointTest.java @@ -103,7 +103,7 @@ public class WebSocketRemoteEndpointTest conn.opened(); int largeMessageSize = 60000; - byte buf[] = new byte[largeMessageSize]; + byte[] buf = new byte[largeMessageSize]; Arrays.fill(buf, (byte)'x'); String largeMessage = new String(buf, UTF_8); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java index 58891337a82..d40b68ecc38 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase1_1.java @@ -50,7 +50,7 @@ public class TestABCase1_1 public void testGenerate125ByteTextCase1_1_2() { int length = 125; - byte buf[] = new byte[length]; + byte[] buf = new byte[length]; Arrays.fill(buf, (byte)'*'); String text = new String(buf, StandardCharsets.UTF_8); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java index fc386561dd9..b0ad53a464b 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/ab/TestABCase7_3.java @@ -210,7 +210,7 @@ public class TestABCase7_3 ByteBuffer actual = UnitGenerator.generate(close.asFrame()); ByteBuffer expected = ByteBuffer.allocate(132); - byte messageBytes[] = message.toString().getBytes(StandardCharsets.UTF_8); + byte[] messageBytes = message.toString().getBytes(StandardCharsets.UTF_8); expected.put(new byte[] {(byte)0x88}); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/ExtensionTool.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/ExtensionTool.java index d6229db8c46..d497736f8ba 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/ExtensionTool.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/ExtensionTool.java @@ -80,7 +80,7 @@ public class ExtensionTool public void parseIncomingHex(String... rawhex) { int parts = rawhex.length; - byte net[]; + byte[] net; for (int i = 0; i < parts; i++) { @@ -92,7 +92,7 @@ public class ExtensionTool public void assertHasFrames(String... textFrames) { - Frame frames[] = new Frame[textFrames.length]; + Frame[] frames = new Frame[textFrames.length]; for (int i = 0; i < frames.length; i++) { frames[i] = new TextFrame().setPayload(textFrames[i]); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java index 02161c88d53..b634ec80c67 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/FragmentExtensionTest.java @@ -336,7 +336,7 @@ public class FragmentExtensionTest public void testLargeSmallTextAlternating() throws Exception { final int largeMessageSize = 60000; - byte buf[] = new byte[largeMessageSize]; + byte[] buf = new byte[largeMessageSize]; Arrays.fill(buf, (byte)'x'); String largeMessage = new String(buf, UTF_8); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java index 66bac1f4aec..e19e52f6664 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/ByteAccumulatorTest.java @@ -37,9 +37,9 @@ public class ByteAccumulatorTest { ByteAccumulator accumulator = new ByteAccumulator(10_000); - byte hello[] = "Hello".getBytes(UTF_8); - byte space[] = " ".getBytes(UTF_8); - byte world[] = "World".getBytes(UTF_8); + byte[] hello = "Hello".getBytes(UTF_8); + byte[] space = " ".getBytes(UTF_8); + byte[] world = "World".getBytes(UTF_8); accumulator.copyChunk(hello, 0, hello.length); accumulator.copyChunk(space, 0, space.length); @@ -58,9 +58,9 @@ public class ByteAccumulatorTest { ByteAccumulator accumulator = new ByteAccumulator(10_000); - byte hello[] = "Hello".getBytes(UTF_8); - byte space[] = " ".getBytes(UTF_8); - byte world[] = "World".getBytes(UTF_8); + byte[] hello = "Hello".getBytes(UTF_8); + byte[] space = " ".getBytes(UTF_8); + byte[] world = "World".getBytes(UTF_8); accumulator.copyChunk(hello, 0, hello.length); accumulator.copyChunk(space, 0, space.length); @@ -78,9 +78,9 @@ public class ByteAccumulatorTest public void testCopyChunk_NotEnoughSpace() { - byte hello[] = "Hello".getBytes(UTF_8); - byte space[] = " ".getBytes(UTF_8); - byte world[] = "World".getBytes(UTF_8); + byte[] hello = "Hello".getBytes(UTF_8); + byte[] space = " ".getBytes(UTF_8); + byte[] world = "World".getBytes(UTF_8); int length = hello.length + space.length + world.length; ByteAccumulator accumulator = new ByteAccumulator(length - 2); // intentionally too small of a max diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java index 55644a25e1c..8c392031194 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateFrameExtensionTest.java @@ -229,7 +229,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest public void testCompress_TimeTimeTime() { // What pywebsocket produces for "time:", "time:", "time:" - String expected[] = new String[] + String[] expected = new String[] {"2AC9CC4DB50200", "2A01110000", "02130000"}; // Lets see what we produce @@ -262,7 +262,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest // Text to compress String text = "info:"; - byte uncompressed[] = StringUtil.getUtf8Bytes(text); + byte[] uncompressed = StringUtil.getUtf8Bytes(text); // Prime the compressor compressor.reset(); @@ -275,7 +275,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest while (!compressor.finished()) { - byte out[] = new byte[64]; + byte[] out = new byte[64]; int len = compressor.deflate(out, 0, out.length, Deflater.SYNC_FLUSH); if (len > 0) { @@ -285,7 +285,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest compressor.end(); BufferUtil.flipToFlush(outbuf, 0); - byte compressed[] = BufferUtil.toArray(outbuf); + byte[] compressed = BufferUtil.toArray(outbuf); // Clear the BFINAL bit that has been set by the compressor.end() call. // In the real implementation we never end() the compressor. compressed[0] &= 0xFE; @@ -323,14 +323,14 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest public void testInflateBasics() throws Exception { // should result in "info:" text if properly inflated - byte rawbuf[] = TypeUtil.fromHexString("CaCc4bCbB70200"); // what pywebsocket produces - // byte rawbuf[] = TypeUtil.fromHexString("CbCc4bCbB70200"); // what java produces + byte[] rawbuf = TypeUtil.fromHexString("CaCc4bCbB70200"); // what pywebsocket produces + // byte[] rawbuf = TypeUtil.fromHexString("CbCc4bCbB70200"); // what java produces Inflater inflater = new Inflater(true); inflater.reset(); inflater.setInput(rawbuf, 0, rawbuf.length); - byte outbuf[] = new byte[64]; + byte[] outbuf = new byte[64]; int len = inflater.inflate(outbuf); inflater.end(); assertThat("Inflated length", len, greaterThan(4)); @@ -343,7 +343,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest public void testPyWebSocketServer_Hello() { // Captured from PyWebSocket - "Hello" (echo from server) - byte rawbuf[] = TypeUtil.fromHexString("c107f248cdc9c90700"); + byte[] rawbuf = TypeUtil.fromHexString("c107f248cdc9c90700"); assertIncoming(rawbuf, "Hello"); } @@ -351,7 +351,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest public void testPyWebSocketServer_Long() { // Captured from PyWebSocket - Long Text (echo from server) - byte rawbuf[] = TypeUtil.fromHexString("c1421cca410a80300c44d1abccce9df7" + "f018298634d05631138ab7b7b8fdef1f" + "dc0282e2061d575a45f6f2686bab25e1" + byte[] rawbuf = TypeUtil.fromHexString("c1421cca410a80300c44d1abccce9df7" + "f018298634d05631138ab7b7b8fdef1f" + "dc0282e2061d575a45f6f2686bab25e1" + "3fb7296fa02b5885eb3b0379c394f461" + "98cafd03"); assertIncoming(rawbuf, "It's a big enough umbrella but it's always me that ends up getting wet."); } @@ -360,7 +360,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest public void testPyWebSocketServer_Medium() { // Captured from PyWebSocket - "stackoverflow" (echo from server) - byte rawbuf[] = TypeUtil.fromHexString("c10f2a2e494ccece2f4b2d4acbc92f0700"); + byte[] rawbuf = TypeUtil.fromHexString("c10f2a2e494ccece2f4b2d4acbc92f0700"); assertIncoming(rawbuf, "stackoverflow"); } diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessorTest.java index 532ec5998ec..99d9e6d7ca8 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessorTest.java @@ -67,7 +67,7 @@ public class DeMaskProcessorTest final byte msgChar = '*'; final int messageSize = 25; - byte message[] = new byte[messageSize]; + byte[] message = new byte[messageSize]; Arrays.fill(message, msgChar); TextFrame frame = new TextFrame(); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java index f6641f18a87..a7cf1c6ae98 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java @@ -58,7 +58,7 @@ public class MessageInputStreamTest stream.appendFrame(payload, fin); // Read entire message it from the stream. - byte buf[] = new byte[32]; + byte[] buf = new byte[32]; int len = stream.read(buf); String message = new String(buf, 0, len, StandardCharsets.UTF_8); @@ -109,7 +109,7 @@ public class MessageInputStreamTest startLatch.await(); // Read it from the stream. - byte buf[] = new byte[32]; + byte[] buf = new byte[32]; int len = stream.read(buf); String message = new String(buf, 0, len, StandardCharsets.UTF_8); @@ -216,7 +216,7 @@ public class MessageInputStreamTest stream.appendFrame(msg3, true); // Read entire message it from the stream. - byte buf[] = new byte[32]; + byte[] buf = new byte[32]; int len = stream.read(buf); String message = new String(buf, 0, len, StandardCharsets.UTF_8); @@ -243,7 +243,7 @@ public class MessageInputStreamTest stream.appendFrame(msg3, true); // Read entire message it from the stream. - byte buf[] = new byte[32]; + byte[] buf = new byte[32]; int len = stream.read(buf); String message = new String(buf, 0, len, StandardCharsets.UTF_8); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageOutputStreamTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageOutputStreamTest.java index 2c69732ee42..f5484026c38 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageOutputStreamTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageOutputStreamTest.java @@ -123,7 +123,7 @@ public class MessageOutputStreamTest public void testWriteMultipleBuffers() throws Exception { int bufsize = (int)(policy.getMaxBinaryMessageBufferSize() * 2.5); - byte buf[] = new byte[bufsize]; + byte[] buf = new byte[bufsize]; LOG.debug("Buffer sizes: max:{}, test:{}", policy.getMaxBinaryMessageBufferSize(), bufsize); Arrays.fill(buf, (byte)'x'); buf[bufsize - 1] = (byte)'o'; // mark last entry for debugging diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java index 6a5a8fbb50e..d0c436e8d0c 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageWriterTest.java @@ -121,7 +121,7 @@ public class MessageWriterTest public void testWriteMultipleBuffers() throws Exception { int bufsize = (int)(policy.getMaxTextMessageBufferSize() * 2.5); - char buf[] = new char[bufsize]; + char[] buf = new char[bufsize]; if (LOG.isDebugEnabled()) LOG.debug("Buffer size: {}", bufsize); Arrays.fill(buf, 'x'); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java index a5fd30d2f0d..59caa83f04f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/Utf8CharBufferTest.java @@ -45,8 +45,8 @@ public class Utf8CharBufferTest ByteBuffer buf = ByteBuffer.allocate(128); Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf); - byte hellobytes[] = asUTF("Hello "); - byte worldbytes[] = asUTF("World!"); + byte[] hellobytes = asUTF("Hello "); + byte[] worldbytes = asUTF("World!"); utf.append(hellobytes, 0, hellobytes.length); ByteBuffer hellobuf = utf.getByteBuffer(); @@ -67,7 +67,7 @@ public class Utf8CharBufferTest int expectedSize = bufsize / 2; assertThat("Remaining (initial)", utf.remaining(), is(expectedSize)); - byte hellobytes[] = asUTF("Hello World"); + byte[] hellobytes = asUTF("Hello World"); utf.append(hellobytes, 0, hellobytes.length); ByteBuffer hellobuf = utf.getByteBuffer(); @@ -79,7 +79,7 @@ public class Utf8CharBufferTest assertThat("Remaining (after clear)", utf.remaining(), is(expectedSize)); - byte whatnowbytes[] = asUTF("What Now?"); + byte[] whatnowbytes = asUTF("What Now?"); utf.append(whatnowbytes, 0, whatnowbytes.length); ByteBuffer whatnowbuf = utf.getByteBuffer(); @@ -93,7 +93,7 @@ public class Utf8CharBufferTest ByteBuffer buf = ByteBuffer.allocate(64); Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf); - byte bb[] = asUTF("Hello A\u00ea\u00f1\u00fcC"); + byte[] bb = asUTF("Hello A\u00ea\u00f1\u00fcC"); utf.append(bb, 0, bb.length); ByteBuffer actual = utf.getByteBuffer(); @@ -111,7 +111,7 @@ public class Utf8CharBufferTest int expectedSize = bufsize / 2; assertThat("Remaining (initial)", utf.remaining(), is(expectedSize)); - byte bb[] = asUTF("Hello World"); + byte[] bb = asUTF("Hello World"); utf.append(bb, 0, bb.length); expectedSize -= bb.length; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/BlockheadClientConnection.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/BlockheadClientConnection.java index 7d6ef2df439..cb9f75b99c4 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/BlockheadClientConnection.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/BlockheadClientConnection.java @@ -45,7 +45,7 @@ public class BlockheadClientConnection extends BlockheadConnection { if (frame.getMask() == null) { - byte mask[] = new byte[4]; + byte[] mask = new byte[4]; ThreadLocalRandom.current().nextBytes(mask); frame.setMask(mask); } diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/ByteBufferAssert.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/ByteBufferAssert.java index 5fb4e03a2c1..5d72c437fa9 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/ByteBufferAssert.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/ByteBufferAssert.java @@ -54,8 +54,8 @@ public class ByteBufferAssert } else { - byte expectedBytes[] = BufferUtil.toArray(expectedBuffer); - byte actualBytes[] = BufferUtil.toArray(actualBuffer); + byte[] expectedBytes = BufferUtil.toArray(expectedBuffer); + byte[] actualBytes = BufferUtil.toArray(actualBuffer); assertEquals(message, expectedBytes, actualBytes); } } diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/RawFrameBuilder.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/RawFrameBuilder.java index fbdde6df3c9..ac1df8e8c51 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/RawFrameBuilder.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/RawFrameBuilder.java @@ -54,7 +54,7 @@ public class RawFrameBuilder { assertThat("Mask.length", mask.length, is(4)); int len = data.length; - byte ret[] = new byte[len]; + byte[] ret = new byte[len]; System.arraycopy(data, 0, ret, 0, len); for (int i = 0; i < len; i++) { diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitParser.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitParser.java index 4372292a887..2d7a33f6901 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitParser.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/test/UnitParser.java @@ -41,7 +41,7 @@ public class UnitParser extends Parser private void parsePartial(ByteBuffer buf, int numBytes) { int len = Math.min(numBytes, buf.remaining()); - byte arr[] = new byte[len]; + byte[] arr = new byte[len]; buf.get(arr, 0, len); this.parse(ByteBuffer.wrap(arr)); } diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Hex.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Hex.java index e81fcecd5d4..706272e4a82 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Hex.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/util/Hex.java @@ -37,7 +37,7 @@ public final class Hex } int size = hstr.length() / 2; - byte buf[] = new byte[size]; + byte[] buf = new byte[size]; byte hex; int len = hstr.length(); @@ -67,7 +67,7 @@ public final class Hex public static String asHex(byte buf[]) { int len = buf.length; - char out[] = new char[len * 2]; + char[] out = new char[len * 2]; for (int i = 0; i < len; i++) { out[i * 2] = hexcodes[(buf[i] & 0xF0) >> 4]; diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/AnnotatedMaxMessageSizeTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/AnnotatedMaxMessageSizeTest.java index bfb0a8f0d19..22ae0c1737e 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/AnnotatedMaxMessageSizeTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/AnnotatedMaxMessageSizeTest.java @@ -141,7 +141,7 @@ public class AnnotatedMaxMessageSizeTest { // Generate text frame int size = 120 * 1024; - byte buf[] = new byte[size]; // buffer bigger than maxMessageSize + byte[] buf = new byte[size]; // buffer bigger than maxMessageSize Arrays.fill(buf, (byte)'x'); clientConn.write(new TextFrame().setPayload(ByteBuffer.wrap(buf))); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java index fb7573140f7..4146997aa39 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/FragmentExtensionTest.java @@ -77,7 +77,7 @@ public class FragmentExtensionTest { int strLength = str.length(); int count = (int)Math.ceil((double)str.length() / partSize); - String ret[] = new String[count]; + String[] ret = new String[count]; int idx; for (int i = 0; i < count; i++) { @@ -116,7 +116,7 @@ public class FragmentExtensionTest String msg = "Sent as a long message that should be split"; clientConn.write(new TextFrame().setPayload(msg)); - String parts[] = split(msg, fragSize); + String[] parts = split(msg, fragSize); LinkedBlockingQueue frames = clientConn.getFrameQueue(); for (int i = 0; i < parts.length; i++) { diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/PerMessageDeflateExtensionTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/PerMessageDeflateExtensionTest.java index a41a13058cc..e43ff6a3702 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/PerMessageDeflateExtensionTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/PerMessageDeflateExtensionTest.java @@ -134,7 +134,7 @@ public class PerMessageDeflateExtensionTest assertThat("Response.extensions", getNegotiatedExtensionList(session), containsString("permessage-deflate")); // Create message - byte msg[] = new byte[scenario.msgSize.size]; + byte[] msg = new byte[scenario.msgSize.size]; Random rand = new Random(); rand.setSeed(8080); rand.nextBytes(msg); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/TooFastClientTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/TooFastClientTest.java index c867eb103b8..4077e0f27c8 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/TooFastClientTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/TooFastClientTest.java @@ -93,7 +93,7 @@ public class TooFastClientTest for (String msg : msgs) { TextFrame frame = new TextFrame().setPayload(msg); - byte mask[] = new byte[]{0x11, 0x22, 0x33, 0x44}; + byte[] mask = new byte[]{0x11, 0x22, 0x33, 0x44}; frame.setMask(mask); generator.generateWholeFrame(frame, initialPacket); } @@ -139,7 +139,7 @@ public class TooFastClientTest { BlockheadClientRequest request = client.newWsRequest(server.getServerUri()); - byte bigMsgBytes[] = new byte[64 * 1024]; + byte[] bigMsgBytes = new byte[64 * 1024]; Arrays.fill(bigMsgBytes, (byte)'x'); String bigMsg = new String(bigMsgBytes, StandardCharsets.UTF_8); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketServletRFCTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketServletRFCTest.java index 15fe8568a65..62b53aa2c68 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketServletRFCTest.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketServletRFCTest.java @@ -169,7 +169,7 @@ public class WebSocketServletRFCTest @Test public void testDetectBadUTF8() { - byte buf[] = new byte[] + byte[] buf = new byte[] {(byte)0xC2, (byte)0xC3}; Utf8StringBuilder utf = new Utf8StringBuilder(); @@ -275,7 +275,7 @@ public class WebSocketServletRFCTest try (BlockheadConnection clientConn = connFut.get(Timeouts.CONNECT, Timeouts.CONNECT_UNIT); StacklessLogging ignore = new StacklessLogging(Parser.class)) { - byte buf[] = new byte[] + byte[] buf = new byte[] {(byte)0xC2, (byte)0xC3}; WebSocketFrame txt = new TextFrame().setPayload(ByteBuffer.wrap(buf)); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java index ccd41b6dd56..b9ad7230aab 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase1.java @@ -67,7 +67,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_2() throws Exception { - byte payload[] = new byte[125]; + byte[] payload = new byte[125]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -96,7 +96,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_3() throws Exception { - byte payload[] = new byte[126]; + byte[] payload = new byte[126]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -125,7 +125,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_4() throws Exception { - byte payload[] = new byte[127]; + byte[] payload = new byte[127]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -154,7 +154,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_5() throws Exception { - byte payload[] = new byte[128]; + byte[] payload = new byte[128]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -183,7 +183,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_6() throws Exception { - byte payload[] = new byte[65535]; + byte[] payload = new byte[65535]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -212,7 +212,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_7() throws Exception { - byte payload[] = new byte[65536]; + byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -245,7 +245,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_1_8() throws Exception { - byte payload[] = new byte[65536]; + byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(payload); int segmentSize = 997; @@ -301,7 +301,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_2() throws Exception { - byte payload[] = new byte[125]; + byte[] payload = new byte[125]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -330,7 +330,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_3() throws Exception { - byte payload[] = new byte[126]; + byte[] payload = new byte[126]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -359,7 +359,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_4() throws Exception { - byte payload[] = new byte[127]; + byte[] payload = new byte[127]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -388,7 +388,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_5() throws Exception { - byte payload[] = new byte[128]; + byte[] payload = new byte[128]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -417,7 +417,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_6() throws Exception { - byte payload[] = new byte[65535]; + byte[] payload = new byte[65535]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -446,7 +446,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_7() throws Exception { - byte payload[] = new byte[65536]; + byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -479,7 +479,7 @@ public class TestABCase1 extends AbstractABCase @Test public void testCase1_2_8() throws Exception { - byte payload[] = new byte[65536]; + byte[] payload = new byte[65536]; Arrays.fill(payload, (byte)0xFE); ByteBuffer buf = ByteBuffer.wrap(payload); int segmentSize = 997; diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java index 2b947b88f02..f11860d3648 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase2.java @@ -139,7 +139,7 @@ public class TestABCase2 extends AbstractABCase @Test public void testCase2_2() throws Exception { - byte payload[] = StringUtil.getUtf8Bytes("Hello world"); + byte[] payload = StringUtil.getUtf8Bytes("Hello world"); List send = new ArrayList<>(); send.add(new PingFrame().setPayload(payload)); @@ -166,7 +166,7 @@ public class TestABCase2 extends AbstractABCase @Test public void testCase2_3() throws Exception { - byte payload[] = new byte[]{0x00, (byte)0xFF, (byte)0xFE, (byte)0xFD, (byte)0xFC, (byte)0xFB, 0x00, (byte)0xFF}; + byte[] payload = new byte[]{0x00, (byte)0xFF, (byte)0xFE, (byte)0xFD, (byte)0xFC, (byte)0xFB, 0x00, (byte)0xFF}; List send = new ArrayList<>(); send.add(new PingFrame().setPayload(payload)); @@ -193,7 +193,7 @@ public class TestABCase2 extends AbstractABCase @Test public void testCase2_4() throws Exception { - byte payload[] = new byte[125]; + byte[] payload = new byte[125]; Arrays.fill(payload, (byte)0xFE); List send = new ArrayList<>(); @@ -223,7 +223,7 @@ public class TestABCase2 extends AbstractABCase { try (StacklessLogging scope = new StacklessLogging(Parser.class)) { - byte payload[] = new byte[126]; // intentionally too big + byte[] payload = new byte[126]; // intentionally too big Arrays.fill(payload, (byte)'5'); ByteBuffer buf = ByteBuffer.wrap(payload); @@ -253,7 +253,7 @@ public class TestABCase2 extends AbstractABCase @Test public void testCase2_6() throws Exception { - byte payload[] = new byte[125]; + byte[] payload = new byte[125]; Arrays.fill(payload, (byte)'6'); List send = new ArrayList<>(); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java index 5bd51732f25..0e030a124b2 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase3.java @@ -150,7 +150,7 @@ public class TestABCase3 extends AbstractABCase @Test public void testCase3_5() throws Exception { - byte payload[] = new byte[8]; + byte[] payload = new byte[8]; Arrays.fill(payload, (byte)0xFF); List send = new ArrayList<>(); @@ -177,7 +177,7 @@ public class TestABCase3 extends AbstractABCase @Test public void testCase3_6() throws Exception { - byte payload[] = new byte[8]; + byte[] payload = new byte[8]; Arrays.fill(payload, (byte)0xFF); List send = new ArrayList<>(); @@ -204,7 +204,7 @@ public class TestABCase3 extends AbstractABCase @Test public void testCase3_7() throws Exception { - byte payload[] = new byte[8]; + byte[] payload = new byte[8]; Arrays.fill(payload, (byte)0xFF); List send = new ArrayList<>(); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java index 200c55f1f76..a991acd8733 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase4.java @@ -70,7 +70,7 @@ public class TestABCase4 extends AbstractABCase @Test public void testCase4_1_2() throws Exception { - byte payload[] = StringUtil.getUtf8Bytes("reserved payload"); + byte[] payload = StringUtil.getUtf8Bytes("reserved payload"); ByteBuffer buf = ByteBuffer.wrap(payload); List send = new ArrayList<>(); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java index 547164c22c3..4f6d2ecd930 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase6.java @@ -52,7 +52,7 @@ public class TestABCase6 extends AbstractABCase { int len = msg.length; boolean continuation = false; - byte mini[]; + byte[] mini; for (int i = 0; i < len; i++) { DataFrame frame = null; @@ -198,7 +198,7 @@ public class TestABCase6 extends AbstractABCase public void testCase6_2_3() throws Exception { String utf8 = "Hello-\uC2B5@\uC39F\uC3A4\uC3BC\uC3A0\uC3A1-UTF-8!!"; - byte msg[] = StringUtil.getUtf8Bytes(utf8); + byte[] msg = StringUtil.getUtf8Bytes(utf8); List send = new ArrayList<>(); fragmentText(send, msg); @@ -225,7 +225,7 @@ public class TestABCase6 extends AbstractABCase @Test public void testCase6_2_4() throws Exception { - byte msg[] = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5"); + byte[] msg = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5"); List send = new ArrayList<>(); fragmentText(send, msg); @@ -252,7 +252,7 @@ public class TestABCase6 extends AbstractABCase @Test public void testCase6_3_2() throws Exception { - byte invalid[] = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5EDA080656469746564"); + byte[] invalid = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5EDA080656469746564"); List send = new ArrayList<>(); fragmentText(send, invalid); @@ -379,7 +379,7 @@ public class TestABCase6 extends AbstractABCase ByteBuffer net = fuzzer.asNetworkBuffer(send); - int splits[] = {17, 21, net.limit()}; + int[] splits = {17, 21, net.limit()}; ByteBuffer part1 = net.slice(); // Header + good UTF part1.limit(splits[0]); @@ -407,7 +407,7 @@ public class TestABCase6 extends AbstractABCase @Test public void testCase6_4_4() throws Exception { - byte invalid[] = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5F49080808080656469746564"); + byte[] invalid = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5F49080808080656469746564"); List send = new ArrayList<>(); send.add(new TextFrame().setPayload(ByteBuffer.wrap(invalid))); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java index 97d9bf2ff13..cba5f8a066d 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase7.java @@ -179,7 +179,7 @@ public class TestABCase7 extends AbstractABCase @Test public void testCase7_1_6() throws Exception { - byte msg[] = new byte[256 * 1024]; + byte[] msg = new byte[256 * 1024]; Arrays.fill(msg, (byte)'*'); ByteBuffer buf = ByteBuffer.wrap(msg); @@ -234,7 +234,7 @@ public class TestABCase7 extends AbstractABCase @Test public void testCase7_3_2() throws Exception { - byte payload[] = new byte[]{0x00}; + byte[] payload = new byte[]{0x00}; ByteBuffer buf = ByteBuffer.wrap(payload); List send = new ArrayList<>(); @@ -310,7 +310,7 @@ public class TestABCase7 extends AbstractABCase @Test public void testCase7_3_5() throws Exception { - byte utf[] = new byte[123]; + byte[] utf = new byte[123]; Arrays.fill(utf, (byte)'!'); String reason = StringUtil.toUTF8String(utf, 0, utf.length); @@ -343,7 +343,7 @@ public class TestABCase7 extends AbstractABCase BufferUtil.clearToFill(payload); payload.put((byte)0x03); // normal close payload.put((byte)0xE8); - byte invalidUtf[] = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5EDA080656469746564"); + byte[] invalidUtf = Hex.asByteArray("CEBAE1BDB9CF83CEBCCEB5EDA080656469746564"); payload.put(invalidUtf); BufferUtil.flipToFlush(payload, 0); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java index 3ec43cedfd1..90f7cf7e0e8 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/ab/TestABCase9.java @@ -62,11 +62,11 @@ public class TestABCase9 extends AbstractABCase private void assertMultiFrameEcho(byte opcode, int overallMsgSize, int fragmentSize) throws Exception { - byte msg[] = new byte[overallMsgSize]; + byte[] msg = new byte[overallMsgSize]; Arrays.fill(msg, (byte)'M'); List send = new ArrayList<>(); - byte frag[]; + byte[] frag; int remaining = msg.length; int offset = 0; boolean fin; @@ -103,7 +103,7 @@ public class TestABCase9 extends AbstractABCase private void assertSlowFrameEcho(byte opcode, int overallMsgSize, int segmentSize) throws Exception { - byte msg[] = new byte[overallMsgSize]; + byte[] msg = new byte[overallMsgSize]; Arrays.fill(msg, (byte)'M'); ByteBuffer buf = ByteBuffer.wrap(msg); @@ -133,7 +133,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_1_1() throws Exception { - byte utf[] = new byte[64 * KBYTE]; + byte[] utf = new byte[64 * KBYTE]; Arrays.fill(utf, (byte)'y'); String msg = StringUtil.toUTF8String(utf, 0, utf.length); @@ -162,7 +162,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_1_2() throws Exception { - byte utf[] = new byte[256 * KBYTE]; + byte[] utf = new byte[256 * KBYTE]; Arrays.fill(utf, (byte)'y'); ByteBuffer buf = ByteBuffer.wrap(utf); @@ -191,7 +191,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_1_3() throws Exception { - byte utf[] = new byte[1 * MBYTE]; + byte[] utf = new byte[1 * MBYTE]; Arrays.fill(utf, (byte)'y'); ByteBuffer buf = ByteBuffer.wrap(utf); @@ -220,7 +220,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_1_4() throws Exception { - byte utf[] = new byte[4 * MBYTE]; + byte[] utf = new byte[4 * MBYTE]; Arrays.fill(utf, (byte)'y'); ByteBuffer buf = ByteBuffer.wrap(utf); @@ -249,7 +249,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_1_5() throws Exception { - byte utf[] = new byte[8 * MBYTE]; + byte[] utf = new byte[8 * MBYTE]; Arrays.fill(utf, (byte)'y'); ByteBuffer buf = ByteBuffer.wrap(utf); @@ -278,7 +278,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_1_6() throws Exception { - byte utf[] = new byte[16 * MBYTE]; + byte[] utf = new byte[16 * MBYTE]; Arrays.fill(utf, (byte)'y'); ByteBuffer buf = ByteBuffer.wrap(utf); @@ -307,7 +307,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_2_1() throws Exception { - byte data[] = new byte[64 * KBYTE]; + byte[] data = new byte[64 * KBYTE]; Arrays.fill(data, (byte)0x21); List send = new ArrayList<>(); @@ -335,7 +335,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_2_2() throws Exception { - byte data[] = new byte[256 * KBYTE]; + byte[] data = new byte[256 * KBYTE]; Arrays.fill(data, (byte)0x22); ByteBuffer buf = ByteBuffer.wrap(data); @@ -364,7 +364,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_2_3() throws Exception { - byte data[] = new byte[1 * MBYTE]; + byte[] data = new byte[1 * MBYTE]; Arrays.fill(data, (byte)0x23); ByteBuffer buf = ByteBuffer.wrap(data); @@ -393,7 +393,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_2_4() throws Exception { - byte data[] = new byte[4 * MBYTE]; + byte[] data = new byte[4 * MBYTE]; Arrays.fill(data, (byte)0x24); ByteBuffer buf = ByteBuffer.wrap(data); @@ -422,7 +422,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_2_5() throws Exception { - byte data[] = new byte[8 * MBYTE]; + byte[] data = new byte[8 * MBYTE]; Arrays.fill(data, (byte)0x25); ByteBuffer buf = ByteBuffer.wrap(data); @@ -451,7 +451,7 @@ public class TestABCase9 extends AbstractABCase @Test public void testCase9_2_6() throws Exception { - byte data[] = new byte[16 * MBYTE]; + byte[] data = new byte[16 * MBYTE]; Arrays.fill(data, (byte)0x26); ByteBuffer buf = ByteBuffer.wrap(data); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java index 22fe1328c85..f2644e69f58 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java @@ -60,9 +60,9 @@ public class BrowserSocket @Override public void run() { - char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); + char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); int lettersLen = letters.length; - char randomText[] = new char[size]; + char[] randomText = new char[size]; Random rand = new Random(42); String msg; @@ -189,7 +189,7 @@ public class BrowserSocket } case "many": { - String parts[] = val.split(","); + String[] parts = val.split(","); int size = Integer.parseInt(parts[0]); int count = Integer.parseInt(parts[1]); @@ -198,12 +198,12 @@ public class BrowserSocket } case "manythreads": { - String parts[] = val.split(","); + String[] parts = val.split(","); int threadCount = Integer.parseInt(parts[0]); int size = Integer.parseInt(parts[1]); int count = Integer.parseInt(parts[2]); - Thread threads[] = new Thread[threadCount]; + Thread[] threads = new Thread[threadCount]; // Setup threads for (int n = 0; n < threadCount; n++) @@ -246,9 +246,9 @@ public class BrowserSocket private void writeManyAsync(int size, int count) { - char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); + char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray(); int lettersLen = letters.length; - char randomText[] = new char[size]; + char[] randomText = new char[size]; Random rand = new Random(42); for (int n = 0; n < count; n++) diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java index 242de65df3d..9c03d424f89 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/helper/SafariD00.java @@ -92,9 +92,9 @@ public class SafariD00 // System.out.printf("--- Request ---%n%s",req); - byte reqBytes[] = req.toString().getBytes(StandardCharsets.UTF_8); - byte hixieBytes[] = TypeUtil.fromHexString("e739617916c9daf3"); - byte buf[] = new byte[reqBytes.length + hixieBytes.length]; + byte[] reqBytes = req.toString().getBytes(StandardCharsets.UTF_8); + byte[] hixieBytes = TypeUtil.fromHexString("e739617916c9daf3"); + byte[] buf = new byte[reqBytes.length + hixieBytes.length]; System.arraycopy(reqBytes, 0, buf, 0, reqBytes.length); System.arraycopy(hixieBytes, 0, buf, reqBytes.length, hixieBytes.length); @@ -122,8 +122,8 @@ public class SafariD00 } // Read expected handshake hixie bytes - byte hixieHandshakeExpected[] = TypeUtil.fromHexString("c7438d956cf611a6af70603e6fa54809"); - byte hixieHandshake[] = new byte[hixieHandshakeExpected.length]; + byte[] hixieHandshakeExpected = TypeUtil.fromHexString("c7438d956cf611a6af70603e6fa54809"); + byte[] hixieHandshake = new byte[hixieHandshakeExpected.length]; int readLen = in.read(hixieHandshake, 0, hixieHandshake.length); assertThat("Read hixie handshake bytes", readLen, is(hixieHandshake.length)); diff --git a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java index d0316eeaf55..edccbdaa02f 100644 --- a/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java +++ b/jetty-xml/src/test/java/org/eclipse/jetty/xml/XmlConfigurationTest.java @@ -1004,7 +1004,7 @@ public class XmlConfigurationTest @Test public void testJettyStandardIdsAndProperties_JettyHome_JettyBase() throws Exception { - String propNames[] = new String[] + String[] propNames = new String[] { "jetty.base", "jetty.home" @@ -1033,7 +1033,7 @@ public class XmlConfigurationTest @Test public void testJettyStandardIdsAndProperties_JettyHomeUri_JettyBaseUri() throws Exception { - String propNames[] = new String[] + String[] propNames = new String[] { "jetty.base.uri", "jetty.home.uri" diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java index 19717ad431d..b8d0868d2c7 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/rfcs/RFC2616BaseTest.java @@ -1534,12 +1534,12 @@ public abstract class RFC2616BaseTest // Collect 'boundary' string String boundary = null; - String parts[] = StringUtil.split(contentType, ';'); + String[] parts = StringUtil.split(contentType, ';'); for (int i = 0; i < parts.length; i++) { if (parts[i].trim().startsWith("boundary=")) { - String boundparts[] = StringUtil.split(parts[i], '='); + String[] boundparts = StringUtil.split(parts[i], '='); assertEquals(2, boundparts.length, specId + " Boundary parts.length"); boundary = boundparts[1]; } diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java index 6f8fdc46815..c0ac9cdff42 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/JettyDistro.java @@ -300,7 +300,7 @@ public class JettyDistro // The actual jetty-distribution-${version} directory is under this directory. // Lets find it. - File subdirs[] = distroUnpackDir.listFiles(path -> + File[] subdirs = distroUnpackDir.listFiles(path -> { if (!path.isDirectory()) { @@ -753,7 +753,7 @@ public class JettyDistro private String getJavaBin() { - String javaexes[] = new String[] + String[] javaexes = new String[] {"java", "java.exe"}; File javaHomeDir = new File(System.getProperty("java.home")); diff --git a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java index 181b52f7272..2211e0e6ba7 100644 --- a/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java +++ b/tests/test-integration/src/test/java/org/eclipse/jetty/test/support/StringUtil.java @@ -74,7 +74,7 @@ public class StringUtil return new String[]{}; // empty array } - String ret[]; + String[] ret; int count = 0; int offset = 0;