Skip to content

Commit

Permalink
Throw an IllegalStateException with basic info about the provider tha…
Browse files Browse the repository at this point in the history
…t failed to provide a resource
  • Loading branch information
aloubyansky committed Jan 7, 2023
1 parent e47a267 commit a9827a8
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a9827a8

Please sign in to comment.