commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r170363 - /jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Date Mon, 16 May 2005 11:34:06 GMT
Author: dirkv
Date: Mon May 16 04:34:06 2005
New Revision: 170363

URL: http://svn.apache.org/viewcvs?rev=170363&view=rev
Log:
ASF Bugzilla Bug 34296 [pool] Potential pool leak if _factory.makeObject() throws a Throwable

catch Throwable in call to factory.makeObject();

Modified:
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=170363&r1=170362&r2=170363&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Mon May 16 04:34:06 2005
@@ -826,13 +826,19 @@
                     pair = new ObjectTimestampPair(obj);
                     newlyCreated = true;
                 }
-                catch (Exception e) {
+                catch (Throwable e) {
                     // object cannot be created
                     synchronized(this) {
                         _numActive--;
                         notifyAll();
                     }
-                    throw e;
+                    if (e instanceof Exception) {
+                        throw (Exception) e;
+                    } else if (e instanceof Error) {
+                        throw (Error) e;
+                    } else {
+                        throw new Exception(e);
+                    }
                 }
             }
 
@@ -844,7 +850,7 @@
                 }                
                 return pair.value;
             } 
-            catch (Exception e) {
+            catch (Throwable e) {
                 // object cannot be activated or is invalid
                 synchronized(this) {
                     _numActive--;
@@ -853,7 +859,7 @@
                 try {
                     _factory.destroyObject(pair.value);
                 } 
-                catch (Exception e2) {
+                catch (Throwable e2) {
                     // cannot destroy broken object 
                 }
                 if(newlyCreated) {



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