You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/01/28 15:51:21 UTC

[commons-io] branch master updated (ebae41e -> 1f2c9a1)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git.


    from ebae41e  [IO-709] Add null safe variants of isDirectory and isRegularFile.
     new 48d5a74  Remove trailing whitespace.
     new 1f2c9a1  Use final.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/commons/io/FileUtils.java                  | 6 +++---
 src/main/java/org/apache/commons/io/monitor/FileEntry.java          | 2 +-
 src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java | 2 +-
 .../java/org/apache/commons/io/file/PathUtilsDeleteFileTest.java    | 4 ++--
 src/test/java/org/apache/commons/io/file/PathUtilsTest.java         | 4 ++--
 .../java/org/apache/commons/io/input/AutoCloseInputStreamTest.java  | 2 +-
 src/test/java/org/apache/commons/io/input/QueueInputStreamTest.java | 2 +-
 .../java/org/apache/commons/io/output/QueueOutputStreamTest.java    | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)


[commons-io] 02/02: Use final.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git

commit 1f2c9a1d221526528cd50ed93c93526df0f336a2
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jan 28 10:41:22 2021 -0500

    Use final.
---
 src/main/java/org/apache/commons/io/FileUtils.java                    | 2 +-
 src/main/java/org/apache/commons/io/monitor/FileEntry.java            | 2 +-
 src/test/java/org/apache/commons/io/file/PathUtilsDeleteFileTest.java | 4 ++--
 src/test/java/org/apache/commons/io/file/PathUtilsTest.java           | 4 ++--
 .../java/org/apache/commons/io/input/AutoCloseInputStreamTest.java    | 2 +-
 src/test/java/org/apache/commons/io/input/QueueInputStreamTest.java   | 2 +-
 src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 33071b5..56f0530 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -1995,7 +1995,7 @@ public class FileUtils {
         // This bug is in OpenJDK 8 and 9, and fixed in 10.
         try {
             return lastModified(file);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             throw new IllegalArgumentException(file.toString(), e);
         }
     }
diff --git a/src/main/java/org/apache/commons/io/monitor/FileEntry.java b/src/main/java/org/apache/commons/io/monitor/FileEntry.java
index 3d54420..467b54b 100644
--- a/src/main/java/org/apache/commons/io/monitor/FileEntry.java
+++ b/src/main/java/org/apache/commons/io/monitor/FileEntry.java
@@ -110,7 +110,7 @@ public class FileEntry implements Serializable {
         directory = exists && file.isDirectory();
         try {
             lastModified = exists ? FileUtils.lastModified(file) : 0;
-        } catch (IOException e) {
+        } catch (final IOException e) {
             lastModified = 0;
         }
         length = exists && !directory ? file.length() : 0;
diff --git a/src/test/java/org/apache/commons/io/file/PathUtilsDeleteFileTest.java b/src/test/java/org/apache/commons/io/file/PathUtilsDeleteFileTest.java
index bb30e6a..d9c340e 100644
--- a/src/test/java/org/apache/commons/io/file/PathUtilsDeleteFileTest.java
+++ b/src/test/java/org/apache/commons/io/file/PathUtilsDeleteFileTest.java
@@ -150,8 +150,8 @@ public class PathUtilsDeleteFileTest {
     public void testDeleteBrokenLink() throws IOException {
         assumeFalse(SystemUtils.IS_OS_WINDOWS);
 
-        Path missingFile = tempDir.resolve("missing.txt");
-        Path brokenLink = tempDir.resolve("broken.txt");
+        final Path missingFile = tempDir.resolve("missing.txt");
+        final Path brokenLink = tempDir.resolve("broken.txt");
         Files.createSymbolicLink(brokenLink, missingFile);
 
         assertTrue(Files.exists(brokenLink, LinkOption.NOFOLLOW_LINKS));
diff --git a/src/test/java/org/apache/commons/io/file/PathUtilsTest.java b/src/test/java/org/apache/commons/io/file/PathUtilsTest.java
index d71fb4c..cfc5765 100644
--- a/src/test/java/org/apache/commons/io/file/PathUtilsTest.java
+++ b/src/test/java/org/apache/commons/io/file/PathUtilsTest.java
@@ -74,7 +74,7 @@ public class PathUtilsTest extends TestArguments {
         assertFalse(PathUtils.isDirectory(null));
 
         assertTrue(PathUtils.isDirectory(tempDir));
-        Path testFile1 = Files.createTempFile(tempDir, "prefix", null);
+        final Path testFile1 = Files.createTempFile(tempDir, "prefix", null);
         assertFalse(PathUtils.isDirectory(testFile1));
 
         final Path tempDir = Files.createTempDirectory(getClass().getCanonicalName());
@@ -87,7 +87,7 @@ public class PathUtilsTest extends TestArguments {
         assertFalse(PathUtils.isRegularFile(null));
 
         assertFalse(PathUtils.isRegularFile(tempDir));
-        Path testFile1 = Files.createTempFile(tempDir, "prefix", null);
+        final Path testFile1 = Files.createTempFile(tempDir, "prefix", null);
         assertTrue(PathUtils.isRegularFile(testFile1));
 
         Files.delete(testFile1);
diff --git a/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java b/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
index 0d3c20b..7665de3 100644
--- a/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/AutoCloseInputStreamTest.java
@@ -102,7 +102,7 @@ public class AutoCloseInputStreamTest {
     @Test
     public void testResetBeforeEnd() throws IOException {
         final String inputStr = "1234";
-        AutoCloseInputStream inputStream = new AutoCloseInputStream(new ByteArrayInputStream(inputStr.getBytes()));
+        final AutoCloseInputStream inputStream = new AutoCloseInputStream(new ByteArrayInputStream(inputStr.getBytes()));
         inputStream.mark(1);
         assertEquals('1', inputStream.read());
         inputStream.reset();
diff --git a/src/test/java/org/apache/commons/io/input/QueueInputStreamTest.java b/src/test/java/org/apache/commons/io/input/QueueInputStreamTest.java
index 6ed5eb9..1fdfa90 100644
--- a/src/test/java/org/apache/commons/io/input/QueueInputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/input/QueueInputStreamTest.java
@@ -121,7 +121,7 @@ public class QueueInputStreamTest {
 
     private void writeUnbuffered(final QueueOutputStream outputStream, final String inputData) throws InterruptedIOException {
         final byte[] bytes = inputData.getBytes(UTF_8);
-        for (byte oneByte : bytes) {
+        for (final byte oneByte : bytes) {
             outputStream.write(oneByte);
         }
     }
diff --git a/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java b/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java
index d71724c..06c3c5c 100644
--- a/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java
+++ b/src/test/java/org/apache/commons/io/output/QueueOutputStreamTest.java
@@ -83,7 +83,7 @@ public class QueueOutputStreamTest {
                 try {
                     writerThreadExchanger.exchange(Thread.currentThread(), timeout, SECONDS);
                     outputStream.write("ABC".getBytes(StandardCharsets.UTF_8));
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     Thread.interrupted(); //clear interrupt
                     exceptionExchanger.exchange(e, timeout, SECONDS);
                 }


[commons-io] 01/02: Remove trailing whitespace.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git

commit 48d5a7482cee660122ae59d9c6faffc3d28f23c7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jan 28 10:40:41 2021 -0500

    Remove trailing whitespace.
---
 src/main/java/org/apache/commons/io/FileUtils.java                  | 4 ++--
 src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 4d96a23..33071b5 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -1962,7 +1962,7 @@ public class FileUtils {
      * <a href="https://bugs.openjdk.java.net/browse/JDK-8177809">JDK-8177809</a> where {@link File#lastModified()} is
      * losing milliseconds (always ends in 000). This bug exists in OpenJDK 8 and 9, and is fixed in 10.
      * </p>
-     * 
+     *
      * @param file The File to query.
      * @return See {@link java.nio.file.attribute.FileTime#toMillis()}.
      * @throws IOException if an I/O error occurs.
@@ -1983,7 +1983,7 @@ public class FileUtils {
      * <a href="https://bugs.openjdk.java.net/browse/JDK-8177809">JDK-8177809</a> where {@link File#lastModified()} is
      * losing milliseconds (always ends in 000). This bug exists in OpenJDK 8 and 9, and is fixed in 10.
      * </p>
-     * 
+     *
      * @param file The File to query.
      * @return See {@link java.nio.file.attribute.FileTime#toMillis()}.
      * @throws IllegalArgumentException if an I/O error occurs.
diff --git a/src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java b/src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java
index 4d6163f..589e7ce 100644
--- a/src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java
+++ b/src/test/java/org/apache/commons/io/FileUtilsFileNewerTestCase.java
@@ -69,7 +69,7 @@ public class FileUtilsFileNewerTestCase {
 
     /**
      * Tests the {@code isFileNewer(File, *)} methods which a "normal" file.
-     * @throws IOException 
+     * @throws IOException
      *
      * @see FileUtils#isFileNewer(File, long)
      * @see FileUtils#isFileNewer(File, Date)