Walenwein created KAFKA-12765:
---------------------------------
Summary: NPE using SASL when following JavaSpec
Key: KAFKA-12765
URL: https://issues.apache.org/jira/browse/KAFKA-12765
Project: Kafka
Issue Type: Bug
Components: clients
Affects Versions: 2.8.0, 2.6.0
Reporter: Walenwein
The Class "SaslChannelBuilder", the method "buildTransportLayer" is defined as
follows (2.6.0):
{code:java}
protected TransportLayer buildTransportLayer(String id, SelectionKey key,
SocketChannel socketChannel,
ChannelMetadataRegistry
metadataRegistry) throws IOException {
if (this.securityProtocol == SecurityProtocol.SASL_SSL) {
return SslTransportLayer.create(id, key,
sslFactory.createSslEngine(socketChannel.socket().getInetAddress().getHostName(),
socketChannel.socket().getPort()),
metadataRegistry);
} else {
return new PlaintextTransportLayer(key);
}
}{code}
When calling "getInetAddress()", the address is always available, because the
Oracle Implementation of the "SocketChannel" class sets quite early the
"remoteAddress" internally, even when the "isConnected" would return "false".
Oracle seems to have created a bug, because following the specification of Java
class "SocketChannel", the "remoteAddress" should be set internally only after
the connection has been successfully built.
Kafka follows the Oracle Implementation, NOT the java specification. Should
this not be considered as bug in kafka?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)