> On Nov 23, 2016, at 6:05 AM, Alan Bateman <alan.bate...@oracle.com> wrote: > > > > On 22/11/2016 21:07, Mandy Chung wrote: >> This patch moves src.zip and jrt-fs.jar from the top-level into >> the `lib` directory in the run-time image as we proposed [1]. >> >> Webrev: >> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8169816/webrev.00/ >> >> > This looks good. A minor point in SystemImage.findHome is that it's probably > an InternalError if we are somehow loaded from a jrt-fs.jar that is not in > the lib directory.
Agree. The existing check if non “file” URL should also throw InternalError instead. Fixed. @@ -113,12 +113,16 @@ if (cs == null) return System.getProperty("java.home"); - // assume loaded from $TARGETJDK/jrt-fs.jar + // assume loaded from $TARGETJDK/lib/jrt-fs.jar URL url = cs.getLocation(); if (!url.getProtocol().equalsIgnoreCase("file")) - throw new RuntimeException(url + " loaded in unexpected way"); + throw new InternalError(url + " loaded in unexpected way"); try { - return Paths.get(url.toURI()).getParent().toString(); + Path lib = Paths.get(url.toURI()).getParent(); + if (!lib.getFileName().toString().equals("lib")) + throw new InternalError(url + " unexpected path"); + + return lib.getParent().toString(); } catch (URISyntaxException e) { throw new InternalError(e); } Mandy