8157936: Files.size(Path p) returns 0 if path is from JrtFileSystem with exploded build
Reviewed-by: psandoz
This commit is contained in:
parent
c8180eb253
commit
7886baafa8
jdk
@ -25,6 +25,7 @@
|
||||
package jdk.internal.jrtfs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.FileSystem;
|
||||
import java.nio.file.FileSystemException;
|
||||
@ -138,6 +139,15 @@ class ExplodedImage extends SystemImage {
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long size() {
|
||||
try {
|
||||
return isDirectory() ? 0 : Files.size(path);
|
||||
} catch (IOException ex) {
|
||||
throw new UncheckedIOException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -715,5 +715,14 @@ public class Basic {
|
||||
assertTrue(childCount != 0);
|
||||
assertEquals(dirPrefixOkayCount, childCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void objectClassSizeTest() throws Exception {
|
||||
String path = "/modules/java.base/java/lang/Object.class";
|
||||
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
|
||||
Path classFile = fs.getPath(path);
|
||||
|
||||
assertTrue(Files.size(classFile) > 0L);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user