db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r954425 - in /db/derby/code/branches/10.6: ./ java/client/org/apache/derby/client/ClientXAConnection.java java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java
Date Mon, 14 Jun 2010 12:24:40 GMT
Author: kristwaa
Date: Mon Jun 14 12:24:39 2010
New Revision: 954425

URL: http://svn.apache.org/viewvc?rev=954425&view=rev
Log:
DERBY-2532: Client does not return SQLException on XAConnection.getXAResource() on a closed
connection, Embedded does

Merged fix from trunk (revision 951346).

Modified:
    db/derby/code/branches/10.6/   (props changed)
    db/derby/code/branches/10.6/java/client/org/apache/derby/client/ClientXAConnection.java
    db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java

Propchange: db/derby/code/branches/10.6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 12:24:39 2010
@@ -1 +1 @@
-/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,944152,946794,948045,948069,952138
+/db/derby/code/trunk:938547,938796,938959,939231,940462,940469,941627,942031,944152,946794,948045,948069,951346,952138

Modified: db/derby/code/branches/10.6/java/client/org/apache/derby/client/ClientXAConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/client/org/apache/derby/client/ClientXAConnection.java?rev=954425&r1=954424&r2=954425&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/client/org/apache/derby/client/ClientXAConnection.java
(original)
+++ db/derby/code/branches/10.6/java/client/org/apache/derby/client/ClientXAConnection.java
Mon Jun 14 12:24:39 2010
@@ -25,10 +25,12 @@ import java.sql.SQLException;
 import javax.sql.XAConnection;
 import javax.transaction.xa.XAResource;
 
+import org.apache.derby.client.am.ClientMessageId;
 import org.apache.derby.client.am.SqlException;
 import org.apache.derby.client.net.NetLogWriter;
 import org.apache.derby.client.net.NetXAConnection;
 import org.apache.derby.jdbc.ClientXADataSource;
+import org.apache.derby.shared.common.reference.SQLState;
 
 public class ClientXAConnection extends ClientPooledConnection implements XAConnection {
     private static int rmIdSeed_ = 95688932; // semi-random starting value for rmId
@@ -85,7 +87,12 @@ public class ClientXAConnection extends 
         if (logWriter_ != null) {
             logWriter_.traceExit(this, "getXAResource", xares_);
         }
-
+        // DERBY-2532
+        if (super.physicalConnection_ == null) {
+            throw new SqlException(logWriter_,
+                    new ClientMessageId(SQLState.NO_CURRENT_CONNECTION)
+                ).getSQLException();
+        }
         return xares_;
     }
 

Modified: db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java?rev=954425&r1=954424&r2=954425&view=diff
==============================================================================
--- db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java
(original)
+++ db/derby/code/branches/10.6/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java
Mon Jun 14 12:24:39 2010
@@ -1855,12 +1855,9 @@ public class J2EEDataSourceTest extends 
 
         // test methods against a closed XAConnection and its resource
         try {
+            // (DERBY-2532)
             xac2.getXAResource();
-            // DERBY-2532
-            // Network Server does not think this is worth an exception.
-            if (usingEmbedded())
-                fail("expected SQLException on " +
-                    "closed XAConnection.getXAResource");
+            fail("expected SQLException on closed XAConnection.getXAResource");
         } catch (SQLException sqle) {
             assertSQLState("08003", sqle);
         }



Mime
View raw message