commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp DataSourceConnectionFactory.java DriverConnectionFactory.java DriverManagerConnectionFactory.java PoolingConnection.java
Date Mon, 11 Aug 2003 14:49:33 GMT
dirkv       2003/08/11 07:49:33

  Modified:    dbcp/src/java/org/apache/commons/dbcp
                        DataSourceConnectionFactory.java
                        DriverConnectionFactory.java
                        DriverManagerConnectionFactory.java
                        PoolingConnection.java
  Log:
  No need to throw DbcpException the interface allows a checked Exception
  
  Revision  Changes    Path
  1.3       +9 -13     jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DataSourceConnectionFactory.java
  
  Index: DataSourceConnectionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DataSourceConnectionFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DataSourceConnectionFactory.java	20 Jul 2002 22:55:34 -0000	1.2
  +++ DataSourceConnectionFactory.java	11 Aug 2003 14:49:33 -0000	1.3
  @@ -82,15 +82,11 @@
           _passwd = passwd;
       }
   
  -    public Connection createConnection() {
  -        try {
  -            if(null == _uname && null == _passwd) {
  -                return _source.getConnection();
  -            } else {
  -                return _source.getConnection(_uname,_passwd);
  -            }
  -        } catch(SQLException e) {
  -            throw new DbcpException(e);
  +    public Connection createConnection() throws SQLException {
  +        if(null == _uname && null == _passwd) {
  +            return _source.getConnection();
  +        } else {
  +            return _source.getConnection(_uname,_passwd);
           }
       }
   
  
  
  
  1.3       +6 -10     jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DriverConnectionFactory.java
  
  Index: DriverConnectionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DriverConnectionFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DriverConnectionFactory.java	20 Jul 2002 22:55:34 -0000	1.2
  +++ DriverConnectionFactory.java	11 Aug 2003 14:49:33 -0000	1.3
  @@ -78,12 +78,8 @@
           _props = props;
       }
   
  -    public Connection createConnection() {
  -        try {
  -            return _driver.connect(_connectUri,_props);
  -        } catch(SQLException e) {
  -            throw new DbcpException(e);
  -        }
  +    public Connection createConnection() throws SQLException {
  +        return _driver.connect(_connectUri,_props);
       }
   
       protected Driver _driver = null;
  
  
  
  1.4       +11 -15    jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DriverManagerConnectionFactory.java
  
  Index: DriverManagerConnectionFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/DriverManagerConnectionFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DriverManagerConnectionFactory.java	20 Jul 2002 22:55:34 -0000	1.3
  +++ DriverManagerConnectionFactory.java	11 Aug 2003 14:49:33 -0000	1.4
  @@ -86,19 +86,15 @@
           _passwd = passwd;
       }
   
  -    public Connection createConnection() {
  -        try {
  -            if(null == _props) {
  -                if((_uname == null) || (_passwd == null)) {
  -                    return DriverManager.getConnection(_connectUri);
  -                } else {
  -                    return DriverManager.getConnection(_connectUri,_uname,_passwd);
  -                }
  +    public Connection createConnection() throws SQLException {
  +        if(null == _props) {
  +            if((_uname == null) || (_passwd == null)) {
  +                return DriverManager.getConnection(_connectUri);
               } else {
  -                return DriverManager.getConnection(_connectUri,_props);
  +                return DriverManager.getConnection(_connectUri,_uname,_passwd);
               }
  -        } catch(SQLException e) {
  -            throw new DbcpException(e);
  +        } else {
  +            return DriverManager.getConnection(_connectUri,_props);
           }
       }
   
  
  
  
  1.5       +12 -16    jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolingConnection.java
  
  Index: PoolingConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/PoolingConnection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PoolingConnection.java	2 Apr 2003 00:48:49 -0000	1.4
  +++ PoolingConnection.java	11 Aug 2003 14:49:33 -0000	1.5
  @@ -174,21 +174,17 @@
        * {@link PreparedStatement}s.
        * @param obj the key for the {@link PreparedStatement} to be created
        */
  -    public Object makeObject(Object obj) {
  -        try {
  -            if(null == obj || !(obj instanceof PStmtKey)) {
  -                throw new IllegalArgumentException();
  +    public Object makeObject(Object obj) throws Exception {
  +        if(null == obj || !(obj instanceof PStmtKey)) {
  +            throw new IllegalArgumentException();
  +        } else {
  +            // _openPstmts++;
  +            PStmtKey key = (PStmtKey)obj;
  +            if(null == key._resultSetType && null == key._resultSetConcurrency)
{
  +                return new PoolablePreparedStatement(getDelegate().prepareStatement(key._sql),key,_pstmtPool,this);
               } else {
  -                // _openPstmts++;
  -                PStmtKey key = (PStmtKey)obj;
  -                if(null == key._resultSetType && null == key._resultSetConcurrency)
{
  -                    return new PoolablePreparedStatement(getDelegate().prepareStatement(key._sql),key,_pstmtPool,this);
  -                } else {
  -                    return new PoolablePreparedStatement(getDelegate().prepareStatement(key._sql,key._resultSetType.intValue(),key._resultSetConcurrency.intValue()),key,_pstmtPool,this);
  -                }
  +                return new PoolablePreparedStatement(getDelegate().prepareStatement(key._sql,key._resultSetType.intValue(),key._resultSetConcurrency.intValue()),key,_pstmtPool,this);
               }
  -        } catch(Exception e) {
  -            throw new DbcpException(e);
           }
       }
   
  
  
  

Mime
View raw message