-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Reading a resource from a JAR file on the classpath results in a 0 length read.
As as simple test, with a maven project using a H2 in-memory database, if you execute:
SELECT LENGTH(FILE_READ('classpath:/org/h2/store/fs/FileUtils.class')) LEN
The result is 0.
The fix for issue #446 unfortunately doesn't work if the resource URL resolves to something like
jar:file:/.../.m2/repository/com/h2database/h2/2.1.210/h2-2.1.210.jar!/org/h2/store/fs/FileUtils.class
size() in FilePathDisk.java line 68 tries to apply Paths.get to the resolved URL.
This fails with a java.nio.file.FileSystemNotFoundException and then returns 0, which results in 0 bytes being read from the resource.
This is a reopen of #3395 and this is not the same thing as #1702 which 3395 was marked as a duplicate of.
This happens when trying to load a classpath resource that is in a jar, due to the fact that the java Zip filesystem for that specific JAR is not initialized.