Hello,

We recently changed our code in Eclipse to support JRE 8 when loading
classes from a Java 9 images (discussion at [1]). The change was to use a
JrtFileSystem with a class loader. The file system is then cached and
re-used for every request to get something from the JRE 9 images. The code
is something like this:

URL url = Paths.get(jdkHome, "jrt-fs.jar").toUri().toURL();
URLClassLoader loader = new URLClassLoader(new URL[] { url });
FileSystem jrt = FileSystems.newFileSystem("jrt:/", env, loader);

After this change, we have started getting an NPE in the file system (We
are randomly hitting this and at this point no idea what is causing it):

Daemon Thread [Java indexing] (Suspended (exception NullPointerException))
        ByteArrayInputStream.<init>(byte[]) line: 106
        JrtFileSystem.newByteChannel(byte[], Set<OpenOption>,
FileAttribute<?>...) line: 600
        JrtPath.newByteChannel(Set<OpenOption>, FileAttribute<?>...) line:
732
        JrtFileSystemProvider.newByteChannel(Path, Set<OpenOption>,
FileAttribute<?>...) line: 218
        Files.newByteChannel(Path, Set<OpenOption>, FileAttribute<?>...)
line: 361
        Files.newByteChannel(Path, OpenOption...) line: 407
        Files.readAllBytes(Path) line: 3152

I have confirmed that the JrtFileSystem that is used in the above stack and
what we cached are the same objects. And the path that is being passed in
the beginning is a valid JrtPath. I would like to know if this is a bug in
the file system implementation or something to do with our code.

Of course, I don't have the source for JrtFileSystem, so unable to debug
this further. Thanks for any pointers in trouble-shooting this further.

Regards,
Jay

[1]
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2015-October/004857.html

Reply via email to