8179247: java/util/zip/TestExtraTime.java: add some instrumentation which might illuminate the failure of 2016-09-14
authorbpb
Wed, 26 Apr 2017 14:03:02 -0700
changeset 44845 3b829f6434d8
parent 44844 b2b4d98404ba
child 44846 b3f9f5bf40b2
8179247: java/util/zip/TestExtraTime.java: add some instrumentation which might illuminate the failure of 2016-09-14 Summary: Add some instrumentation to help diagnosing 8166060 Reviewed-by: amlu, dfuchs, rriggs
jdk/test/java/util/zip/TestExtraTime.java
--- a/jdk/test/java/util/zip/TestExtraTime.java	Wed Apr 26 13:38:21 2017 -0700
+++ b/jdk/test/java/util/zip/TestExtraTime.java	Wed Apr 26 14:03:02 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,13 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.FileOwnerAttributeView;
 import java.nio.file.attribute.FileTime;
+import java.nio.file.attribute.PosixFilePermission;
 import java.time.Instant;
 import java.util.Arrays;
+import java.util.Set;
 import java.util.TimeZone;
 import java.util.concurrent.TimeUnit;
 import java.util.zip.ZipEntry;
@@ -147,6 +151,28 @@
         // ZipFile
         Path zpath = Paths.get(System.getProperty("test.dir", "."),
                                "TestExtraTime.zip");
+        Path zparent = zpath.getParent();
+        if (zparent != null && !Files.isWritable(zparent)) {
+            System.err.format("zpath %s parent %s is not writable%n",
+                zpath, zparent);
+        }
+        if (Files.exists(zpath)) {
+            System.err.format("zpath %s already exists%n", zpath);
+            if (Files.isDirectory(zpath)) {
+                System.err.format("%n%s contents:%n", zpath);
+                Files.list(zpath).forEach(System.err::println);
+            }
+            FileOwnerAttributeView foav = Files.getFileAttributeView(zpath,
+                FileOwnerAttributeView.class);
+            System.err.format("zpath %s owner: %s%n", zpath, foav.getOwner());
+            System.err.format("zpath %s permissions:%n", zpath);
+            Set<PosixFilePermission> perms =
+                Files.getPosixFilePermissions(zpath);
+            perms.stream().forEach(System.err::println);
+        }
+        if (Files.isSymbolicLink(zpath)) {
+            System.err.format("zpath %s is a symbolic link%n", zpath);
+        }
         Files.copy(new ByteArrayInputStream(baos.toByteArray()), zpath);
         try (ZipFile zf = new ZipFile(zpath.toFile())) {
             ze = zf.getEntry("TestExtraTime.java");