User: oleg    
  Date: 00/11/09 05:45:27

  Modified:    src/main/org/jboss/minerva/jdbc ConnectionInPool.java
  Log:
  If the underlying Connection is null, the PreparedStatement is not returned to the 
pool anymore.
  Thanks to Rostislav Beloff for pointing out the bug.
  
  Revision  Changes    Path
  1.6       +3 -3      jboss/src/main/org/jboss/minerva/jdbc/ConnectionInPool.java
  
  Index: ConnectionInPool.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/jdbc/ConnectionInPool.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ConnectionInPool.java     2000/11/09 12:57:51     1.5
  +++ ConnectionInPool.java     2000/11/09 13:45:26     1.6
  @@ -29,7 +29,7 @@
    * outstanding statements are closed, and the connection is rolled back.  This
    * class is also used by statements, etc. to update the last used time for the
    * connection.
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class ConnectionInPool implements PooledObject, ConnectionWrapper {
  @@ -114,7 +114,7 @@
        */
       public void statementClosed(Statement st) {
           statements.remove(st);
  -        if (st instanceof PreparedStatementInPool) {
  +        if ((con != null) && (st instanceof PreparedStatementInPool)) {
               // Now return the "real" statement to the pool
               PreparedStatementInPool ps = (PreparedStatementInPool) st;
               PreparedStatement ups = ps.getUnderlyingPreparedStatement();
  @@ -139,7 +139,6 @@
        */
       public void reset() throws SQLException {
           Connection local = con;
  -        con = null;
   
           Collection copy = (Collection)statements.clone();
           Iterator it = copy.iterator();
  @@ -149,6 +148,7 @@
               } catch(SQLException e) {}
           if(!local.getAutoCommit())
               local.rollback();
  +        con = null;
       }
   
       /**
  
  
  

Reply via email to