Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 66688 invoked from network); 4 Oct 2003 19:25:18 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 Oct 2003 19:25:18 -0000 Received: (qmail 31791 invoked by uid 500); 4 Oct 2003 19:25:05 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 31553 invoked by uid 500); 4 Oct 2003 19:25:03 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 31536 invoked from network); 4 Oct 2003 19:25:02 -0000 Received: from unknown (HELO galen.earthdome.org) (206.152.117.245) by daedalus.apache.org with SMTP; 4 Oct 2003 19:25:02 -0000 Received: from mail.more.net (gkar.earthdome.org [192.168.1.1]) by galen.earthdome.org (Postfix) with ESMTP id 5288D13108 for ; Sat, 4 Oct 2003 14:25:07 -0500 (CDT) Message-ID: <3F7F1E91.4070603@mail.more.net> Date: Sat, 04 Oct 2003 14:25:05 -0500 From: Glenn Nielsen Organization: MOREnet User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.2.1) Gecko/20030224 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Developers List Subject: Re: [DBCP] cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp AbandonedObjectPool.java References: <20030930205029.95036.qmail@minotaur.apache.org> <3F7F1D13.5080506@mail.more.net> In-Reply-To: <3F7F1D13.5080506@mail.more.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N After seeing the subsequent commit to PoolingDataSource where the message for a NoSuchElementException added text that the pool was exhausted, this looks fine. Ignore the below. Glenn Glenn Nielsen wrote: > This patch removed to much. Only the System.out should have been removed. > The NoSuchElementException needs to be caught so that an exception with > a message which makes sense to the user is thrown. There is no way to know > what the NoSuchElementException means without diving into the code. This > is a user support issue, we need to tell the user what really happened in > this case rather than just passing on the exception. > > Regards, > > Glenn > > dirkv@apache.org wrote: > >> dirkv 2003/09/30 13:50:29 >> >> Modified: dbcp/src/java/org/apache/commons/dbcp >> AbandonedObjectPool.java >> Log: >> Bugzilla Bug 22776: DBCP should not be writing messages to stderr or >> stdout >> - Do not print error messages in borrowObject (allow exceptions to >> pass) >> Revision Changes Path >> 1.11 +17 -27 >> jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/AbandonedObjectPool.java >> >> Index: AbandonedObjectPool.java >> =================================================================== >> RCS file: >> /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/AbandonedObjectPool.java,v >> >> retrieving revision 1.10 >> retrieving revision 1.11 >> diff -u -r1.10 -r1.11 >> --- AbandonedObjectPool.java 26 Sep 2003 12:45:13 -0000 1.10 >> +++ AbandonedObjectPool.java 30 Sep 2003 20:50:29 -0000 1.11 >> @@ -61,11 +61,9 @@ >> package org.apache.commons.dbcp; >> -import java.sql.SQLException; >> import java.util.ArrayList; >> import java.util.Iterator; >> import java.util.List; >> -import java.util.NoSuchElementException; >> import org.apache.commons.pool.PoolableObjectFactory; >> import org.apache.commons.pool.impl.GenericObjectPool; >> @@ -112,30 +110,22 @@ >> * @return Object jdbc Connection >> */ >> public Object borrowObject() throws Exception { >> - try { >> - if (config != null >> - && config.getRemoveAbandoned() >> - && (getNumIdle() < 2) >> - && (getNumActive() > getMaxActive() - 3) ) { >> - removeAbandoned(); >> - } >> - Object obj = super.borrowObject(); >> - if(obj instanceof AbandonedTrace) { >> - ((AbandonedTrace)obj).setStackTrace(); >> - } >> - if (obj != null && config != null && >> config.getRemoveAbandoned()) { >> - synchronized(trace) { >> - trace.add(obj); >> - } >> + if (config != null >> + && config.getRemoveAbandoned() >> + && (getNumIdle() < 2) >> + && (getNumActive() > getMaxActive() - 3) ) { >> + removeAbandoned(); >> + } >> + Object obj = super.borrowObject(); >> + if(obj instanceof AbandonedTrace) { >> + ((AbandonedTrace)obj).setStackTrace(); >> + } >> + if (obj != null && config != null && >> config.getRemoveAbandoned()) { >> + synchronized(trace) { >> + trace.add(obj); >> } >> - return obj; >> - } catch(NoSuchElementException ne) { >> - throw new SQLException( >> - "DBCP could not obtain an idle db connection, pool >> exhausted"); >> - } catch(Exception e) { >> - System.out.println("DBCP borrowObject failed: " + >> e.getMessage()); >> - throw e; >> } >> + return obj; >> } >> /** >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >> For additional commands, e-mail: commons-dev-help@jakarta.apache.org >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-dev-help@jakarta.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org