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 2019/08/09 21:53:59 UTC
[commons-vfs] branch master updated: [VFS-725][Local]
org.apache.commons.vfs2.FileContent.getLastModifiedTime() is losing
milliseconds (always ends in 000).
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-vfs.git
The following commit(s) were added to refs/heads/master by this push:
new fda7227 [VFS-725][Local] org.apache.commons.vfs2.FileContent.getLastModifiedTime() is losing milliseconds (always ends in 000).
fda7227 is described below
commit fda72273a74ab3fe4ebc4cf19aa888ffe9997a27
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Aug 9 17:53:55 2019 -0400
[VFS-725][Local]
org.apache.commons.vfs2.FileContent.getLastModifiedTime() is losing
milliseconds (always ends in 000).
---
.../java/org/apache/commons/vfs2/provider/local/LocalFile.java | 8 +++++++-
src/changes/changes.xml | 3 +++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
index e0dcf59..ff808ae 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/local/LocalFile.java
@@ -112,7 +112,13 @@ public class LocalFile extends AbstractFileObject<LocalFileSystem> {
*/
@Override
protected long doGetLastModifiedTime() throws FileSystemException {
- return file.lastModified();
+ // Workaround OpenJDK 8 and 9 bug JDK-8177809
+ // https://bugs.openjdk.java.net/browse/JDK-8177809
+ try {
+ return Files.getLastModifiedTime(file.toPath()).toMillis();
+ } catch (IOException e) {
+ throw new FileSystemException(file.toString(), e);
+ }
}
/**
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 108803f..f2cee23 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,9 @@ The <action> type attribute can be add,update,fix,remove.
<!-- [Local] Need an easy way to convert from a FileObject to a File. -->
<!-- </action> -->
<!-- START Might need to be moved to the next version -->
+ <action issue="VFS-725" dev="ggregory" type="fix" due-to="Gary Gregory">
+ [Local] org.apache.commons.vfs2.FileContent.getLastModifiedTime() is losing milliseconds (always ends in 000).
+ </action>
</release>
<release version="2.4" date="2019-07-12" description="New features and bug fix release.">
<action issue="VFS-690" dev="ggregory" type="add">