Skip to content

Avoid NPE from ContextSelector.getContext() when "entry=null" is passed #1538

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

Merged
merged 1 commit into from
Jul 6, 2023
Merged
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 @@ -108,7 +108,7 @@ default LoggerContext getContext(String fqcn, ClassLoader loader, Map.Entry<Stri
default LoggerContext getContext(String fqcn, ClassLoader loader, Map.Entry<String, Object> entry,
boolean currentContext, URI configLocation) {
final LoggerContext lc = getContext(fqcn, loader, currentContext, configLocation);
if (lc != null) {
if (lc != null && entry != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lc should be not null here, we just need to check if entry is not null.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since getContext() is to be implemented by the subclass, I thought we cannot have such an assumption. Nevertheless, if you think otherwise, be my guest to update it.

lc.putObject(entry.getKey(), entry.getValue());
}
return lc;
Expand Down