-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user-agent parameter to config #5
Conversation
@@ -75,6 +90,13 @@ protected JdbcInputConnection newConnection(PluginTask task) throws SQLException | |||
props.put("ConnSchema", t.getSchemaName().get()); | |||
} | |||
props.putAll(t.getOptions()); | |||
// overwrite UserAgentEntry property if the same property is set in options | |||
if (t.getUserAgentEntry() != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.getUserAgentEntry
always seems to be not null.
You might want to delete this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current code did not guarantee the behavior of 2 below, so changed condition.
- 1: options is not set & user-agent is not set => unknown/0.0.0
- 2: options is set & user-agent is not set => value of options
- 3: options is not set & user-agent is set => value of user-agent
- 4: options is set, user-agent is set => value of user-agent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have decided to always overwrite the UserAgentEntry value in options by user-agent, so please ignore the above comment. I removed condition as you commented.
String product_name = t.getUserAgentEntry().getProductName(); | ||
String product_version = t.getUserAgentEntry().getProductVersion(); | ||
|
||
props.put("UserAgentEntry", product_name + "/" + product_version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java's variable names are usually camel case.
product_name -> productName
product_version -> productVersion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
overview
add optional user-agent parameter