You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/07/30 19:21:25 UTC
[commons-dbcp] branch master updated: No need for null check.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
The following commit(s) were added to refs/heads/master by this push:
new 66ac91c No need for null check.
66ac91c is described below
commit 66ac91c60cc45825b3d3a10eb83c404e5bc88a76
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 30 15:21:20 2019 -0400
No need for null check.
---
.../commons/dbcp2/ConnectionFactoryFactory.java | 26 ++++++++++------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/commons/dbcp2/ConnectionFactoryFactory.java b/src/main/java/org/apache/commons/dbcp2/ConnectionFactoryFactory.java
index 5d635bb..394549c 100644
--- a/src/main/java/org/apache/commons/dbcp2/ConnectionFactoryFactory.java
+++ b/src/main/java/org/apache/commons/dbcp2/ConnectionFactoryFactory.java
@@ -56,20 +56,18 @@ class ConnectionFactoryFactory {
} else {
basicDataSource.log("DBCP DataSource configured without a 'password'");
}
- if (basicDataSource != null) {
- final String connectionFactoryClassName = basicDataSource.getConnectionFactoryClassName();
- if (connectionFactoryClassName != null) {
- try {
- final Class<?> connectionFactoryFromCCL = Class.forName(connectionFactoryClassName);
- return (ConnectionFactory) connectionFactoryFromCCL
- .getConstructor(Driver.class, String.class, Properties.class)
- .newInstance(driver, url, connectionProperties);
- } catch (final Exception t) {
- final String message = "Cannot load ConnectionFactory implementation '" + connectionFactoryClassName
- + "'";
- basicDataSource.log(message, t);
- throw new SQLException(message, t);
- }
+ final String connectionFactoryClassName = basicDataSource.getConnectionFactoryClassName();
+ if (connectionFactoryClassName != null) {
+ try {
+ final Class<?> connectionFactoryFromCCL = Class.forName(connectionFactoryClassName);
+ return (ConnectionFactory) connectionFactoryFromCCL
+ .getConstructor(Driver.class, String.class, Properties.class)
+ .newInstance(driver, url, connectionProperties);
+ } catch (final Exception t) {
+ final String message = "Cannot load ConnectionFactory implementation '" + connectionFactoryClassName
+ + "'";
+ basicDataSource.log(message, t);
+ throw new SQLException(message, t);
}
}
// Defaults to DriverConnectionFactory