Polish Collection.toArray
Consistently use `StringUtils.toStringArray`, `ClassUtils.toClassArray` or zero length when converting collections to arrays. Fixes gh-12160
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import org.junit.rules.ExternalResource;
|
||||
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Base {@link ExternalResource} for launching a Spring Boot application as part of a
|
||||
@@ -74,7 +75,7 @@ abstract class AbstractApplicationLauncher extends ExternalResource {
|
||||
arguments.add(System.getProperty("java.home") + "/bin/java");
|
||||
arguments.addAll(getArguments(archive));
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(
|
||||
arguments.toArray(new String[arguments.size()]));
|
||||
StringUtils.toStringArray(arguments));
|
||||
processBuilder.redirectOutput(Redirect.INHERIT);
|
||||
processBuilder.redirectError(Redirect.INHERIT);
|
||||
if (workingDirectory != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,7 +53,7 @@ public abstract class AbstractEmbeddedServletContainerIntegrationTests {
|
||||
parameters.addAll(createParameters(packaging, "jetty", applicationLaunchers));
|
||||
parameters.addAll(createParameters(packaging, "tomcat", applicationLaunchers));
|
||||
parameters.addAll(createParameters(packaging, "undertow", applicationLaunchers));
|
||||
return parameters.toArray(new Object[parameters.size()]);
|
||||
return parameters.toArray(new Object[0]);
|
||||
}
|
||||
|
||||
private static List<Object> createParameters(String packaging, String container,
|
||||
|
||||
Reference in New Issue
Block a user