db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Sfeir <rob...@codepuccino.com>
Subject Re: cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer ConnectionFactoryPooledImpl.java
Date Tue, 25 May 2004 12:16:52 GMT
We shouldn't be catching exception, that's just nasty.

What should be done is that we need to simplify the try catch block in  
this case, and just do a check to see if either rs or stmt are null and  
just not do anything if either is null.  That won't throw NPE, but just  
catching Exception and not doing anything about it is just bad, since  
you won't know if there is another problem.  If I missed the if(stmt !=  
null) sorry, was not my intent, might have been going too fast for my  
own good.

R

On May 25, 2004, at 7:23 AM, Brian McCallister wrote:

> Changed back to follow original intention (left debugs in =)
>
> -Brian
>
> On May 25, 2004, at 4:00 AM, Armin Waibel wrote:
>
>> Hi Brian,
>>
>> the leading thought for this construct was to guarantee to do a  
>> stmt.close call, no matter what happens when the rset.close call is  
>> done (critical is stmt.close). E.g stmt was used two or more times  
>> (this is allowed), then the rset can be closed automatic and maybe  
>> throw an exception on additional close calls (e.g. when wrapped  
>> classes are used), but the stmt is still open.
>> A far-fetched scenario?
>>
>> regards,
>> Armin
>>
>> brianm@apache.org wrote:
>>> brianm      2004/05/23 09:19:34
>>>   Modified:    src/java/org/apache/ojb/broker/accesslayer
>>>                         ConnectionFactoryPooledImpl.java
>>>   Log:
>>>   Better reporting on sql problems, patch submitted by Robert Sfeir
>>>     Submitted by: Robert Sfeir
>>>     Revision  Changes    Path
>>>   1.12      +3 -10      
>>> db-ojb/src/java/org/apache/ojb/broker/accesslayer/ 
>>> ConnectionFactoryPooledImpl.java
>>>     Index: ConnectionFactoryPooledImpl.java
>>>   ===================================================================
>>>   RCS file:  
>>> /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ 
>>> ConnectionFactoryPooledImpl.java,v
>>>   retrieving revision 1.11
>>>   retrieving revision 1.12
>>>   diff -u -r1.11 -r1.12
>>>   --- ConnectionFactoryPooledImpl.java	22 May 2004 09:51:26  
>>> -0000	1.11
>>>   +++ ConnectionFactoryPooledImpl.java	23 May 2004 16:19:34  
>>> -0000	1.12
>>>   @@ -208,18 +208,11 @@
>>>                    try
>>>                    {
>>>                        rset.close();
>>>   -                }
>>>   -                catch (Exception t)
>>>   -                {
>>>   -                    // ignored
>>>   -                }
>>>   -                try
>>>   -                {
>>>                        stmt.close();
>>>                    }
>>>   -                catch (Exception t)
>>>   +                catch (SQLException t)
>>>                    {
>>>   -                    // ignored
>>>   +                    log.error("Either the statement or resultSet  
>>> were already closed.", t);
>>>                    }
>>>                }
>>>            }
>>>        
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
Robert S. Sfeir
Technical Lead
HHS Portal
robert_sfeir@sra.com


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message