# HG changeset patch # User sundar # Date 1467019506 -19800 # Node ID 61d7981116d9e130ac2c75b0b1d9f2088f25dea4 # Parent 8379e9719ad669ccf3eab3a7f12ac00e9f8f084f 8157936: Files.size(Path p) returns 0 if path is from JrtFileSystem with exploded build Reviewed-by: psandoz diff -r 8379e9719ad6 -r 61d7981116d9 jdk/src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java --- a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java Fri Jun 24 14:19:29 2016 -0400 +++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/ExplodedImage.java Mon Jun 27 14:55:06 2016 +0530 @@ -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 @@ } return children; } + + @Override + public long size() { + try { + return isDirectory() ? 0 : Files.size(path); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + } } @Override diff -r 8379e9719ad6 -r 61d7981116d9 jdk/test/jdk/internal/jrtfs/Basic.java --- a/jdk/test/jdk/internal/jrtfs/Basic.java Fri Jun 24 14:19:29 2016 -0400 +++ b/jdk/test/jdk/internal/jrtfs/Basic.java Mon Jun 27 14:55:06 2016 +0530 @@ -715,5 +715,14 @@ 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); + } }