From b8189ae809feba19cac982296754f244bf33f136 Mon Sep 17 00:00:00 2001 From: Justin Lu Date: Tue, 5 May 2026 18:27:05 +0000 Subject: [PATCH] 8381984: Test jdk/nio/zipfs/ZipFSTester.java fails with mismatched timestamp Reviewed-by: jpai, lancea --- test/jdk/jdk/nio/zipfs/ZipFSTester.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/jdk/jdk/nio/zipfs/ZipFSTester.java b/test/jdk/jdk/nio/zipfs/ZipFSTester.java index 2ca4686ff14..7325514b1ce 100644 --- a/test/jdk/jdk/nio/zipfs/ZipFSTester.java +++ b/test/jdk/jdk/nio/zipfs/ZipFSTester.java @@ -646,6 +646,11 @@ public class ZipFSTester { @Test void testTime() throws Exception { var jar = Utils.createJarFile(System.currentTimeMillis() + ".jar", jarContents); + // Read JAR source once before capturing file attributes. + // This stabilizes access time before the copy operation. + try (InputStream in = Files.newInputStream(jar)) { + in.transferTo(OutputStream.nullOutputStream()); // output is irrelevant + } BasicFileAttributes attrs = Files .getFileAttributeView(jar, BasicFileAttributeView.class) .readAttributes();