You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by ol...@apache.org on 2012/01/25 15:07:30 UTC

svn commit: r1235748 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java

Author: oltka
Date: Wed Jan 25 14:07:30 2012
New Revision: 1235748

URL: http://svn.apache.org/viewvc?rev=1235748&view=rev
Log:
CAY-1654 Can't switch DataSource Factory on certain projects

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java?rev=1235748&r1=1235747&r2=1235748&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/configuration/server/XMLPoolingDataSourceFactory.java Wed Jan 25 14:07:30 2012
@@ -51,6 +51,7 @@ public class XMLPoolingDataSourceFactory
     public DataSource getDataSource(DataNodeDescriptor nodeDescriptor) throws Exception {
 
         DataSourceInfo dataSourceDescriptor = nodeDescriptor.getDataSourceDescriptor();
+       
 
         if (dataSourceDescriptor == null) {
             String message = "Null dataSourceDescriptor for nodeDescriptor '"
@@ -60,14 +61,19 @@ public class XMLPoolingDataSourceFactory
             throw new ConfigurationException(message);
         }
 
+        String driver = (dataSourceDescriptor.getJdbcDriver() == null)? "": dataSourceDescriptor.getJdbcDriver();
+        String dataSourceUrl = (dataSourceDescriptor.getDataSourceUrl() == null)? "": dataSourceDescriptor.getDataSourceUrl();
+        String userName = (dataSourceDescriptor.getUserName() == null)? "": dataSourceDescriptor.getUserName();
+        String password = (dataSourceDescriptor.getPassword() == null)? "": dataSourceDescriptor.getPassword();
+        
         try {
             return new PoolManager(
-                    dataSourceDescriptor.getJdbcDriver(),
-                    dataSourceDescriptor.getDataSourceUrl(),
+                    driver,
+                    dataSourceUrl,
                     dataSourceDescriptor.getMinConnections(),
                     dataSourceDescriptor.getMaxConnections(),
-                    dataSourceDescriptor.getUserName(),
-                    dataSourceDescriptor.getPassword(),
+                    userName,
+                    password,
                     jdbcEventLogger);
         }
         catch (Exception e) {