Skip to content

Commit

Permalink
fix potential NPE and repeated conditional test (apache#5776)
Browse files Browse the repository at this point in the history
### Motivation

fix potential NPE and repeated conditional test

### Modifications

local changes
  • Loading branch information
ntysdd authored and jiazhai committed Dec 6, 2019
1 parent d74c1ac commit 3a695cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ protected void handleConnected(CommandConnected connected) {
@Override
protected void handleAuthChallenge(CommandAuthChallenge authChallenge) {
checkArgument(authChallenge.hasChallenge());
checkArgument(authChallenge.getChallenge().hasAuthData() && authChallenge.getChallenge().hasAuthData());
checkArgument(authChallenge.getChallenge().hasAuthData());

// mutual authn. If auth not complete, continue auth; if auth complete, complete connectionFuture.
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,8 @@ protected boolean verifyLocalBufferIsNotCorrupted(OpSendMsg op) {
}
return true;
} else {
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, op.cmd.getClass().getName());
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName,
(op.cmd == null ? null : op.cmd.getClass().getName()));
return false;
}
}
Expand Down Expand Up @@ -1253,7 +1254,8 @@ private void stripChecksum(OpSendMsg op) {
headerFrame.resetReaderIndex();
}
} else {
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName, op.cmd.getClass().getName());
log.warn("[{}] Failed while casting {} into ByteBufPair", producerName,
(op.cmd == null ? null : op.cmd.getClass().getName()));
}
}

Expand Down

0 comments on commit 3a695cd

Please sign in to comment.