Skip to content

Commit f3d0beb

Browse files
committed
AbstractDriverBasedDataSource does not rely on Properties chaining anymore
Issue: SPR-9461
1 parent 245c61e commit f3d0beb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

org.springframework.jdbc/src/main/java/org/springframework/jdbc/datasource/AbstractDriverBasedDataSource.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,18 @@ public Connection getConnection(String username, String password) throws SQLExce
139139
* @see java.sql.Driver#connect(String, java.util.Properties)
140140
*/
141141
protected Connection getConnectionFromDriver(String username, String password) throws SQLException {
142-
Properties props = new Properties();
143-
props.putAll(getConnectionProperties());
142+
Properties mergedProps = new Properties();
143+
Properties connProps = getConnectionProperties();
144+
if (connProps != null) {
145+
mergedProps.putAll(connProps);
146+
}
144147
if (username != null) {
145-
props.setProperty("user", username);
148+
mergedProps.setProperty("user", username);
146149
}
147150
if (password != null) {
148-
props.setProperty("password", password);
151+
mergedProps.setProperty("password", password);
149152
}
150-
return getConnectionFromDriver(props);
153+
return getConnectionFromDriver(mergedProps);
151154
}
152155

153156
/**

0 commit comments

Comments
 (0)