diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java index 35dfd19b162cb..440a8d6f5f238 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java @@ -406,7 +406,12 @@ public InputStream getResourceAsStream(String unsanitisedName) { if (name.endsWith(".class")) { ClassPathElement[] providers = state.loadableResources.get(name); if (providers != null) { - return new ByteArrayInputStream(providers[0].getResource(name).getData()); + final ClassPathResource resource = providers[0].getResource(name); + if (resource == null) { + throw new IllegalStateException(providers[0] + " from " + getName() + " (closed=" + this.isClosed() + + ") was expected to provide " + name + " but failed"); + } + return new ByteArrayInputStream(resource.getData()); } } else { for (ClassPathElement i : elements) {