@@ -244,22 +244,30 @@ public void testKnownDirectories(String path, boolean theDefault) throws Excepti
244
244
}
245
245
}
246
246
247
- @ DataProvider (name = "topLevelPkgDirs " )
248
- private Object [][] topLevelPkgDirs () {
247
+ @ DataProvider (name = "topLevelNonExistingDirs " )
248
+ private Object [][] topLevelNonExistingDirs () {
249
249
return new Object [][] {
250
250
{ "/java/lang" },
251
251
{ "java/lang" },
252
252
{ "/java/util" },
253
253
{ "java/util" },
254
+ { "/modules/modules" },
255
+ { "/modules/modules/" },
256
+ { "/modules/modules/java.base" },
257
+ { "/modules/modules/java.base/" },
258
+ { "/modules/modules/java.base/java/lang/Object.class" },
259
+ { "/modules/modules/javax.scripting" },
260
+ { "/modules/modules/javax.scripting/" },
261
+ { "/modules/modules/javax.scripting/javax/script/ScriptEngine.class" },
254
262
};
255
263
}
256
264
257
- @ Test (dataProvider = "topLevelPkgDirs " )
265
+ @ Test (dataProvider = "topLevelNonExistingDirs " )
258
266
public void testNotExists (String path ) throws Exception {
259
267
FileSystem fs = FileSystems .getFileSystem (URI .create ("jrt:/" ));
260
268
Path dir = fs .getPath (path );
261
269
262
- // package directories should not be there at top level
270
+ // These directories should not be there at top level
263
271
assertTrue (Files .notExists (dir ));
264
272
}
265
273
@@ -756,5 +764,15 @@ public void objectClassSizeTest() throws Exception {
756
764
757
765
assertTrue (Files .size (classFile ) > 0L );
758
766
}
767
+
768
+ // @bug 8266291: (jrtfs) Calling Files.exists may break the JRT filesystem
769
+ @ Test
770
+ public void fileExistsCallBreaksFileSystem () throws Exception {
771
+ Path p = FileSystems .getFileSystem (URI .create ("jrt:/" )).getPath ("modules" );
772
+ boolean wasDirectory = Files .isDirectory (p );
773
+ Path m = p .resolve ("modules" );
774
+ Files .exists (m );
775
+ assertTrue (wasDirectory == Files .isDirectory (p ));
776
+ }
759
777
}
760
778
0 commit comments