Skip to content
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

fix: Accept "convertToNull" value for property "zeroDateTimeBehaviour" #413

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

crystall-bitquill
Copy link
Contributor

@crystall-bitquill crystall-bitquill commented Jun 6, 2023

Summary

Accept "convertToNull" value for property "zeroDateTimeBehaviour"

Description

Some connection properties such as zeroDateTimeBehaviour are altered in the fixHostInfo method. The zeroDateTimeBehaviour value in particular is replaced in the replaceLegacyPropertyValues method. This allows the driver to accept both upper and lowercase values. When the driver detects an AWS JDBC Driver protocol, it will create a proxy using the properties the user specified and not the corrected set. This PR will use the "fixed" properties instead.

Addresses issue #411.

Additional Reviewers

Comment on lines 229 to 235
Properties props = new Properties();
for (Map.Entry<String, String> entry : connectionUrl.getMainHost().getHostProperties().entrySet()) {
if (entry.getValue() != null) {
props.put(entry.getKey(), entry.getValue());
}
}
this.connProps.initializeProperties(props);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Properties props = new Properties();
for (Map.Entry<String, String> entry : connectionUrl.getMainHost().getHostProperties().entrySet()) {
if (entry.getValue() != null) {
props.put(entry.getKey(), entry.getValue());
}
}
this.connProps.initializeProperties(props);
final Properties props = new Properties();
props.putAll(connectionUrl.getMainHost().getHostProperties());
this.connProps.initializeProperties(props);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause a null pointer exception if one of the properties is null.

@crystall-bitquill crystall-bitquill marked this pull request as ready for review June 6, 2023 23:51
@hsuamz hsuamz changed the title Accept "convertToNull" value for property "zeroDateTimeBehaviour" fix: Accept "convertToNull" value for property "zeroDateTimeBehaviour" Jun 13, 2023
@karenc-bq karenc-bq merged commit 70292f4 into awslabs:main Jun 15, 2023
@karenc-bq karenc-bq deleted the issue-411 branch June 15, 2023 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants