diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java index d02b6cf0a8dfc..18b95b0cdbd50 100644 --- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java +++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java @@ -176,6 +176,9 @@ private ClassLoadingResource[] getClassLoadingResources(final String name) { dirName = ""; } if (!dirName.equals(name) && fullyIndexedDirectories.contains(dirName)) { + if (dirName.isEmpty()) { + return resourceDirectoryMap.get(name); + } // If we arrive here, we know that resource being queried belongs to one of the fully indexed directories // Had that resource existed however, it would have been present in directlyIndexedResourcesIndexMap return null; diff --git a/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java b/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java index 07e1106b5dc71..1928f47531c2a 100644 --- a/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java +++ b/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/java/org/acme/ClasspathResources.java @@ -1,5 +1,6 @@ package org.acme; +import javax.ws.rs.QueryParam; import org.apache.commons.io.IOUtils; import javax.ws.rs.GET; @@ -32,6 +33,7 @@ public String readClassPathResources() { () -> assertCorrectExactFileLocation(), () -> assertInvalidDirectory(), () -> assertCorrectDirectory(), + () -> assertTopLevelDirectory(), () -> assertMultiRelease() ); } @@ -160,6 +162,22 @@ private String assertCorrectDirectory() { } } + private String assertTopLevelDirectory() { + final String testType = "top-level-directory"; + try { + Enumeration directoryEnumeration = this.getClass().getClassLoader().getResources("assets"); + List directoryURLList = urlList(directoryEnumeration); + if (directoryURLList.size() != 1) { + return errorResult(testType, "wrong number of directory urls"); + } + + return SUCCESS; + } catch (Exception e) { + e.printStackTrace(); + return errorResult(testType, "exception during resolution of resource"); + } + } + private List urlList(Enumeration enumeration) { if (enumeration == null) { return Collections.emptyList(); diff --git a/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/resources/assets/test.txt b/integration-tests/maven/src/test/resources-filtered/projects/classic/src/main/resources/assets/test.txt new file mode 100644 index 0000000000000..e69de29bb2d1d