Skip to content
Open
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 @@ -42,6 +42,7 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.nio.channels.UnresolvedAddressException;
import java.security.cert.CertPathValidatorException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -619,6 +620,10 @@ void pollSelectionKeys(Set<SelectionKey> selectionKeys,
String exceptionMessage = e.getMessage();
if (e instanceof DelayedResponseAuthenticationException)
exceptionMessage = e.getCause().getMessage();
CertPathValidatorException certPathValidatorException = maybeGetCertPathValidatorException(e);
if (certPathValidatorException != null) {
exceptionMessage += "; certificate validation failed with reason " + certPathValidatorException.getReason();
}
log.info("Failed {}authentication with {} ({})", isReauthentication ? "re-" : "",
desc, exceptionMessage);
} else {
Expand All @@ -635,6 +640,14 @@ void pollSelectionKeys(Set<SelectionKey> selectionKeys,
}
}

private CertPathValidatorException maybeGetCertPathValidatorException(Throwable throwable) {
Throwable current = throwable;
while (current != null && !(current instanceof CertPathValidatorException)) {
current = current.getCause();
}
return (CertPathValidatorException) current;
}

private void attemptWrite(SelectionKey key, KafkaChannel channel, long nowNanos) throws IOException {
if (channel.hasSend()
&& channel.ready()
Expand Down