-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[java producer] op.cmd may be null, cause NPE #9400
Conversation
Do have seen this problem in production ? or is it just a static analysis of code that led you to this patch ? thanks for sharing your fix |
No, just a static analysis of code that led me to this patch。 |
@@ -1518,8 +1518,7 @@ private void stripChecksum(OpSendMsg op) { | |||
headerFrame.resetReaderIndex(); | |||
} | |||
} else { | |||
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, | |||
(op.cmd == null ? null : op.cmd.getClass().getName())); | |||
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, null); |
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.
here you do not need to pass null
, you can simply write null
in the message
I left one suggestion. |
yeah,I change the title. |
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
* op.cmd may be null, cause NPE * write null in the log
check msg = op.cms == null, so use op.cmd. readableBytes() may throw NPE