commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r170362 - /jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
Date Mon, 16 May 2005 11:18:32 GMT
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message