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/jdbc2pool Jdbc2PoolDataSource.java
Date Mon, 11 Aug 2003 23:30:37 GMT
dirkv       2003/08/11 16:30:37

  Modified:    dbcp/src/java/org/apache/commons/dbcp/jdbc2pool
                        Jdbc2PoolDataSource.java
  Log:
  fix NPE in getNumIdle & getNumActive when then given user hasn't connected yet
  
  Revision  Changes    Path
  1.16      +9 -1      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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Jdbc2PoolDataSource.java	11 Aug 2003 16:02:10 -0000	1.15
  +++ Jdbc2PoolDataSource.java	11 Aug 2003 23:30:37 -0000	1.16
  @@ -899,6 +899,10 @@
           PoolKey key = getPoolKey(username);
   
           Object pool = ((Map) dsInstanceMap.get(instanceKey)).get(key);
  +        
  +        if (pool == null) {
  +            return 0;
  +        }
   
           if (pool instanceof ObjectPool) {
               return ((ObjectPool) pool).getNumActive();
  @@ -921,6 +925,10 @@
           PoolKey key = getPoolKey(username);
   
           Object pool = ((Map) dsInstanceMap.get(instanceKey)).get(key);
  +
  +        if (pool == null) {
  +            return 0;
  +        }
   
           if (pool instanceof ObjectPool) {
               return ((ObjectPool) pool).getNumIdle();
  
  
  

Mime
View raw message