[jboss-cvs] JBossAS SVN: r57373 - in branches/JBoss_4_0_4_GA_CP: connector/src/main/org/jboss/resource/adapter/jdbc testsuite/src/main/org/jboss/test/jca/ejb testsuite/src/main/org/jboss/test/jca/interfaces testsuite/src/main/org/jboss/test/jca/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 2 22:20:47 EDT 2006


Author: ryan.campbell at jboss.com
Date: 2006-10-02 22:20:46 -0400 (Mon, 02 Oct 2006)
New Revision: 57373

Modified:
   branches/JBoss_4_0_4_GA_CP/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java
   branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/ejb/JDBCStatementTestsConnectionSessionBean.java
   branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSession.java
   branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSessionLocal.java
   branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/test/JDBCStatementTestsConnectionUnitTestCase.java
Log:
ASPATCH-60: JBAS-3351: JBAS-3258 Patch for JBoss 4.0.4.GA: Closing an already closed Statement should not throw an SQLException.

Modified: branches/JBoss_4_0_4_GA_CP/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java	2006-10-03 02:02:19 UTC (rev 57372)
+++ branches/JBoss_4_0_4_GA_CP/connector/src/main/org/jboss/resource/adapter/jdbc/WrappedStatement.java	2006-10-03 02:20:46 UTC (rev 57373)
@@ -37,6 +37,7 @@
  *
  * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
  * @author <a href="mailto:adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="weston.price at jboss.com">Weston Price</a> 
  * @version $Revision$
  */
 public class WrappedStatement implements Statement, StatementAccess,
@@ -66,7 +67,8 @@
       synchronized (lock)
       {
          if (closed)
-            throw new SQLException("Already closed");
+            return;
+         
          closed = true;
       }
       lc.unregisterStatement(this);

Modified: branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/ejb/JDBCStatementTestsConnectionSessionBean.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/ejb/JDBCStatementTestsConnectionSessionBean.java	2006-10-03 02:02:19 UTC (rev 57372)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/ejb/JDBCStatementTestsConnectionSessionBean.java	2006-10-03 02:20:46 UTC (rev 57373)
@@ -41,6 +41,7 @@
  *
  * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
  * @author <a href="mailto:adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version $Revision$
  *
  * @ejb:bean   name="JDBCStatementTestsConnectionSession"
@@ -273,7 +274,36 @@
          throw new EJBException(e);
       }
    }
+   
+   public void testClosingClosedConnection() 
+   {
+      try
+      {
+         DataSource ds = (DataSource) new InitialContext().lookup("java:StatementTestsConnectionDS");
+         Connection c = null;
+         try 
+         {
+            c = ds.getConnection();
+            Statement s = c.createStatement();
+            s.close();
+            s.close();            
+         }
+         finally 
+         {
+            c.close();
+         }         
+      }
+      catch (SQLException e) 
+      {
+         throw new EJBException(e);
+      }
+      catch (NamingException e)
+      {
+         throw new EJBException(e);
+      }
+   }
 
+
    public void ejbCreate()
    {
    }

Modified: branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSession.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSession.java	2006-10-03 02:02:19 UTC (rev 57372)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSession.java	2006-10-03 02:20:46 UTC (rev 57373)
@@ -38,5 +38,7 @@
    public void testTransactionQueryTimeoutMarkedRollback() throws java.rmi.RemoteException;
 
    public void testLazyAutoCommit() throws java.rmi.RemoteException;
+   
+   public void testClosingClosedConnection() throws java.rmi.RemoteException;
 
 }

Modified: branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSessionLocal.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSessionLocal.java	2006-10-03 02:02:19 UTC (rev 57372)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/interfaces/JDBCStatementTestsConnectionSessionLocal.java	2006-10-03 02:20:46 UTC (rev 57373)
@@ -39,4 +39,5 @@
 
    public void testLazyAutoCommit();
 
+   public void testClosingClosedConnection();
 }

Modified: branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/test/JDBCStatementTestsConnectionUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/test/JDBCStatementTestsConnectionUnitTestCase.java	2006-10-03 02:02:19 UTC (rev 57372)
+++ branches/JBoss_4_0_4_GA_CP/testsuite/src/main/org/jboss/test/jca/test/JDBCStatementTestsConnectionUnitTestCase.java	2006-10-03 02:20:46 UTC (rev 57373)
@@ -33,6 +33,7 @@
  * Created: Fri Feb 14 15:15:47 2003
  *
  * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version
  */
 
@@ -96,5 +97,13 @@
       JDBCStatementTestsConnectionSession s = home.create();
       s.testLazyAutoCommit();
    }
+   
+   public void testClosingClosedConnection() throws Exception
+   {
+      JDBCStatementTestsConnectionSessionHome home =
+         (JDBCStatementTestsConnectionSessionHome)getInitialContext().lookup("JDBCStatementTestsConnectionSession");
+      JDBCStatementTestsConnectionSession s = home.create();
+      s.testClosingClosedConnection();      
+   }
 
 }




More information about the jboss-cvs-commits mailing list