Skip to content

FILE_READ from JAR on classpath results in file of length 0 #3395

@dlwildschut

Description

@dlwildschut

Since 1.4.193 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions