test/jdk/nio/zipfs/ZeroDate.java

Print this page

        

@@ -42,11 +42,11 @@
 import java.util.Collections;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
 /* @test
- * @bug 8184940
+ * @bug 8184940 8186227
  * @summary JDK 9 rejects zip files where the modified day or month is 0
  * @author Liam Miller-Cushon
  */
 public class ZeroDate {
 

@@ -83,11 +83,11 @@
         // ensure that the archive is still readable, and the date is 1979-11-30
         Path path = Files.createTempFile("out", ".zip");
         try (OutputStream os = Files.newOutputStream(path)) {
             os.write(data);
         }
-        URI uri = URI.create("jar:file://" + path.toAbsolutePath());
+        URI uri = URI.create("jar:" + path.toUri());
         try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
             Path entry = fs.getPath("x");
             Instant actualInstant =
                     Files.readAttributes(entry, BasicFileAttributes.class)
                             .lastModifiedTime()