Consider this code (also attached):
---
package jrtfstest;
import java.net.URI;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
public class JRTFSTest {
public static void main(String[] args) throws Exception {
Path p = FileSystems.getFileSystem(new URI("jrt:///")).getPath("modules");
boolean wasDirectory = Files.isDirectory(p);
Path m = p.resolve("modules");
Files.exists(m);
if (wasDirectory != Files.isDirectory(p)) {
throw new AssertionError("The status of 'p' changed from: " + wasDirectory +
" to: " + Files.isDirectory(p));
}
}
}
---
Running like this:
---
$ java /tmp/JavaApplication71/src/jrtfstest/JRTFSTest.java
Exception in thread "main" java.lang.AssertionError: The status of 'p' changed from: true to: false
at jrtfstest.JRTFSTest.main(JRTFSTest.java:17)
---
By calling Files.exists on "m", the result from Files.isDirectory for "p" changed - that does not seem right.
This was found while evaluating why this test fails:
https://github.com/apache/netbeans/blob/903b73c7ed9284df976f3ba466e8696b51d64167/java/classfile/test/unit/src/org/netbeans/modules/classfile/ModuleTest.java#L209
I think the test was originally trying to work on various old development versions of JRT FS, so was trying to determine whether "modules" directory exists or not, but it breaks the filesystem.
---
package jrtfstest;
import java.net.URI;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
public class JRTFSTest {
public static void main(String[] args) throws Exception {
Path p = FileSystems.getFileSystem(new URI("jrt:///")).getPath("modules");
boolean wasDirectory = Files.isDirectory(p);
Path m = p.resolve("modules");
Files.exists(m);
if (wasDirectory != Files.isDirectory(p)) {
throw new AssertionError("The status of 'p' changed from: " + wasDirectory +
" to: " + Files.isDirectory(p));
}
}
}
---
Running like this:
---
$ java /tmp/JavaApplication71/src/jrtfstest/JRTFSTest.java
Exception in thread "main" java.lang.AssertionError: The status of 'p' changed from: true to: false
at jrtfstest.JRTFSTest.main(JRTFSTest.java:17)
---
By calling Files.exists on "m", the result from Files.isDirectory for "p" changed - that does not seem right.
This was found while evaluating why this test fails:
https://github.com/apache/netbeans/blob/903b73c7ed9284df976f3ba466e8696b51d64167/java/classfile/test/unit/src/org/netbeans/modules/classfile/ModuleTest.java#L209
I think the test was originally trying to work on various old development versions of JRT FS, so was trying to determine whether "modules" directory exists or not, but it breaks the filesystem.