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/datasources InstanceKeyDataSource.java
Date Fri, 26 Dec 2003 13:17:33 GMT
dirkv       2003/12/26 05:17:33

  Modified:    dbcp/src/java/org/apache/commons/dbcp/datasources
                        InstanceKeyDataSource.java
  Log:
  Bugzilla Bug 25762:	SharedPoolDataSource getConnection() throws ClassCastException
  - improve error message for illegal configuration as described in this issue
  
  Revision  Changes    Path
  1.9       +12 -4     jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java
  
  Index: InstanceKeyDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- InstanceKeyDataSource.java	13 Oct 2003 05:29:36 -0000	1.8
  +++ InstanceKeyDataSource.java	26 Dec 2003 13:17:33 -0000	1.9
  @@ -735,7 +735,15 @@
               } else {
                   ctx = new InitialContext(jndiEnvironment);
               }
  -            cpds = (ConnectionPoolDataSource) ctx.lookup(dataSourceName);
  +            Object ds = ctx.lookup(dataSourceName);
  +            if (ds instanceof ConnectionPoolDataSource) {
  +                cpds = (ConnectionPoolDataSource) ds;
  +            } else {
  +                throw new SQLException("Illegal configuration: "
  +                    + "DataSource " + dataSourceName
  +                    + " (" + ds.getClass().getName() + ")"
  +                    + " doesn't implement javax.sql.ConnectionPoolDataSource");
  +            }
           }
           
           // try to get a connection with the supplied username/password
  
  
  

---------------------------------------------------------------------
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