Skip to content

Commit 021879c

Browse files
committed
Merge branch 'master' of https://ggregory@gitbox.apache.org/repos/asf/commons-io.git
2 parents c0fc816 + ff02373 commit 021879c

11 files changed

Lines changed: 18 additions & 16 deletions

File tree

src/changes/changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ The <action> type attribute can be add,update,fix,remove.
4545
</properties>
4646

4747
<body>
48+
<release version="2.10.1" date="2021-MM-DD" description="Java 8 required.">
49+
<!-- FIX -->
50+
<action dev="ggregory" type="fix" due-to="Arturo Bernal">
51+
Minor changes #243.
52+
</action>
53+
</release>
4854
<!-- The release date is the date RC is cut -->
4955
<release version="2.10.0" date="2021-06-10" description="Java 8 required.">
5056
<!-- FIX -->

src/main/java/org/apache/commons/io/CopyUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static void copy(final byte[] input, final Writer output, final String en
169169
public static int copy(final InputStream input, final OutputStream output) throws IOException {
170170
final byte[] buffer = IOUtils.byteArray();
171171
int count = 0;
172-
int n = 0;
172+
int n;
173173
while (EOF != (n = input.read(buffer))) {
174174
output.write(buffer, 0, n);
175175
count += n;
@@ -194,7 +194,7 @@ public static int copy(
194194
throws IOException {
195195
final char[] buffer = IOUtils.getCharArray();
196196
int count = 0;
197-
int n = 0;
197+
int n;
198198
while (EOF != (n = input.read(buffer))) {
199199
output.write(buffer, 0, n);
200200
count += n;

src/main/java/org/apache/commons/io/FileSystemUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ public class FileSystemUtils {
9999
} else if (osName.contains("hp-ux") ||
100100
osName.contains("aix")) {
101101
os = POSIX_UNIX;
102-
} else {
103-
os = OTHER;
104102
}
105103

106104
} catch (final Exception ex) {

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ public static void copyDirectory(final File srcDir, final File destDir, final Fi
687687
final String destDirCanonicalPath = destDir.getCanonicalPath();
688688
if (destDirCanonicalPath.startsWith(srcDirCanonicalPath)) {
689689
final File[] srcFiles = listFiles(srcDir, fileFilter);
690-
if (srcFiles != null && srcFiles.length > 0) {
690+
if (srcFiles.length > 0) {
691691
exclusionList = new ArrayList<>(srcFiles.length);
692692
for (final File srcFile : srcFiles) {
693693
final File copiedFile = new File(destDir, srcFile.getName());
@@ -2254,7 +2254,7 @@ public static void moveDirectoryToDirectory(final File src, final File destDir,
22542254
}
22552255
if (!createDestDir) {
22562256
throw new FileNotFoundException("Destination directory '" + destDir +
2257-
"' does not exist [createDestDir=" + createDestDir + "]");
2257+
"' does not exist [createDestDir=" + false + "]");
22582258
}
22592259
mkdirs(destDir);
22602260
}

src/main/java/org/apache/commons/io/FilenameUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ private static boolean isIPv6Address(final String inet6Address) {
16041604
if (octet.length() > IPV6_MAX_HEX_DIGITS_PER_GROUP) {
16051605
return false;
16061606
}
1607-
int octetInt = 0;
1607+
final int octetInt;
16081608
try {
16091609
octetInt = Integer.parseInt(octet, BASE_16);
16101610
} catch (final NumberFormatException e) {

src/main/java/org/apache/commons/io/file/PathUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ private static class RelativeSortedPaths {
9292
*/
9393
private RelativeSortedPaths(final Path dir1, final Path dir2, final int maxDepth,
9494
final LinkOption[] linkOptions, final FileVisitOption[] fileVisitOptions) throws IOException {
95-
List<Path> tmpRelativeDirList1 = null;
96-
List<Path> tmpRelativeDirList2 = null;
95+
final List<Path> tmpRelativeDirList1;
96+
final List<Path> tmpRelativeDirList2;
9797
List<Path> tmpRelativeFileList1 = null;
9898
List<Path> tmpRelativeFileList2 = null;
9999
if (dir1 == null && dir2 == null) {

src/main/java/org/apache/commons/io/function/IOConsumer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public interface IOConsumer<T> {
3333
/**
3434
* Package private constant; consider private.
3535
*/
36-
static final IOConsumer<?> NOOP_IO_CONSUMER = t -> {/* noop */};
36+
IOConsumer<?> NOOP_IO_CONSUMER = t -> {/* noop */};
3737

3838
/**
3939
* Returns a constant NOOP consumer.
@@ -43,7 +43,7 @@ public interface IOConsumer<T> {
4343
* @since 2.9.0
4444
*/
4545
@SuppressWarnings("unchecked")
46-
public static <T> IOConsumer<T> noop() {
46+
static <T> IOConsumer<T> noop() {
4747
return (IOConsumer<T>) NOOP_IO_CONSUMER;
4848
}
4949

src/main/java/org/apache/commons/io/input/BufferedFileChannelInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static Class<?> getDirectBufferClass() {
5353
Class<?> res = null;
5454
try {
5555
res = Class.forName("sun.nio.ch.DirectBuffer");
56-
} catch (IllegalAccessError | ClassNotFoundException ignored) {
56+
} catch (final IllegalAccessError | ClassNotFoundException ignored) {
5757
// ignored
5858
}
5959
return res;

src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ThresholdingOutputStream extends OutputStream {
4040
/**
4141
* Noop output stream getter function.
4242
*/
43-
private static IOFunction<ThresholdingOutputStream, OutputStream> NOOP_OS_GETTER = os -> NullOutputStream.NULL_OUTPUT_STREAM;
43+
private static final IOFunction<ThresholdingOutputStream, OutputStream> NOOP_OS_GETTER = os -> NullOutputStream.NULL_OUTPUT_STREAM;
4444

4545
/**
4646
* The threshold at which the event will be triggered.

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
import static org.junit.jupiter.api.Assertions.assertEquals;
2222
import static org.junit.jupiter.api.Assertions.assertNotEquals;
2323
import static org.junit.jupiter.api.Assertions.assertNotNull;
24-
import static org.junit.jupiter.api.Assertions.assertTrue;
2524
import static org.junit.jupiter.api.Assertions.fail;
2625

2726
import java.nio.charset.Charset;
28-
import java.util.Arrays;
2927

3028
import org.junit.jupiter.api.Test;
3129

0 commit comments

Comments
 (0)