Skip to content

Commit e1a5fdd

Browse files
committed
IO-689: FileUtils: Remove Instant->ZonedDateTime->Instant round-trip
This to/from round-trip conversion has no effect on the value of the Instant.
1 parent 8f4ccfc commit e1a5fdd

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ The <action> type attribute can be add,update,fix,remove.
5959
<action dev="ggregory" type="update" due-to="Gary Gregory">
6060
Update commons.jacoco.version 0.8.5 to 0.8.6 (Fixes Java 15 builds).
6161
</action>
62+
<action issue="IO-689" dev="aherbert" type="fix" due-to="Uwe Schindler">
63+
FileUtils: Remove Instant->ZonedDateTime->Instant round-trip.
64+
</action>
6265
</release>
6366
<!-- The release date is the date RC is cut -->
6467
<release version="2.8.0" date="2020-09-05" description="Java 8 required.">

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ public static boolean isFileNewer(final File file, final File reference) {
17871787
*/
17881788
public static boolean isFileNewer(final File file, final Instant instant) {
17891789
Objects.requireNonNull(instant, "instant");
1790-
return isFileNewer(file, instant.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
1790+
return isFileNewer(file, instant.toEpochMilli());
17911791
}
17921792

17931793
/**
@@ -1955,7 +1955,7 @@ public static boolean isFileOlder(final File file, final File reference) {
19551955
*/
19561956
public static boolean isFileOlder(final File file, final Instant instant) {
19571957
Objects.requireNonNull(instant, "instant");
1958-
return isFileOlder(file, instant.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli());
1958+
return isFileOlder(file, instant.toEpochMilli());
19591959
}
19601960

19611961
/**

0 commit comments

Comments
 (0)