-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix Nginx Collect validateParams function NPE #1442
Fix Nginx Collect validateParams function NPE #1442
Conversation
Signed-off-by: Clownsw <[email protected]>
Why did the previous one report a null pointer? I saw that nginxProtocol==null was used to determine first, so I don't think it will be reported. Perhaps I don't quite understand, and I would like to ask for your clarification |
NginxProtocol nginxProtocol = metrics.getNginx(); // Here metrics have been used, So the following judgment has no effect
if (metrics == null || nginxProtocol == null || nginxProtocol.isInValid()) { |
use old code test: Metrics metrics = null;
NginxProtocol nginxProtocol = metrics.getNginx(); // NPE
if (metrics == null || nginxProtocol == null || nginxProtocol.isInValid()) {} |
use new code test: Metrics metrics = null;
final NginxProtocol nginxProtocol;
if (metrics == null || (nginxProtocol = metrics.getNginx()) == null || nginxProtocol.isInValid()) {}
// Success |
I see, I didn't notice that. Thank you for pointing it out!LGTM! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
Signed-off-by: Clownsw <[email protected]>
What's changed?
Fix Nginx Collect validateParams function NPE
Checklist