8181493: (fs) Files.readAttributes(path, BasicFileAttributes.class) should preserve nano second time stamps

Brian Burkhalter brian.burkhalter at oracle.com
Fri Jul 19 15:52:48 UTC 2019


> On Jul 19, 2019, at 7:59 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> 
>> On Jul 19, 2019, at 4:14 AM, Alan Bateman <Alan.Bateman at oracle.com <mailto:Alan.Bateman at oracle.com>> wrote:
>> 
>> On the test then it would be better to use the scratch directory as Lance suggests. Also would be useful to have it run a few hundred times on all platforms before publish to be confident that it is reliable (we've had a lot of issues with tests for file time stamps as you know).
> 
> OK I will update the test and do a large number of test runs before pushing this.

Test updated as

--- a/test/jdk/java/nio/file/attribute/BasicFileAttributeView/SetTimesNanos.java
+++ b/test/jdk/java/nio/file/attribute/BasicFileAttributeView/SetTimesNanos.java
@@ -45,10 +45,10 @@
     public static void main(String[] args) throws IOException,
         InterruptedException {
 
-        Path dirPath = Path.of(System.getProperty("test.dir", "."), "test");
+        Path dirPath = Path.of("test");
         Path dir = Files.createDirectory(dirPath);
         FileStore store = Files.getFileStore(dir);
-        System.err.format("FileStore: %s on %s (%s)%n", dir, store.name(),
+        System.out.format("FileStore: %s on %s (%s)%n", dir, store.name(),
             store.type());
         if (System.getProperty("os.name").toLowerCase().startsWith("mac") &&
             store.name().equalsIgnoreCase("hfs")) {
@@ -58,7 +58,7 @@
         }
         testNanos(dir);
 
-        Path file = Files.createTempFile(dir, "test", "test");
+        Path file = Files.createFile(dir.resolve("test.dat"));
         testNanos(file);
     }

Build-and-test job submitted; some test-only jobs to follow.

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190719/6b1fa8d7/attachment.html>


More information about the nio-dev mailing list