db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r617492 - in /db/derby/code/trunk/java: client/org/apache/derby/client/ClientDataSourceFactory.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java
Date Fri, 01 Feb 2008 13:06:26 GMT
Author: kristwaa
Date: Fri Feb  1 05:06:22 2008
New Revision: 617492

URL: http://svn.apache.org/viewvc?rev=617492&view=rev
Log:
DERBY-2559: recreating a datasource using javax.naming.Reference from a ClientDataSource40
fails. Incremental commit, which enables the factory to create all Derby (client) datasources.
However, some mechanisms to avoid throwing exceptions must be added, for instance if a null
object is passed. The test that was disabled has been enabled again.
Patch file: derby-2559-1a.diff

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/ClientDataSourceFactory.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/ClientDataSourceFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/ClientDataSourceFactory.java?rev=617492&r1=617491&r2=617492&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/ClientDataSourceFactory.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/ClientDataSourceFactory.java Fri
Feb  1 05:06:22 2008
@@ -26,11 +26,6 @@
 
 import javax.naming.RefAddr;
 import javax.naming.Reference;
-import org.apache.derby.jdbc.ClientBaseDataSource;
-
-import org.apache.derby.jdbc.ClientConnectionPoolDataSource;
-import org.apache.derby.jdbc.ClientDataSource;
-import org.apache.derby.jdbc.ClientXADataSource;
 
 /**
  * The data source factory currrently for ClientDataSource only. This factory will support
XA and pooling-enabled data
@@ -81,16 +76,7 @@
         javax.naming.Reference ref = (javax.naming.Reference) refObj;
 
         // Create the proper data source object shell.
-        ClientBaseDataSource ds = null;
-        if (ref.getClassName().equals(ClientDataSource.className__)) {
-            ds = new ClientDataSource();
-        } else if (ref.getClassName().equals(ClientXADataSource.className__)) {
-            ds = new ClientXADataSource();
-        } else if (ref.getClassName().equals(ClientConnectionPoolDataSource.className__))
{
-            ds = new ClientConnectionPoolDataSource();
-        } else {
-            return null;
-        }
+        Object ds = Class.forName(ref.getClassName()).newInstance();
 
         // Fill in the data source object shell with values from the jndi reference.
         ClientDataSourceFactory.setBeanProperties(ds, ref);

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java?rev=617492&r1=617491&r2=617492&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DataSourceReferenceTest.java
Fri Feb  1 05:06:22 2008
@@ -189,11 +189,6 @@
         Object recreatedDS = 
             factory.getObjectInstance(dsAsReference, null, null, null);
         
-        // DERBY-2559 - with jdk16, this recreatedDS will be null.
-        // bailing out
-        if (JDBC.vmSupportsJDBC4())
-            return;
-        
         println(" empty DataSource recreated using Reference as " +
             recreatedDS.getClass().getName());
         // empty DataSource recreated using Reference should not be 
@@ -387,4 +382,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}



Mime
View raw message