Skip to content

Commit b8c6f0e

Browse files
committed
Reuse constants
1 parent 183d30f commit b8c6f0e

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/test/java/org/apache/commons/io/FileUtilsCleanDirectoryTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.List;
2929

3030
import org.apache.commons.io.file.AbstractTempDirTest;
31+
import org.apache.commons.lang3.ArrayUtils;
3132
import org.junit.jupiter.api.Test;
3233
import org.junit.jupiter.api.condition.DisabledOnOs;
3334
import org.junit.jupiter.api.condition.OS;
@@ -55,7 +56,7 @@ private boolean chmod(final File file, final int mode, final boolean recurse) th
5556
final Process proc;
5657

5758
try {
58-
proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
59+
proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
5960
} catch (final IOException e) {
6061
return false;
6162
}

src/test/java/org/apache/commons/io/FileUtilsCleanSymlinksTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.ArrayList;
2525
import java.util.List;
2626

27+
import org.apache.commons.lang3.ArrayUtils;
2728
import org.junit.jupiter.api.Test;
2829
import org.junit.jupiter.api.io.TempDir;
2930

@@ -47,7 +48,7 @@ private boolean setupSymlink(final File res, final File link) throws Exception {
4748

4849
final Process proc;
4950

50-
proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
51+
proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
5152
return proc.waitFor() == 0;
5253
}
5354

src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryLinuxTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.ArrayList;
2727
import java.util.List;
2828

29+
import org.apache.commons.lang3.ArrayUtils;
2930
import org.junit.jupiter.api.Test;
3031
import org.junit.jupiter.api.condition.DisabledOnOs;
3132
import org.junit.jupiter.api.condition.OS;
@@ -48,7 +49,7 @@ private boolean chmod(final File file, final int mode, final boolean recurse) th
4849
final Process proc;
4950

5051
try {
51-
proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
52+
proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
5253
} catch (final IOException e) {
5354
return false;
5455
}
@@ -67,7 +68,7 @@ protected boolean setupSymlink(final File res, final File link) throws Exception
6768

6869
final Process proc;
6970

70-
proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
71+
proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
7172
return proc.waitFor() == 0;
7273
}
7374

src/test/java/org/apache/commons/io/FileUtilsDeleteDirectoryWindowsTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.ArrayList;
2323
import java.util.List;
2424

25+
import org.apache.commons.lang3.ArrayUtils;
2526
import org.junit.jupiter.api.condition.EnabledOnOs;
2627
import org.junit.jupiter.api.condition.OS;
2728

@@ -47,7 +48,7 @@ protected boolean setupSymlink(final File res, final File link) throws Exception
4748
args.add(link.getAbsolutePath());
4849
args.add(res.getAbsolutePath());
4950

50-
final Process proc = Runtime.getRuntime().exec(args.toArray(new String[args.size()]));
51+
final Process proc = Runtime.getRuntime().exec(args.toArray(ArrayUtils.EMPTY_STRING_ARRAY));
5152
final InputStream errorStream = proc.getErrorStream();
5253
final int rc = proc.waitFor();
5354
System.err.print(IOUtils.toString(errorStream, Charset.defaultCharset()));

0 commit comments

Comments
 (0)