Reuse constants
MODIFY
src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTest.java
src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTest.java
import java.util.List;
import org.apache.commons.io.file.AbstractTempDirTest;
+import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
@@ -55,7 +56,7 @@ private boolean chmod(final File file, final int mode, final boolean recurse) th
final Process proc;
try {
- proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
+ proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
} catch (final IOException e) {
return false;
}

MODIFY
src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTest.java
src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTest.java
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
@@ -47,7 +48,7 @@ private boolean setupSymlink(final File res, final File link) throws Exception {
final Process proc;
- proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
+ proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
return proc.waitFor() == 0;
}

MODIFY
src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryLinuxTest.java
src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryLinuxTest.java
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
@@ -48,7 +49,7 @@ private boolean chmod(final File file, final int mode, final boolean recurse) th
final Process proc;
try {
- proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
+ proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
} catch (final IOException e) {
return false;
}
@@ -67,7 +68,7 @@ protected boolean setupSymlink(final File res, final File link) throws Exception
final Process proc;
- proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
+ proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
return proc.waitFor() == 0;
}

MODIFY
src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryWindowsTest.java
src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryWindowsTest.java
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang3.ArrayUtils;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
@@ -47,7 +48,7 @@ protected boolean setupSymlink(final File res, final File link) throws Exception
args.add(link.getAbsolutePath());
args.add(res.getAbsolutePath());
- final Process proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
+ final Process proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
final InputStream errorStream = proc.getErrorStream();
final int rc = proc.waitFor();
System.err.print(IOUtils.toString(errorStream, Charset.defaultCharset()));

Reuse constants