AbstractDriverBasedDataSource does not rely on Properties chaining anymore

Issue: SPR-9461
This commit is contained in:
Juergen Hoeller
2013-01-18 14:02:40 +01:00
parent 8cf61c595e
commit cd8d72e3f8

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,7 +109,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
/**
* This implementation delegates to <code>getConnectionFromDriver</code>,
* This implementation delegates to {@code getConnectionFromDriver},
* using the default username and password of this DataSource.
* @see #getConnectionFromDriver(String, String)
* @see #setUsername
@@ -120,7 +120,7 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
}
/**
* This implementation delegates to <code>getConnectionFromDriver</code>,
* This implementation delegates to {@code getConnectionFromDriver},
* using the given username and password.
* @see #getConnectionFromDriver(String, String)
*/
@@ -139,7 +139,8 @@ public abstract class AbstractDriverBasedDataSource extends AbstractDataSource {
* @see java.sql.Driver#connect(String, java.util.Properties)
*/
protected Connection getConnectionFromDriver(String username, String password) throws SQLException {
Properties props = new Properties(getConnectionProperties());
Properties props = new Properties();
props.putAll(getConnectionProperties());
if (username != null) {
props.setProperty("user", username);
}