Skip to content

Copy properties instead of setting as default value #128

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

rPraml
Copy link
Collaborator

@rPraml rPraml commented Apr 14, 2025

When you define

final var props = new Properties(connectionProps);
props.setProperty("user", username);
props.setProperty("password", password);

and use the Map interface, e.g. props.keySet() will return exactly user and password

Only a direct access with property.getValue("someVal") will fall through to connectionProps

Unfortunately some drivers like H2 and also MariaDB use the Map interface of Properties, which does not expose the underlying default values.

I noticed this, as some custom connection properties were not correctly applied to the driver.

So the use of Properties(defaults) can be a trap.
This PR changes all places to copy the defaults to the new object.

@rbygrave this is IMHO a low hanging fruit ;)

@rbygrave rbygrave added this to the 9.6 milestone Apr 15, 2025
@rbygrave rbygrave merged commit e497938 into ebean-orm:master Apr 15, 2025
1 check passed
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