tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1828068 - /tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java
Date Fri, 30 Mar 2018 15:09:16 GMT
Author: remm
Date: Fri Mar 30 15:09:16 2018
New Revision: 1828068

URL: http://svn.apache.org/viewvc?rev=1828068&view=rev
Log:
Avoid changing the static createDataSource method as it seems valid to call it from user code.

Modified:
    tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java

Modified: tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java?rev=1828068&r1=1828067&r2=1828068&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSourceFactory.java Fri Mar 30
15:09:16 2018
@@ -272,7 +272,7 @@ public class BasicDataSourceFactory impl
             }
         }
 
-        return createDataSource(properties);
+        return createDataSourceInstance(properties);
     }
 
     /**
@@ -335,7 +335,20 @@ public class BasicDataSourceFactory impl
      * @return the data source instance
      * @throws Exception if an error occurs creating the data source
      */
-    public BasicDataSource createDataSource(final Properties properties) throws Exception
{
+    public static BasicDataSource createDataSource(final Properties properties) throws Exception
{
+        return (new BasicDataSourceFactory()).createDataSourceInstance(properties);
+    }
+
+    /**
+     * Creates and configures a {@link BasicDataSource} instance based on the
+     * given properties.
+     * Note: duplicates the static createDataSource to avoid an API change
+     *
+     * @param properties the datasource configuration properties
+     * @return the data source instance
+     * @throws Exception if an error occurs creating the data source
+     */
+    public BasicDataSource createDataSourceInstance(final Properties properties) throws Exception
{
         final BasicDataSource dataSource = new BasicDataSource();
         configureDataSource(dataSource, properties);
         return dataSource;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message