Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a better error message when @RequestScoped bean is null #29773

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public <T> T getIfActive(Contextual<T> contextual, Function<Contextual<T>, Creat
// Bean instance does not exist - create one if we have CreationalContext
instance = new ContextInstanceHandleImpl<T>((InjectableBean<T>) contextual,
contextual.create(creationalContext), creationalContext);
if (!instance.isAvailable()) {
mkouba marked this conversation as resolved.
Show resolved Hide resolved
// this is an issue caused by the bean being null so let's provide a clear message instead of falling through to the misleading ContextNotActiveException
throw new IllegalStateException(String
.format("Unable to create bean instance for a client proxy of %s because the bean is null", bean));
}
ctxState.map.put(contextual, instance);
}
return instance.get();
Expand Down