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

Langer, Christoph christoph.langer at sap.com
Thu Aug 8 09:32:49 UTC 2019


Hi Brian,

after the change came in, we see sporadic test failures:

java.lang.RuntimeException: Expected modification timestamp to be '1483261261123456789', but was '1483261261000000000'
at SetTimesNanos.testNanos(SetTimesNanos.java:85)
at SetTimesNanos.main(SetTimesNanos.java:59)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
at java.base/java.lang.Thread.run(Thread.java:830)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Expected modification timestamp to be '1483261261123456789', but was '1483261261000000000'
JavaTest Message: shutting down test

I opened https://bugs.openjdk.java.net/browse/JDK-8229280 to track this.

Can you please have a look?

Thanks
Christoph

From: nio-dev <nio-dev-bounces at openjdk.java.net> On Behalf Of Brian Burkhalter
Sent: Freitag, 19. Juli 2019 17:53
To: Alan Bateman <Alan.Bateman at oracle.com>
Cc: nio-dev <nio-dev at openjdk.java.net>
Subject: Re: 8181493: (fs) Files.readAttributes(path, BasicFileAttributes.class) should preserve nano second time stamps


On Jul 19, 2019, at 7:59 AM, Brian Burkhalter <brian.burkhalter at oracle.com<mailto: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/20190808/ac6877ee/attachment.html>


More information about the nio-dev mailing list