Skip to content

ClassLoader can't solve directories on Graal binary #1108

@mageddo

Description

@mageddo

Context

I'm using embedded flyway to automatically migrate my database scripts and it solves directories on classpath to load sql files

What is expected

java.lang.ClassLoader#getResources(String) returns the URL for the specified directory

What is happening

java.lang.ClassLoader#getResources(String) returns an empty Enumeration

Steps to reproduce

Here an example project reproducing the issue

App.java

public static void main(String[] args) throws Exception {
	System.out.println(getResources("folder/subfolder"));
	System.out.println(getResources("folder/subfolder/resource-001.txt"));
}

public static List<URL> getResources(String name) throws IOException {
	final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
	return Collections.list(classLoader.getResources(name));
}
$ ./gradlew clean build nativeImage && ./build/graal/resources-resolution
[]
[resource:folder/subfolder/resource-001.txt]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions