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:
Phillip Webb
2018-02-22 21:10:02 -08:00
parent 358adcd6e3
commit 4b9c3c137e
84 changed files with 210 additions and 189 deletions

View File

@@ -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.
@@ -26,6 +26,8 @@ import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.springframework.util.StringUtils;
/**
* JUnit {@link TestRule} that launched a JVM and redirects its output to a test
* method-specific location.
@@ -50,7 +52,7 @@ class JvmLauncher implements TestRule {
command.addAll(Arrays.asList(args));
File standardOut = new File(this.outputDirectory, name + ".out");
File standardError = new File(this.outputDirectory, name + ".err");
Process process = new ProcessBuilder(command.toArray(new String[command.size()]))
Process process = new ProcessBuilder(StringUtils.toStringArray(command))
.redirectError(standardError).redirectOutput(standardOut).start();
return new LaunchedJvm(process, standardOut, standardError);
}