commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp BasicDataSource.java
Date Mon, 27 May 2002 13:15:43 GMT
glenn       02/05/27 06:15:43

  Modified:    dbcp/src/java/org/apache/commons/dbcp BasicDataSource.java
  Log:
  Add some null pointer tests and better error messages
  
  Revision  Changes    Path
  1.9       +17 -7     jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java
  
  Index: BasicDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BasicDataSource.java	21 May 2002 11:57:14 -0000	1.8
  +++ BasicDataSource.java	27 May 2002 13:15:43 -0000	1.9
  @@ -1,6 +1,6 @@
  -/** $Header: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
1.8 2002/05/21 11:57:14 glenn Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/05/21 11:57:14 $
  +/** $Header: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
1.9 2002/05/27 13:15:43 glenn Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/05/27 13:15:43 $
    *
    * ====================================================================
    *
  @@ -81,7 +81,7 @@
    *
    * @author Glenn L. Nielsen
    * @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2002/05/21 11:57:14 $
  + * @version $Revision: 1.9 $ $Date: 2002/05/27 13:15:43 $
    */
   
   public class BasicDataSource implements DataSource {
  @@ -535,7 +535,7 @@
               driver = DriverManager.getDriver(url);
           } catch (Throwable t) {
               String message = "Cannot create JDBC driver of class '" +
  -                driverClassName + "'";
  +                driverClassName + "' for connect URL '" + url + "'";
               logWriter.println(message);
               t.printStackTrace(logWriter);
               throw new SQLException(message);
  @@ -548,8 +548,18 @@
           connectionPool.setMaxWait(maxWait);
   
           // Set up the driver connection factory we will use
  -        connectionProperties.put("user", username);
  -        connectionProperties.put("password", password);
  +        if (username != null) {
  +            connectionProperties.put("user", username);
  +        } else {
  +            System.out.println(
  +                "DBCP DataSource configured without a 'username'");
  +        }
  +        if (password != null) {
  +            connectionProperties.put("password", password);
  +        } else {
  +            System.out.println(
  +                "DBCP DataSource configured without a 'password'");
  +        }
           DriverConnectionFactory driverConnectionFactory =
               new DriverConnectionFactory(driver, url, connectionProperties);
   
  
  
  

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


Mime
View raw message