Skip to content

Commit e497938

Browse files
authored
Merge pull request #128 from FOCONIS/fix-use-of-properties
Copy properties instead of setting as default value
2 parents 74978ae + c072f0a commit e497938

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ebean-datasource-api/src/main/java/io/ebean/datasource/DataSourceConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public DataSourceConfig copy() {
140140
copy.customProperties = new LinkedHashMap<>(customProperties);
141141
}
142142
if (clientInfo != null) {
143-
copy.clientInfo = new Properties(clientInfo);
143+
copy.clientInfo = new Properties();
144+
copy.clientInfo.putAll(clientInfo);
144145
}
145146
copy.initSql = initSql;
146147
copy.alert = alert;

ebean-datasource/src/main/java/io/ebean/datasource/pool/DriverDataSource.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ static DataSource of(String name, DataSourceBuilder.Settings builder) {
4242

4343
@Override
4444
public Connection getConnection(String username, String password) throws SQLException {
45-
final var props = new Properties(connectionProps);
45+
final var props = new Properties();
46+
props.putAll(connectionProps);
4647
props.setProperty("user", username);
4748
props.setProperty("password", password);
4849
return driver.connect(url, props);
@@ -67,7 +68,8 @@ public Connection getConnection() throws SQLException {
6768
}
6869

6970
private Connection switchCredentials(Properties properties) throws SQLException {
70-
var copy = new Properties(properties);
71+
var copy = new Properties();
72+
copy.putAll(properties);
7173
copy.setProperty("password", password2);
7274
var connection = driver.connect(url, copy);
7375
// success, permanently switch to use password2 from now on

0 commit comments

Comments
 (0)