Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2019-07-03 16:53:00 +02:00
commit 5568f833e7
34 changed files with 112 additions and 112 deletions

View File

@ -88,7 +88,7 @@ public class GlobalWebappConfigBindingTest
WebAppContext context = contexts.get(0); WebAppContext context = contexts.get(0);
assertNotNull(context, "Context should not be null"); assertNotNull(context, "Context should not be null");
String currentClasses[] = context.getServerClasses(); String[] currentClasses = context.getServerClasses();
String addedClass = "org.eclipse.foo."; // What was added by the binding String addedClass = "org.eclipse.foo."; // What was added by the binding
assertThat("Current Server Classes", addedClass, is(in(currentClasses))); assertThat("Current Server Classes", addedClass, is(in(currentClasses)));

View File

@ -310,7 +310,7 @@ public class XmlConfiguredJetty
{ {
List<WebAppContext> contexts = new ArrayList<>(); List<WebAppContext> contexts = new ArrayList<>();
HandlerCollection handlers = (HandlerCollection)_server.getHandler(); HandlerCollection handlers = (HandlerCollection)_server.getHandler();
Handler children[] = handlers.getChildHandlers(); Handler[] children = handlers.getChildHandlers();
for (Handler handler : children) for (Handler handler : children)
{ {
@ -397,7 +397,7 @@ public class XmlConfiguredJetty
// Find the active server port. // Find the active server port.
_serverPort = -1; _serverPort = -1;
Connector connectors[] = _server.getConnectors(); Connector[] connectors = _server.getConnectors();
for (int i = 0; _serverPort < 0 && i < connectors.length; i++) for (int i = 0; _serverPort < 0 && i < connectors.length; i++)
{ {
if (connectors[i] instanceof NetworkConnector) if (connectors[i] instanceof NetworkConnector)

View File

@ -90,7 +90,7 @@ public class HttpCookieTest
httpCookie = new HttpCookie("everything", "value", "domain", "path", 0, true, true, null, -1); 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()); 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\"",
"name\t", "name\t",
"na me", "na me",
@ -118,7 +118,7 @@ public class HttpCookieTest
} }
} }
String badValueExamples[] = { String[] badValueExamples = {
"va\tlue", "va\tlue",
"\t", "\t",
"value\u0000", "value\u0000",
@ -147,7 +147,7 @@ public class HttpCookieTest
} }
} }
String goodNameExamples[] = { String[] goodNameExamples = {
"name", "name",
"n.a.m.e", "n.a.m.e",
"na-me", "na-me",
@ -163,7 +163,7 @@ public class HttpCookieTest
// should not throw an exception // should not throw an exception
} }
String goodValueExamples[] = { String[] goodValueExamples = {
"value", "value",
"", "",
null, null,

View File

@ -217,7 +217,7 @@ public class MultiPartCaptureTest
continue; continue;
} }
String split[] = line.split("\\|"); String[] split = line.split("\\|");
switch (split[0]) switch (split[0])
{ {
case "Request-Header": case "Request-Header":

View File

@ -30,7 +30,7 @@ public class SyntaxTest
@Test @Test
public void testRequireValidRFC2616Token_Good() public void testRequireValidRFC2616Token_Good()
{ {
String tokens[] = { String[] tokens = {
"name", "name",
"", "",
null, null,
@ -52,7 +52,7 @@ public class SyntaxTest
@Test @Test
public void testRequireValidRFC2616Token_Bad() public void testRequireValidRFC2616Token_Bad()
{ {
String tokens[] = { String[] tokens = {
"\"name\"", "\"name\"",
"name\t", "name\t",
"na me", "na me",
@ -83,7 +83,7 @@ public class SyntaxTest
@Test @Test
public void testRequireValidRFC6265CookieValue_Good() public void testRequireValidRFC6265CookieValue_Good()
{ {
String values[] = { String[] values = {
"value", "value",
"", "",
null, null,
@ -104,7 +104,7 @@ public class SyntaxTest
@Test @Test
public void testRequireValidRFC6265CookieValue_Bad() public void testRequireValidRFC6265CookieValue_Bad()
{ {
String values[] = { String[] values = {
"va\tlue", "va\tlue",
"\t", "\t",
"value\u0000", "value\u0000",

View File

@ -33,7 +33,7 @@ public class UriTemplatePathSpecBadSpecsTest
{ {
public static Stream<Arguments> data() public static Stream<Arguments> data()
{ {
String badSpecs[] = new String[]{ String[] badSpecs = new String[]{
"/a/b{var}", // bad syntax - variable does not encompass whole path segment "/a/b{var}", // bad syntax - variable does not encompass whole path segment
"a/{var}", // bad syntax - no start slash "a/{var}", // bad syntax - no start slash
"/a/{var/b}", // path segment separator in variable name "/a/{var/b}", // path segment separator in variable name

View File

@ -1652,7 +1652,7 @@ public class ConstraintTest
private static String authBase64(String authorization) 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); return Base64.getEncoder().encodeToString(raw);
} }

View File

@ -248,7 +248,7 @@ public class HttpConnectionTest
StringBuilder request = new StringBuilder(); StringBuilder request = new StringBuilder();
request.append("POST /?id=").append(Integer.toString(x)).append(" HTTP/1.1\r\n"); request.append("POST /?id=").append(Integer.toString(x)).append(" HTTP/1.1\r\n");
request.append("Host: local\r\n"); request.append("Host: local\r\n");
int clen[] = contentLengths[x]; int[] clen = contentLengths[x];
for (int n = 0; n < clen.length; n++) for (int n = 0; n < clen.length; n++)
{ {
request.append("Content-Length: ").append(Integer.toString(clen[n])).append("\r\n"); request.append("Content-Length: ").append(Integer.toString(clen[n])).append("\r\n");
@ -282,7 +282,7 @@ public class HttpConnectionTest
StringBuilder request = new StringBuilder(); StringBuilder request = new StringBuilder();
request.append("POST /?id=").append(Integer.toString(x)).append(" HTTP/1.1\r\n"); request.append("POST /?id=").append(Integer.toString(x)).append(" HTTP/1.1\r\n");
request.append("Host: local\r\n"); request.append("Host: local\r\n");
int clen[] = contentLengths[x]; int[] clen = contentLengths[x];
for (int n = 0; n < clen.length; n++) for (int n = 0; n < clen.length; n++)
{ {
if (clen[n] == -1) if (clen[n] == -1)

View File

@ -442,7 +442,7 @@ public class HttpManyWaysToCommitTest extends AbstractHttpTest
HttpTester.Response response = executeRequest(httpVersion); HttpTester.Response response = executeRequest(httpVersion);
assertThat("response code", response.getStatus(), is(200)); assertThat("response code", response.getStatus(), is(200));
assertThat(response, containsHeaderValue("content-length", "6")); assertThat(response, containsHeaderValue("content-length", "6"));
byte content[] = response.getContentBytes(); byte[] content = response.getContentBytes();
assertThat("content bytes", content.length, is(0)); assertThat("content bytes", content.length, is(0));
assertTrue(response.isEarlyEOF(), "response eof"); assertTrue(response.isEarlyEOF(), "response eof");
} }

View File

@ -266,8 +266,8 @@ public class StressTest
// System.err.println(); // System.err.println();
final int quantums = 48; final int quantums = 48;
final int[][] count = new int[_latencies.length][quantums]; final int[][] count = new int[_latencies.length][quantums];
final int length[] = new int[_latencies.length]; final int[] length = new int[_latencies.length];
final int other[] = new int[_latencies.length]; final int[] other = new int[_latencies.length];
long total = 0; long total = 0;

View File

@ -55,7 +55,7 @@ public class AllowSymLinkAliasCheckerTest
{ {
List<Arguments> data = new ArrayList<>(); List<Arguments> data = new ArrayList<>();
String dirs[] = { String[] dirs = {
"/workDir/", "/testdirlnk/", "/testdirprefixlnk/", "/testdirsuffixlnk/", "/workDir/", "/testdirlnk/", "/testdirprefixlnk/", "/testdirsuffixlnk/",
"/testdirwraplnk/" "/testdirwraplnk/"
}; };

View File

@ -102,7 +102,7 @@ public class ResourceHandlerTest
try (BufferedReader reader = Files.newBufferedReader(big.toPath(), StandardCharsets.UTF_8)) try (BufferedReader reader = Files.newBufferedReader(big.toPath(), StandardCharsets.UTF_8))
{ {
// a buffer large enough to capture at least 1 EOL // a buffer large enough to capture at least 1 EOL
char cbuf[] = new char[128]; char[] cbuf = new char[128];
reader.read(cbuf); reader.read(cbuf);
String sample = new String(cbuf); String sample = new String(cbuf);
if (sample.contains("\r\n")) if (sample.contains("\r\n"))

View File

@ -100,7 +100,7 @@ public class SecuredRedirectHandlerTest
server.setConnectors(new Connector[]{httpConnector, httpsConnector}); server.setConnectors(new Connector[]{httpConnector, httpsConnector});
// Wire up contexts // Wire up contexts
String secureHosts[] = new String[]{"@secured"}; String[] secureHosts = new String[]{"@secured"};
ContextHandler test1Context = new ContextHandler(); ContextHandler test1Context = new ContextHandler();
test1Context.setContextPath("/test1"); test1Context.setContextPath("/test1");

View File

@ -82,7 +82,7 @@ public class StatisticsHandlerTest
@Test @Test
public void testRequest() throws Exception 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() _statsHandler.setHandler(new AbstractHandler()
{ {
@ -175,7 +175,7 @@ public class StatisticsHandlerTest
@Test @Test
public void testTwoRequests() throws Exception 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); _latchHandler.reset(2);
_statsHandler.setHandler(new AbstractHandler() _statsHandler.setHandler(new AbstractHandler()
{ {
@ -239,7 +239,7 @@ public class StatisticsHandlerTest
final long dispatchTime = 10; final long dispatchTime = 10;
final long requestTime = 50; final long requestTime = 50;
final AtomicReference<AsyncContext> asyncHolder = new AtomicReference<>(); final AtomicReference<AsyncContext> 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() _statsHandler.setHandler(new AbstractHandler()
{ {
@Override @Override
@ -369,7 +369,7 @@ public class StatisticsHandlerTest
final long dispatchTime = 10; final long dispatchTime = 10;
final long timeout = 100; final long timeout = 100;
final AtomicReference<AsyncContext> asyncHolder = new AtomicReference<>(); final AtomicReference<AsyncContext> 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() _statsHandler.setHandler(new AbstractHandler()
{ {
@Override @Override
@ -483,7 +483,7 @@ public class StatisticsHandlerTest
{ {
final long dispatchTime = 10; final long dispatchTime = 10;
final AtomicReference<AsyncContext> asyncHolder = new AtomicReference<>(); final AtomicReference<AsyncContext> 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); final CountDownLatch latch = new CountDownLatch(1);
_statsHandler.setHandler(new AbstractHandler() _statsHandler.setHandler(new AbstractHandler()

View File

@ -113,7 +113,7 @@ public class DefaultServletTest
connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false); connector.getConnectionFactory(HttpConfiguration.ConnectionFactory.class).getHttpConfiguration().setSendServerVersion(false);
File extraJarResources = MavenTestingUtils.getTestResourceFile(ODD_JAR); 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(); ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader();
URLClassLoader extraClassLoader = new URLClassLoader(urls, parentClassLoader); URLClassLoader extraClassLoader = new URLClassLoader(urls, parentClassLoader);

View File

@ -45,7 +45,7 @@ public class ModuleGraphWriterTest
// Test Env // Test Env
Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home"); Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home");
Path baseDir = testdir.getEmptyPathDir(); Path baseDir = testdir.getEmptyPathDir();
String cmdLine[] = new String[]{"jetty.version=TEST"}; String[] cmdLine = new String[]{"jetty.version=TEST"};
// Configuration // Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);

View File

@ -48,7 +48,7 @@ public class ModuleTest
// Test Env // Test Env
Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home"); Path homeDir = MavenTestingUtils.getTestResourcePathDir("dist-home");
Path baseDir = testdir.getEmptyPathDir(); Path baseDir = testdir.getEmptyPathDir();
String cmdLine[] = new String[]{"jetty.version=TEST"}; String[] cmdLine = new String[]{"jetty.version=TEST"};
// Configuration // Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);

View File

@ -50,7 +50,7 @@ public class ModulesTest
// Test Env // Test Env
File homeDir = MavenTestingUtils.getTestResourceDir("dist-home"); File homeDir = MavenTestingUtils.getTestResourceDir("dist-home");
File baseDir = testdir.getEmptyPathDir().toFile(); File baseDir = testdir.getEmptyPathDir().toFile();
String cmdLine[] = new String[]{"jetty.version=TEST"}; String[] cmdLine = new String[]{"jetty.version=TEST"};
// Configuration // Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);
@ -109,7 +109,7 @@ public class ModulesTest
// intentionally setup top level resources dir (as this would have many // intentionally setup top level resources dir (as this would have many
// deep references) // deep references)
File baseDir = MavenTestingUtils.getTestResourcesDir(); File baseDir = MavenTestingUtils.getTestResourcesDir();
String cmdLine[] = new String[]{"jetty.version=TEST"}; String[] cmdLine = new String[]{"jetty.version=TEST"};
// Configuration // Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);
@ -146,7 +146,7 @@ public class ModulesTest
// Test Env // Test Env
File homeDir = MavenTestingUtils.getTestResourceDir("dist-home"); File homeDir = MavenTestingUtils.getTestResourceDir("dist-home");
File baseDir = testdir.getEmptyPathDir().toFile(); File baseDir = testdir.getEmptyPathDir().toFile();
String cmdLine[] = new String[]{"jetty.version=TEST"}; String[] cmdLine = new String[]{"jetty.version=TEST"};
// Configuration // Configuration
CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine); CommandLineConfigSource cmdLineSource = new CommandLineConfigSource(cmdLine);

View File

@ -297,7 +297,7 @@ public class ConfigSourcesTest
ConfigSources sources = new ConfigSources(); ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[0]; String[] cmdLine = new String[0];
sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new CommandLineConfigSource(cmdLine));
sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyHomeConfigSource(home));
sources.add(new JettyBaseConfigSource(base)); sources.add(new JettyBaseConfigSource(base));
@ -337,7 +337,7 @@ public class ConfigSourcesTest
ConfigSources sources = new ConfigSources(); ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[0]; String[] cmdLine = new String[0];
sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new CommandLineConfigSource(cmdLine));
sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyHomeConfigSource(home));
sources.add(new JettyBaseConfigSource(base)); sources.add(new JettyBaseConfigSource(base));
@ -383,7 +383,7 @@ public class ConfigSourcesTest
ConfigSources sources = new ConfigSources(); ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[0]; String[] cmdLine = new String[0];
sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new CommandLineConfigSource(cmdLine));
sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyHomeConfigSource(home));
sources.add(new JettyBaseConfigSource(base)); sources.add(new JettyBaseConfigSource(base));
@ -431,7 +431,7 @@ public class ConfigSourcesTest
ConfigSources sources = new ConfigSources(); ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[0]; String[] cmdLine = new String[0];
sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new CommandLineConfigSource(cmdLine));
sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyHomeConfigSource(home));
sources.add(new JettyBaseConfigSource(base)); sources.add(new JettyBaseConfigSource(base));
@ -485,7 +485,7 @@ public class ConfigSourcesTest
ConfigSources sources = new ConfigSources(); ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[]{ String[] cmdLine = new String[]{
// command line provided include-jetty-dir ref // command line provided include-jetty-dir ref
"--include-jetty-dir=" + devops.toString() "--include-jetty-dir=" + devops.toString()
}; };
@ -536,7 +536,7 @@ public class ConfigSourcesTest
ConfigSources sources = new ConfigSources(); ConfigSources sources = new ConfigSources();
String cmdLine[] = new String[]{ String[] cmdLine = new String[]{
// command line property should override all others // command line property should override all others
"jetty.http.port=7070" "jetty.http.port=7070"
}; };
@ -594,7 +594,7 @@ public class ConfigSourcesTest
UsageException e = assertThrows(UsageException.class, () -> UsageException e = assertThrows(UsageException.class, () ->
{ {
String cmdLine[] = new String[0]; String[] cmdLine = new String[0];
sources.add(new CommandLineConfigSource(cmdLine)); sources.add(new CommandLineConfigSource(cmdLine));
sources.add(new JettyHomeConfigSource(home)); sources.add(new JettyHomeConfigSource(home));
sources.add(new JettyBaseConfigSource(base)); sources.add(new JettyBaseConfigSource(base));

View File

@ -167,7 +167,7 @@ public class CorrectMavenCentralRefs
String rawpath = line.substring(idx + keyword.length(), pipe); String rawpath = line.substring(idx + keyword.length(), pipe);
String destpath = line.substring(pipe + 1); String destpath = line.substring(pipe + 1);
String parts[] = rawpath.split("/"); String[] parts = rawpath.split("/");
int rev = parts.length; int rev = parts.length;
String filename = parts[--rev]; String filename = parts[--rev];

View File

@ -197,7 +197,7 @@ public class BufferUtilTest
@Test @Test
public void testToBuffer_Array() public void testToBuffer_Array()
{ {
byte arr[] = new byte[128]; byte[] arr = new byte[128];
Arrays.fill(arr, (byte)0x44); Arrays.fill(arr, (byte)0x44);
ByteBuffer buf = BufferUtil.toBuffer(arr); ByteBuffer buf = BufferUtil.toBuffer(arr);
@ -215,7 +215,7 @@ public class BufferUtilTest
@Test @Test
public void testToBuffer_ArrayOffsetLength() public void testToBuffer_ArrayOffsetLength()
{ {
byte arr[] = new byte[128]; byte[] arr = new byte[128];
Arrays.fill(arr, (byte)0xFF); // fill whole thing with FF Arrays.fill(arr, (byte)0xFF); // fill whole thing with FF
int offset = 10; int offset = 10;
int length = 100; int length = 100;

View File

@ -421,7 +421,7 @@ public class LazyListTest
@Test @Test
public void testAddArray_NullInput_NullArray() public void testAddArray_NullInput_NullArray()
{ {
String arr[] = null; String[] arr = null;
Object list = LazyList.addArray(null, arr); Object list = LazyList.addArray(null, arr);
assertNull(list); assertNull(list);
} }
@ -432,7 +432,7 @@ public class LazyListTest
@Test @Test
public void testAddArray_NullInput_EmptyArray() public void testAddArray_NullInput_EmptyArray()
{ {
String arr[] = new String[0]; String[] arr = new String[0];
Object list = LazyList.addArray(null, arr); Object list = LazyList.addArray(null, arr);
if (STRICT) if (STRICT)
{ {
@ -447,7 +447,7 @@ public class LazyListTest
@Test @Test
public void testAddArray_NullInput_SingleArray() public void testAddArray_NullInput_SingleArray()
{ {
String arr[] = new String[]{"a"}; String[] arr = new String[]{"a"};
Object list = LazyList.addArray(null, arr); Object list = LazyList.addArray(null, arr);
assertNotNull(list); assertNotNull(list);
if (STRICT) if (STRICT)
@ -464,7 +464,7 @@ public class LazyListTest
@Test @Test
public void testAddArray_NullInput_Array() 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); Object list = LazyList.addArray(null, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -481,7 +481,7 @@ public class LazyListTest
public void testAddArray_NonListInput_NullArray() public void testAddArray_NonListInput_NullArray()
{ {
String input = "z"; String input = "z";
String arr[] = null; String[] arr = null;
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
if (STRICT) if (STRICT)
@ -499,7 +499,7 @@ public class LazyListTest
public void testAddArray_NonListInput_EmptyArray() public void testAddArray_NonListInput_EmptyArray()
{ {
String input = "z"; String input = "z";
String arr[] = new String[0]; String[] arr = new String[0];
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
if (STRICT) if (STRICT)
@ -517,7 +517,7 @@ public class LazyListTest
public void testAddArray_NonListInput_SingleArray() public void testAddArray_NonListInput_SingleArray()
{ {
String input = "z"; String input = "z";
String arr[] = new String[]{"a"}; String[] arr = new String[]{"a"};
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -533,7 +533,7 @@ public class LazyListTest
public void testAddArray_NonListInput_Array() public void testAddArray_NonListInput_Array()
{ {
String input = "z"; String input = "z";
String arr[] = new String[]{"a", "b", "c"}; String[] arr = new String[]{"a", "b", "c"};
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -554,7 +554,7 @@ public class LazyListTest
input = LazyList.add(input, "y"); input = LazyList.add(input, "y");
input = LazyList.add(input, "z"); input = LazyList.add(input, "z");
String arr[] = null; String[] arr = null;
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -574,7 +574,7 @@ public class LazyListTest
input = LazyList.add(input, "y"); input = LazyList.add(input, "y");
input = LazyList.add(input, "z"); input = LazyList.add(input, "z");
String arr[] = new String[0]; String[] arr = new String[0];
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -594,7 +594,7 @@ public class LazyListTest
input = LazyList.add(input, "y"); input = LazyList.add(input, "y");
input = LazyList.add(input, "z"); input = LazyList.add(input, "z");
String arr[] = new String[]{"a"}; String[] arr = new String[]{"a"};
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -615,7 +615,7 @@ public class LazyListTest
input = LazyList.add(input, "y"); input = LazyList.add(input, "y");
input = LazyList.add(input, "z"); 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); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -639,7 +639,7 @@ public class LazyListTest
input.add("y"); input.add("y");
input.add("z"); input.add("z");
String arr[] = null; String[] arr = null;
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -660,7 +660,7 @@ public class LazyListTest
input.add("y"); input.add("y");
input.add("z"); input.add("z");
String arr[] = new String[0]; String[] arr = new String[0];
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -681,7 +681,7 @@ public class LazyListTest
input.add("y"); input.add("y");
input.add("z"); input.add("z");
String arr[] = new String[]{"a"}; String[] arr = new String[]{"a"};
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -703,7 +703,7 @@ public class LazyListTest
input.add("y"); input.add("y");
input.add("z"); input.add("z");
String arr[] = new String[]{"a", "b", "c"}; String[] arr = new String[]{"a", "b", "c"};
Object list = LazyList.addArray(input, arr); Object list = LazyList.addArray(input, arr);
assertNotNull(list); assertNotNull(list);
assertTrue(list instanceof List); assertTrue(list instanceof List);
@ -1285,7 +1285,7 @@ public class LazyListTest
assertTrue(arr.getClass().isArray()); assertTrue(arr.getClass().isArray());
assertTrue(arr instanceof String[]); assertTrue(arr instanceof String[]);
String strs[] = (String[])arr; String[] strs = (String[])arr;
assertEquals(1, strs.length); assertEquals(1, strs.length);
assertEquals("a", strs[0]); assertEquals("a", strs[0]);
} }
@ -1305,7 +1305,7 @@ public class LazyListTest
assertTrue(arr.getClass().isArray()); assertTrue(arr.getClass().isArray());
assertTrue(arr instanceof String[]); assertTrue(arr instanceof String[]);
String strs[] = (String[])arr; String[] strs = (String[])arr;
assertEquals(3, strs.length); assertEquals(3, strs.length);
assertEquals("a", strs[0]); assertEquals("a", strs[0]);
assertEquals("b", strs[1]); assertEquals("b", strs[1]);
@ -1328,7 +1328,7 @@ public class LazyListTest
assertTrue(arr.getClass().isArray()); assertTrue(arr.getClass().isArray());
assertTrue(arr instanceof int[]); assertTrue(arr instanceof int[]);
int nums[] = (int[])arr; int[] nums = (int[])arr;
assertEquals(4, nums.length); assertEquals(4, nums.length);
assertEquals(22, nums[0]); assertEquals(22, nums[0]);
assertEquals(333, nums[1]); assertEquals(333, nums[1]);
@ -1352,7 +1352,7 @@ public class LazyListTest
assertTrue(arr.getClass().isArray()); assertTrue(arr.getClass().isArray());
assertTrue(arr instanceof String[]); assertTrue(arr instanceof String[]);
String strs[] = (String[])arr; String[] strs = (String[])arr;
assertEquals(3, strs.length); assertEquals(3, strs.length);
assertEquals("a", strs[0]); assertEquals("a", strs[0]);
assertEquals("b", strs[1]); assertEquals("b", strs[1]);
@ -1832,7 +1832,7 @@ public class LazyListTest
@Test @Test
public void testArray2List_NullInput() public void testArray2List_NullInput()
{ {
Object input[] = null; Object[] input = null;
Object list = ArrayUtil.asMutableList(input); Object list = ArrayUtil.asMutableList(input);
assertNotNull(list); assertNotNull(list);
@ -1846,7 +1846,7 @@ public class LazyListTest
@Test @Test
public void testArray2List_EmptyInput() public void testArray2List_EmptyInput()
{ {
String input[] = new String[0]; String[] input = new String[0];
Object list = ArrayUtil.asMutableList(input); Object list = ArrayUtil.asMutableList(input);
assertNotNull(list); assertNotNull(list);
@ -1860,7 +1860,7 @@ public class LazyListTest
@Test @Test
public void testArray2List_SingleInput() public void testArray2List_SingleInput()
{ {
String input[] = new String[]{"a"}; String[] input = new String[]{"a"};
Object list = ArrayUtil.asMutableList(input); Object list = ArrayUtil.asMutableList(input);
assertNotNull(list); assertNotNull(list);
@ -1875,7 +1875,7 @@ public class LazyListTest
@Test @Test
public void testArray2List_MultiInput() public void testArray2List_MultiInput()
{ {
String input[] = new String[]{"a", "b", "c"}; String[] input = new String[]{"a", "b", "c"};
Object list = ArrayUtil.asMutableList(input); Object list = ArrayUtil.asMutableList(input);
assertNotNull(list); assertNotNull(list);
@ -1892,7 +1892,7 @@ public class LazyListTest
@Test @Test
public void testArray2List_GenericsInput() public void testArray2List_GenericsInput()
{ {
String input[] = new String[]{"a", "b", "c"}; String[] input = new String[]{"a", "b", "c"};
// Test the Generics definitions for array2List // Test the Generics definitions for array2List
List<String> list = ArrayUtil.asMutableList(input); List<String> list = ArrayUtil.asMutableList(input);
@ -1910,9 +1910,9 @@ public class LazyListTest
@Test @Test
public void testAddToArray_NullInput_NullItem() 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); assertNotNull(arr);
if (STRICT) if (STRICT)
{ {
@ -1935,9 +1935,9 @@ public class LazyListTest
assumeTrue(STRICT); assumeTrue(STRICT);
// Harsh test case. // 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); assertNotNull(arr);
if (STRICT) if (STRICT)
{ {
@ -1956,9 +1956,9 @@ public class LazyListTest
@Test @Test
public void testAddToArray_NullInput_SimpleItem() 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); assertNotNull(arr);
assertEquals(1, arr.length); assertEquals(1, arr.length);
assertEquals("a", arr[0]); assertEquals("a", arr[0]);
@ -1976,9 +1976,9 @@ public class LazyListTest
@Test @Test
public void testAddToArray_EmptyInput_NullItem() 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); assertNotNull(arr);
if (STRICT) if (STRICT)
{ {
@ -1997,9 +1997,9 @@ public class LazyListTest
@Test @Test
public void testAddToArray_EmptyInput_SimpleItem() 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); assertNotNull(arr);
assertEquals(1, arr.length); assertEquals(1, arr.length);
assertEquals("a", arr[0]); assertEquals("a", arr[0]);
@ -2011,9 +2011,9 @@ public class LazyListTest
@Test @Test
public void testAddToArray_SingleInput_NullItem() 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); assertNotNull(arr);
if (STRICT) if (STRICT)
{ {
@ -2034,9 +2034,9 @@ public class LazyListTest
@Test @Test
public void testAddToArray_SingleInput_SimpleItem() 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); assertNotNull(arr);
assertEquals(2, arr.length); assertEquals(2, arr.length);
assertEquals("z", arr[0]); assertEquals("z", arr[0]);
@ -2049,9 +2049,9 @@ public class LazyListTest
@Test @Test
public void testRemoveFromArray_NullInput_NullItem() 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); assertNull(arr);
} }
@ -2061,9 +2061,9 @@ public class LazyListTest
@Test @Test
public void testRemoveFromArray_NullInput_SimpleItem() 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); assertNull(arr);
} }
@ -2073,9 +2073,9 @@ public class LazyListTest
@Test @Test
public void testRemoveFromArray_EmptyInput_NullItem() 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"); assertNotNull(arr, "Should not be null");
assertEquals(0, arr.length); assertEquals(0, arr.length);
} }
@ -2086,9 +2086,9 @@ public class LazyListTest
@Test @Test
public void testRemoveFromArray_EmptyInput_SimpleItem() 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"); assertNotNull(arr, "Should not be null");
assertEquals(0, arr.length); assertEquals(0, arr.length);
} }
@ -2099,9 +2099,9 @@ public class LazyListTest
@Test @Test
public void testRemoveFromArray_SingleInput() 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"); assertNotNull(arr, "Should not be null");
assertEquals(1, arr.length); assertEquals(1, arr.length);
assertEquals("a", arr[0]); assertEquals("a", arr[0]);
@ -2118,9 +2118,9 @@ public class LazyListTest
@Test @Test
public void testRemoveFromArray_MultiInput() 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"); assertNotNull(arr, "Should not be null");
assertEquals(3, arr.length); assertEquals(3, arr.length);
assertEquals("a", arr[0]); assertEquals("a", arr[0]);

View File

@ -136,7 +136,7 @@ public class MultiMapTest
String key = "formats"; String key = "formats";
String input[] = {"gzip", "jar", "pack200"}; String[] input = {"gzip", "jar", "pack200"};
mm.putValues(key, input); mm.putValues(key, input);
assertMapSize(mm, 1); assertMapSize(mm, 1);
assertValues(mm, key, "gzip", "jar", "pack200"); assertValues(mm, key, "gzip", "jar", "pack200");
@ -245,7 +245,7 @@ public class MultiMapTest
assertValues(mm, key, "gzip"); assertValues(mm, key, "gzip");
// Add to the key // Add to the key
String extras[] = {"jar", "pack200", "zip"}; String[] extras = {"jar", "pack200", "zip"};
mm.addValues(key, extras); mm.addValues(key, extras);
assertMapSize(mm, 1); assertMapSize(mm, 1);
@ -268,7 +268,7 @@ public class MultiMapTest
assertValues(mm, key, "gzip"); assertValues(mm, key, "gzip");
// Add to the key // Add to the key
String extras[] = new String[0]; String[] extras = new String[0];
mm.addValues(key, extras); mm.addValues(key, extras);
assertMapSize(mm, 1); assertMapSize(mm, 1);

View File

@ -262,7 +262,7 @@ public class PathWatcherTest
// average chunk buffer // average chunk buffer
int chunkBufLen = 16; int chunkBufLen = 16;
byte chunkBuf[] = new byte[chunkBufLen]; byte[] chunkBuf = new byte[chunkBufLen];
Arrays.fill(chunkBuf, (byte)'x'); Arrays.fill(chunkBuf, (byte)'x');
long end = System.nanoTime() + timeUnit.toNanos(timeDuration); long end = System.nanoTime() + timeUnit.toNanos(timeDuration);

View File

@ -83,7 +83,7 @@ public class TrieTest
@MethodSource("implementations") @MethodSource("implementations")
public void testKeySet(Trie<Integer> trie) throws Exception public void testKeySet(Trie<Integer> trie) throws Exception
{ {
String values[] = new String[]{ String[] values = new String[]{
"hello", "hello",
"He", "He",
"HELL", "HELL",

View File

@ -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")); 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) // Test for null character (real world ugly test case)
byte oddBytes[] = {'/', 0x00, '/'}; byte[] oddBytes = {'/', 0x00, '/'};
String odd = new String(oddBytes, StandardCharsets.ISO_8859_1); String odd = new String(oddBytes, StandardCharsets.ISO_8859_1);
assertEquals(odd, URIUtil.decodePath("/%00/")); assertEquals(odd, URIUtil.decodePath("/%00/"));
} }

View File

@ -256,7 +256,7 @@ public class Utf8AppendableTest
@TestFactory @TestFactory
public Iterator<DynamicTest> testBadUtf8() public Iterator<DynamicTest> testBadUtf8()
{ {
String samples[] = new String[]{ String[] samples = new String[]{
"c0af", "c0af",
"EDA080", "EDA080",
"f08080af", "f08080af",

View File

@ -35,7 +35,7 @@ public final class Slf4jHelper
File testJarDir = MavenTestingUtils.getTargetFile("test-jars"); File testJarDir = MavenTestingUtils.getTargetFile("test-jars");
assumeTrue(testJarDir.exists()); // trigger @Ignore if dir not there 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) public boolean accept(File path)
{ {
@ -49,7 +49,7 @@ public final class Slf4jHelper
assumeTrue(jarfiles.length > 0); // trigger @Ignore if no jar files. 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++) for (int i = 0; i < jarfiles.length; i++)
{ {
urls[i] = jarfiles[i].toURI().toURL(); urls[i] = jarfiles[i].toURI().toURL();

View File

@ -601,7 +601,7 @@ public class FileSystemResourceTest
try (Resource base = newResource(resourceClass, dir.toFile())) try (Resource base = newResource(resourceClass, dir.toFile()))
{ {
String list[] = base.list(); String[] list = base.list();
List<String> actual = Arrays.asList(list); List<String> actual = Arrays.asList(list);
assertEquals(expected.size(), actual.size()); assertEquals(expected.size(), actual.size());

View File

@ -284,7 +284,7 @@ public class WebSocketClientTest
// Create string that is larger than default size of 64k // Create string that is larger than default size of 64k
// but smaller than maxMessageSize of 100k // but smaller than maxMessageSize of 100k
int size = 80 * 1024; int size = 80 * 1024;
byte buf[] = new byte[size]; byte[] buf = new byte[size];
Arrays.fill(buf, (byte)'x'); Arrays.fill(buf, (byte)'x');
String msg = StringUtil.toUTF8String(buf, 0, buf.length); String msg = StringUtil.toUTF8String(buf, 0, buf.length);

View File

@ -1055,7 +1055,7 @@ public class XmlConfigurationTest
@Test @Test
public void testJettyStandardIdsAndProperties_JettyHome_JettyBase() throws Exception public void testJettyStandardIdsAndProperties_JettyHome_JettyBase() throws Exception
{ {
String propNames[] = new String[] String[] propNames = new String[]
{ {
"jetty.base", "jetty.base",
"jetty.home" "jetty.home"
@ -1084,7 +1084,7 @@ public class XmlConfigurationTest
@Test @Test
public void testJettyStandardIdsAndProperties_JettyHomeUri_JettyBaseUri() throws Exception public void testJettyStandardIdsAndProperties_JettyHomeUri_JettyBaseUri() throws Exception
{ {
String propNames[] = new String[] String[] propNames = new String[]
{ {
"jetty.base.uri", "jetty.base.uri",
"jetty.home.uri" "jetty.home.uri"

View File

@ -1530,12 +1530,12 @@ public abstract class RFC2616BaseTest
// Collect 'boundary' string // Collect 'boundary' string
String boundary = null; String boundary = null;
String parts[] = StringUtil.split(contentType, ';'); String[] parts = StringUtil.split(contentType, ';');
for (int i = 0; i < parts.length; i++) for (int i = 0; i < parts.length; i++)
{ {
if (parts[i].trim().startsWith("boundary=")) 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"); assertEquals(2, boundparts.length, specId + " Boundary parts.length");
boundary = boundparts[1]; boundary = boundparts[1];
} }

View File

@ -300,7 +300,7 @@ public class JettyDistro
// The actual jetty-distribution-${version} directory is under this directory. // The actual jetty-distribution-${version} directory is under this directory.
// Lets find it. // Lets find it.
File subdirs[] = distroUnpackDir.listFiles(path -> File[] subdirs = distroUnpackDir.listFiles(path ->
{ {
if (!path.isDirectory()) if (!path.isDirectory())
{ {
@ -753,7 +753,7 @@ public class JettyDistro
private String getJavaBin() private String getJavaBin()
{ {
String javaexes[] = new String[] String[] javaexes = new String[]
{"java", "java.exe"}; {"java", "java.exe"};
File javaHomeDir = new File(System.getProperty("java.home")); File javaHomeDir = new File(System.getProperty("java.home"));

View File

@ -74,7 +74,7 @@ public class StringUtil
return new String[]{}; // empty array return new String[]{}; // empty array
} }
String ret[]; String[] ret;
int count = 0; int count = 0;
int offset = 0; int offset = 0;