commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwaldh...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter ConnectionImpl.java
Date Fri, 07 Mar 2003 00:24:09 GMT
rwaldhoff    2003/03/06 16:24:09

  Modified:    dbcp     build.properties.sample project.xml build.xml
               dbcp/src/test/org/apache/commons/dbcp/jdbc2pool
                        TestJdbc2PoolDataSource.java
               dbcp/src/java/org/apache/commons/dbcp/jdbc2pool
                        Jdbc2PoolDataSource.java UserPassKey.java
                        PoolKey.java
               dbcp/src/java/org/apache/commons/dbcp/cpdsadapter
                        ConnectionImpl.java
  Log:
  remove dependency on lang (equals, deserialize)
  
  Revision  Changes    Path
  1.7       +0 -3      jakarta-commons/dbcp/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/build.properties.sample,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- build.properties.sample	5 Mar 2003 23:39:34 -0000	1.6
  +++ build.properties.sample	7 Mar 2003 00:24:08 -0000	1.7
  @@ -2,9 +2,6 @@
   base.path=/usr/local
   commons-collections.home=${base.path}/commons-collections-2.0
   commons-collections.jar=${commons-collections.home}/commons-collections.jar
  -# commons-lang.jar - Commons-Lang Classpath
  -commons-lang.home=${basedir}/../../jakarta-commons-sandbox/lang/dist
  -commons-lang.jar=${commons-lang.home}/commons-lang-1.0-b1.jar
   # commons-pool.jar - Commons-Pool Classpath
   commons-pool.home=${base.path}/commons-pool-1.0
   commons-pool.jar=${commons-pool.home}/commons-pool.jar
  
  
  
  1.9       +0 -5      jakarta-commons/dbcp/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/project.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- project.xml	6 Mar 2003 22:53:51 -0000	1.8
  +++ project.xml	7 Mar 2003 00:24:08 -0000	1.9
  @@ -94,11 +94,6 @@
       </dependency>
   
       <dependency>
  -      <id>commons-lang</id>
  -      <version>1.0-b1</version>
  -    </dependency>
  -    
  -    <dependency>
         <id>commons-pool</id>
         <version>SNAPSHOT</version>
       </dependency>
  
  
  
  1.20      +2 -2      jakarta-commons/dbcp/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/build.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- build.xml	6 Mar 2003 00:11:33 -0000	1.19
  +++ build.xml	7 Mar 2003 00:24:08 -0000	1.20
  @@ -42,7 +42,7 @@
         <property name="cp" value=""/>
   
         <!-- now combine the classpaths -->
  -      <property name="classpath" value="${cp}:${commons-pool.jar}:${commons-collections.jar}:${jdbc20ext.jar}:${junit.jar}:${jndi.jar}:${commons-lang.jar}:${sax2.jar}"/>
  +      <property name="classpath" value="${cp}:${commons-pool.jar}:${commons-collections.jar}:${jdbc20ext.jar}:${junit.jar}:${jndi.jar}:${sax2.jar}"/>
   
         <property name="name" value="commons-dbcp"/>
         <property name="Name" value="Commons-DBCP"/>
  
  
  
  1.6       +8 -6      jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java
  
  Index: TestJdbc2PoolDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/test/org/apache/commons/dbcp/jdbc2pool/TestJdbc2PoolDataSource.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestJdbc2PoolDataSource.java	6 Mar 2003 21:41:47 -0000	1.5
  +++ TestJdbc2PoolDataSource.java	7 Mar 2003 00:24:09 -0000	1.6
  @@ -67,12 +67,12 @@
   import java.sql.SQLException;
   
   import javax.sql.DataSource;
  +
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
   import org.apache.commons.dbcp.TestConnectionPool;
   import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
  -import org.apache.commons.lang.exception.NestableRuntimeException;
   
   /**
    * @author John McNally
  @@ -401,8 +401,10 @@
                       rset.close();
                       stmt.close();
                       conn.close();
  +                } catch (RuntimeException e) {
  +                    throw e;
                   } catch (Exception e) {
  -                    throw new NestableRuntimeException(e);
  +                    throw new RuntimeException(e.toString());
                   }
               }
           }
  
  
  
  1.9       +21 -10    jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/Jdbc2PoolDataSource.java
  
  Index: Jdbc2PoolDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/Jdbc2PoolDataSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Jdbc2PoolDataSource.java	6 Mar 2003 18:13:37 -0000	1.8
  +++ Jdbc2PoolDataSource.java	7 Mar 2003 00:24:09 -0000	1.9
  @@ -54,8 +54,10 @@
    * <http://www.apache.org/>.
    */
    
  +import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  +import java.io.ObjectInputStream;
   import java.io.ObjectOutputStream;
   import java.io.PrintWriter;
   import java.io.Serializable;
  @@ -84,8 +86,6 @@
   
   import org.apache.commons.collections.FastHashMap;
   import org.apache.commons.collections.LRUMap;
  -import org.apache.commons.lang.SerializationUtils;
  -import org.apache.commons.lang.ObjectUtils;
   import org.apache.commons.pool.KeyedObjectPool;
   import org.apache.commons.pool.ObjectPool;
   import org.apache.commons.pool.impl.GenericKeyedObjectPool;
  @@ -1117,7 +1117,7 @@
                   throw new SQLException(e.getMessage());
               }
           }
  -        if (!ObjectUtils.equals(password, info.getPassword())) 
  +        if(!(null == password ? null == info.getPassword() : password.equals(info.getPassword())))
           {
               closeDueToException(info);
               throw new SQLException("Given password did not match password used "
  @@ -1601,7 +1601,7 @@
                   {
                       byte[] serialized = (byte[])ra.getContent();
                       jndiEnvironment = 
  -                        (Properties)SerializationUtils.deserialize(serialized);
  +                        (Properties)deserialize(serialized);
                   }
                   
                   ra = ref.get("loginTimeout");
  @@ -1616,7 +1616,7 @@
                   {
                       byte[] serialized = (byte[])ra.getContent();
                       perUserDefaultAutoCommit = 
  -                        (Map)SerializationUtils.deserialize(serialized);
  +                        (Map)deserialize(serialized);
                   }
                   
                   ra = ref.get("perUserMaxActive");
  @@ -1624,7 +1624,7 @@
                   {
                       byte[] serialized = (byte[])ra.getContent();
                       perUserMaxActive = 
  -                        (Map)SerializationUtils.deserialize(serialized);
  +                        (Map)deserialize(serialized);
                   }
   
                   ra = ref.get("perUserMaxIdle");
  @@ -1632,7 +1632,7 @@
                   {
                       byte[] serialized = (byte[])ra.getContent();
                       perUserMaxIdle = 
  -                        (Map)SerializationUtils.deserialize(serialized);
  +                        (Map)deserialize(serialized);
                   }
   
                   ra = ref.get("perUserMaxWait");
  @@ -1640,7 +1640,7 @@
                   {
                       byte[] serialized = (byte[])ra.getContent();
                       perUserMaxWait = 
  -                        (Map)SerializationUtils.deserialize(serialized);
  +                        (Map)deserialize(serialized);
                   }
                   
                   ra = ref.get("perUserDefaultReadOnly");
  @@ -1648,7 +1648,7 @@
                   {
                       byte[] serialized = (byte[])ra.getContent();
                       perUserDefaultReadOnly = 
  -                        (Map)SerializationUtils.deserialize(serialized);
  +                        (Map)deserialize(serialized);
                   }
                   
                   ra = ref.get("testOnBorrow");
  @@ -1705,4 +1705,15 @@
           
           return ds;
       }
  +
  +    private final Object deserialize(byte[] data) throws Exception {
  +        ObjectInputStream in = null;
  +        try {
  +            in = new ObjectInputStream(new ByteArrayInputStream(data));
  +            return in.readObject();
  +        } finally {
  +            try { in.close(); } catch (IOException ex) {}
  +        }
  +    }
  +
   }
  
  
  
  1.3       +6 -6      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/UserPassKey.java
  
  Index: UserPassKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/UserPassKey.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UserPassKey.java	16 Nov 2002 19:18:27 -0000	1.2
  +++ UserPassKey.java	7 Mar 2003 00:24:09 -0000	1.3
  @@ -55,7 +55,6 @@
    */
    
   import java.io.Serializable;
  -import org.apache.commons.lang.ObjectUtils;
   
   class UserPassKey
       implements Serializable
  @@ -89,14 +88,15 @@
       
       public boolean equals(Object obj)
       {
  -        boolean equal = false;
           if ( obj instanceof UserPassKey ) 
           {
               UserPassKey upk = (UserPassKey)obj;
  -            equal = ObjectUtils.equals(upk.username, username);
  -        }            
  -
  -        return equal;
  +            return null == username ? null == upk.username : username.equals(upk.username);
  +        }
  +        else 
  +        {
  +            return false;            
  +        }
       }
   
       public int hashCode()
  
  
  
  1.3       +8 -9      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/PoolKey.java
  
  Index: PoolKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/jdbc2pool/PoolKey.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PoolKey.java	16 Nov 2002 19:18:27 -0000	1.2
  +++ PoolKey.java	7 Mar 2003 00:24:09 -0000	1.3
  @@ -1,5 +1,3 @@
  -package org.apache.commons.dbcp.jdbc2pool;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -53,9 +51,9 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +package org.apache.commons.dbcp.jdbc2pool;
    
   import java.io.Serializable;
  -import org.apache.commons.lang.ObjectUtils;
   
   class PoolKey
       implements Serializable
  @@ -90,15 +88,16 @@
       
       public boolean equals(Object obj)
       {
  -        boolean equal = false;
           if ( obj instanceof PoolKey ) 
           {
               PoolKey pk = (PoolKey)obj;
  -            equal = ObjectUtils.equals(pk.datasourceName, datasourceName);
  -            equal &= ObjectUtils.equals(pk.username, username);
  -        }            
  -
  -        return equal;
  +            return (null == datasourceName ? null == pk.datasourceName : datasourceName.equals(pk.datasourceName))
&&
  +                (null == username ? null == pk.username : username.equals(pk.username));
  +        } 
  +        else
  +        {
  +            return false;   
  +        }
       }
   
       public int hashCode()
  
  
  
  1.4       +2 -3      jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/ConnectionImpl.java
  
  Index: ConnectionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/cpdsadapter/ConnectionImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ConnectionImpl.java	6 Mar 2003 00:04:58 -0000	1.3
  +++ ConnectionImpl.java	7 Mar 2003 00:24:09 -0000	1.4
  @@ -1,5 +1,3 @@
  -package org.apache.commons.dbcp.cpdsadapter;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -53,6 +51,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +package org.apache.commons.dbcp.cpdsadapter;
   
   import java.util.Map;
   import java.sql.Connection;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message