test/java/module/repository/LocalRepositoryTest.java

Print this page

        

@@ -66,15 +66,16 @@
         rc.mkdirs();
         return rc;
     }
 
     public static void realMain(String[] args) throws Throwable {
+        boolean onWindows = System.getProperty("os.platform").equalsIgnoreCase("windows");
 
         // Enables shadow file copies in the repository if we're running
         // on Windows. This is to prevent file locking in the
         // source location.
-        if (System.getProperty("os.platform").equalsIgnoreCase("windows")) {
+        if (onWindows) {
             System.setProperty("java.module.repository.shadowcopyfiles", "true");
         }
 
         File srcDir =
             new File(

@@ -175,12 +176,16 @@
         // Verify that we can reload from a read-only location
         boolean readOnlyChangeOK = (srcDir.setWritable(false) == true);
         repo.reload();
 
         if (readOnlyChangeOK) {
-//            check(repo.isReadOnly());
+            if (!onWindows) {
+                // I/O APIs are not completely honest about writability of
+                // directories on Windows; see 4939819 and 6728842.
+                check(repo.isReadOnly());
         }
+        }
 
         // Check initial module is installed
         List<ModuleArchiveInfo> installed = repo.list();
         println("=installed size " + installed.size());
         check(installed.size() == 1);