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
In JsonAsyncHttpPinotClientTransportFactory, setScheme followed by withConnectionProperties may override the scheme value.
To reproduce:
publicstaticvoidmain(String[] args) throwsNoSuchFieldException, IllegalAccessException {
JsonAsyncHttpPinotClientTransportFactoryfactory = newJsonAsyncHttpPinotClientTransportFactory();
// using reflection to print the _scheme fieldfinalFieldfield = factory.getClass().getDeclaredField("_scheme");
field.setAccessible(true);
System.out.println(field.get(factory));
// prints http// OK, http is the default value of the builderfactory.setScheme("https");
System.out.println(field.get(factory));
// prints https// OK, the setter works// any set of properties that does not have a value for "scheme"factory = factory.withConnectionProperties(newProperties());
System.out.println(field.get(factory));
// prints http// NOT OK - scheme value was overridden
}
Issue:
In
JsonAsyncHttpPinotClientTransportFactory
,setScheme
followed bywithConnectionProperties
may override the scheme value.To reproduce:
Cause:
The issue was introduced in
https://github.com/apache/pinot/pull/12332/files
The bug was pointed by the reviewer. The PR was still merged somehow.
To mitigate:
Users of
JsonAsyncHttpPinotClientTransportFactory
should not use setScheme.They can set the scheme value with a Property in the meantime
To fix:
Implement the logic correctly
Option 1:
prevent null in the _scheme setter, and annotate _scheme as non null
Then
Option 2:
keep _scheme nullable (I really don't see a use case for this though)
If you're ok I can create the PR.
The text was updated successfully, but these errors were encountered: