svn commit: r170362 - /jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r170362 - /jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java

dirkv
Author: dirkv
Date: Mon May 16 04:18:31 2005
New Revision: 170362

URL: http://svn.apache.org/viewcvs?rev=170362&view=rev
Log:
ASF Bugzilla Bug 34935 [pool] changes the borrowObject method so it advoids catching an exception
- patch by Sandy McArthur

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

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java?rev=170362&r1=170361&r2=170362&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java (original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java Mon May 16 04:18:31 2005
@@ -16,7 +16,6 @@
 
 package org.apache.commons.pool.impl;
 
-import java.util.EmptyStackException;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 import java.util.Stack;
@@ -123,9 +122,9 @@
     public synchronized Object borrowObject() throws Exception {
         assertOpen();
         Object obj = null;
-        try {
+        if (!_pool.empty()) {
             obj = _pool.pop();
-        } catch(EmptyStackException e) {
+        } else {
             if(null == _factory) {
                 throw new NoSuchElementException();
             } else {



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]