You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2010/06/14 14:25:45 UTC

svn commit: r954426 - in /db/derby/code/branches/10.5: ./ java/client/org/apache/derby/client/ClientXAConnection.java java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java

Author: kristwaa
Date: Mon Jun 14 12:25:44 2010
New Revision: 954426

URL: http://svn.apache.org/viewvc?rev=954426&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.5/   (props changed)
    db/derby/code/branches/10.5/java/client/org/apache/derby/client/ClientXAConnection.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jun 14 12:25:44 2010
@@ -1 +1 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,835286,881074,881444,882732,884163,887246,892912,897161,901165,901648,901760,903108,908418,911315,915733,916075,916897,918359,921028,927430,946794,948045,948069
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,835286,881074,881444,882732,884163,887246,892912,897161,901165,901648,901760,903108,908418,911315,915733,916075,916897,918359,921028,927430,946794,948045,948069,951346

Modified: db/derby/code/branches/10.5/java/client/org/apache/derby/client/ClientXAConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/client/org/apache/derby/client/ClientXAConnection.java?rev=954426&r1=954425&r2=954426&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/client/org/apache/derby/client/ClientXAConnection.java (original)
+++ db/derby/code/branches/10.5/java/client/org/apache/derby/client/ClientXAConnection.java Mon Jun 14 12:25:44 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.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java?rev=954426&r1=954425&r2=954426&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java (original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/J2EEDataSourceTest.java Mon Jun 14 12:25:44 2010
@@ -1828,12 +1828,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);
         }