Description
KAFKA-16345 added a new client configuration option SASL_OAUTHBEARER_HEADER_URLENCODE. This is an optional configuration, so the user doesn't need to provide it. When an AdminConfig, ConsumerConfig, or ProducerConfig object is created, it uses the default value of DEFAULT_SASL_OAUTHBEARER_HEADER_URLENCODE if the value isn't present.
However, if the configuration is created as a plain Map or Properties and the sasl.oauthbearer.header.urlencode key isn't present, it can lead to a NullPointerException. This occurs because the code in AccessTokenRetriever.create() assumes that there's always a value present in the incoming configs parameter. But if there isn't an entry for the sasl.oauthbearer.header.urlencode key in the map, a NullPointerException is thrown.
When using map-based configuration, one workaround is to explicitly add an entry to the map like so:
Map<String, Object> configs = new HashMap(); . . . configs.put(SASL_OAUTHBEARER_HEADER_URLENCODE, DEFAULT_SASL_OAUTHBEARER_HEADER_URLENCODE); . . . configureSomething(configs);
Attachments
Issue Links
- links to