You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in the way the class SchemaRegistryConfig handles null values for String properties. This exists on multiple properties but was found while setting the SslKeystoreLocation property. The default value of this property is null, but if you try to set the property to null, it throws a NullReferenceException. After decompiling the code, it appears that the underlying logic was written with the intention of supporting null values, but the values are mishandled.
Here is the code for this property:
public string SslKeystoreLocation
{
get
{
return Get("schema.registry.ssl.keystore.location");
}
set
{
SetObject("schema.registry.ssl.keystore.location", value.ToString());
}
}
It is obvious from the logic in SetObject() that support for null values was planned for. Unfortunately, when calling SetObject() the property setter does a value.ToString() which throws the NullReferenceException.
This can be fixed by either 1) adding a null conditional operator to the .ToString() call (i.e. value?.ToString(), or 2) removing the .ToString() entirely. I'm not sure what the purpose is since the value is already a String.
How to reproduce
Executing the following code... anywhere... in any way... throws the exception:
new SchemaRegistryConfig() {
SslKeystoreLocation = null
}
This issue seems to exist in all versions of this file. Based on the change history.
This issue seems to exist for some properties of type String, but not all. As of the latest version of this file in the repo at the time of this writing, this includes SslCaLocation, SslKeystoreLocation, and SslKeystorePassword, but not Url and BasicAuthUserInfo.
Checklist
Please provide the following information:
A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
Confluent.Kafka nuget version.
Apache Kafka version. (Not applicable)
Client configuration.
Operating system. (Not applicable)
Provide logs (with "debug" : "..." as necessary in configuration). (Not applicable)
Provide broker log excerpts. (Not applicable)
Critical issue.
The text was updated successfully, but these errors were encountered:
Description
There is a bug in the way the class
SchemaRegistryConfig
handles null values forString
properties. This exists on multiple properties but was found while setting theSslKeystoreLocation
property. The default value of this property is null, but if you try to set the property to null, it throws aNullReferenceException
. After decompiling the code, it appears that the underlying logic was written with the intention of supporting null values, but the values are mishandled.Here is the code for this property:
And here is the code for the
SetObject()
method:It is obvious from the logic in
SetObject()
that support for null values was planned for. Unfortunately, when callingSetObject()
the property setter does avalue.ToString()
which throws theNullReferenceException
.This can be fixed by either 1) adding a null conditional operator to the
.ToString()
call (i.e.value?.ToString()
, or 2) removing the.ToString()
entirely. I'm not sure what the purpose is since the value is already aString
.How to reproduce
Executing the following code... anywhere... in any way... throws the exception:
Here is a Dotnet Fiddle: https://dotnetfiddle.net/4US6Zf
This issue seems to exist in all versions of this file. Based on the change history.
This issue seems to exist for some properties of type
String
, but not all. As of the latest version of this file in the repo at the time of this writing, this includesSslCaLocation
,SslKeystoreLocation
, andSslKeystorePassword
, but notUrl
andBasicAuthUserInfo
.Checklist
Please provide the following information:
The text was updated successfully, but these errors were encountered: