You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by ab...@apache.org on 2019/06/07 12:45:09 UTC
[cayenne] branch STABLE-4.1 updated: CAY-2573 DI field injection is
triggered when creating sql Driver
This is an automated email from the ASF dual-hosted git repository.
abulatski pushed a commit to branch STABLE-4.1
in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/STABLE-4.1 by this push:
new 9b82228 CAY-2573 DI field injection is triggered when creating sql Driver
9b82228 is described below
commit 9b82228b8b973528a03980b828493b48a9475bc9
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Sat May 4 18:00:42 2019 +0300
CAY-2573 DI field injection is triggered when creating sql Driver
(cherry picked from commit 91992935b9de28f9b5739b0b763b90520675c77e)
---
RELEASE-NOTES.txt | 9 +++++++++
.../dbsync/reverse/configuration/DriverDataSourceFactory.java | 5 ++---
.../cayenne/configuration/server/PropertyDataSourceFactory.java | 2 +-
.../configuration/server/XMLPoolingDataSourceFactory.java | 2 +-
4 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 287eb19..ff31d46 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -8,6 +8,15 @@ To browse individual bug reports check out project issue tracker:
https://issues.apache.org/jira/browse/CAY
----------------------------------
+Release: 4.1.B3
+Date:
+----------------------------------
+
+Bug Fixes:
+
+CAY-2573 DI field injection is triggered when creating sql Driver
+
+----------------------------------
Release: 4.1.B2
Date: May 4, 2019
----------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
index d24f367..2f67124 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/configuration/DriverDataSourceFactory.java
@@ -19,9 +19,8 @@
package org.apache.cayenne.dbsync.reverse.configuration;
-import java.sql.Driver;
-
import javax.sql.DataSource;
+import java.sql.Driver;
import org.apache.cayenne.configuration.DataNodeDescriptor;
import org.apache.cayenne.configuration.server.DataSourceFactory;
@@ -47,7 +46,7 @@ public class DriverDataSourceFactory implements DataSourceFactory {
throw new IllegalArgumentException("'nodeDescriptor' contains no datasource descriptor");
}
- Driver driver = objectFactory.newInstance(Driver.class, properties.getJdbcDriver());
+ Driver driver = (Driver)objectFactory.getJavaClass(properties.getJdbcDriver()).newInstance();
return new DriverDataSource(driver, properties.getDataSourceUrl(), properties.getUserName(),
properties.getPassword());
}
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
index d3fc1ac..365e875 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/PropertyDataSourceFactory.java
@@ -71,7 +71,7 @@ public class PropertyDataSourceFactory implements DataSourceFactory {
UnmanagedPoolingDataSource.MAX_QUEUE_WAIT_DEFAULT);
String validationQuery = properties.get(Constants.JDBC_VALIDATION_QUERY_PROPERTY);
- Driver driver = objectFactory.newInstance(Driver.class, driverClass);
+ Driver driver = (Driver)objectFactory.getJavaClass(driverClass).newInstance();
return DataSourceBuilder.url(url).driver(driver).userName(username).password(password)
.pool(minConnections, maxConnections).maxQueueWaitTime(maxQueueWaitTime)
.validationQuery(validationQuery).build();
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
index e99d78d..d0d07af 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
@@ -67,7 +67,7 @@ public class XMLPoolingDataSourceFactory implements DataSourceFactory {
long maxQueueWaitTime = properties.getLong(Constants.JDBC_MAX_QUEUE_WAIT_TIME,
UnmanagedPoolingDataSource.MAX_QUEUE_WAIT_DEFAULT);
- Driver driver = objectFactory.newInstance(Driver.class, descriptor.getJdbcDriver());
+ Driver driver = (Driver)objectFactory.getJavaClass(descriptor.getJdbcDriver()).newInstance();
return DataSourceBuilder.url(descriptor.getDataSourceUrl()).driver(driver).userName(descriptor.getUserName())
.password(descriptor.getPassword())