db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/sequence SequenceManagerNativeImpl.java SequenceManagerStoredProcedureImpl.java
Date Tue, 25 May 2004 08:15:54 GMT
Hi Brian,

the stmt in both classes can be 'null', e.g. if something failed on call of
broker.serviceStatementManager().getGenericStatement
getBrokerForClass().serviceConnectionManager().getConnection().createStatement()

so in the finally block it will cause an NPE (if we don't check) which 
will mask the real exception.
Or I'm wrong?

regards,
Armin

brianm@apache.org wrote:

> brianm      2004/05/23 09:38:37
> 
>   Modified:    src/java/org/apache/ojb/broker/util/sequence
>                         SequenceManagerNativeImpl.java
>                         SequenceManagerStoredProcedureImpl.java
>   Log:
>   Better exception handling and error reporting patch submitted by Robert Sfeir.
>   Submitted by:	Robert Sfeir
>   
>   Revision  Changes    Path
>   1.17      +4 -2      db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNativeImpl.java
>   
>   Index: SequenceManagerNativeImpl.java
>   ===================================================================
>   RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNativeImpl.java,v
>   retrieving revision 1.16
>   retrieving revision 1.17
>   diff -u -r1.16 -r1.17
>   --- SequenceManagerNativeImpl.java	22 May 2004 10:03:02 -0000	1.16
>   +++ SequenceManagerNativeImpl.java	23 May 2004 16:38:37 -0000	1.17
>   @@ -238,10 +238,12 @@
>                {
>                    try
>                    {
>   -                    if (stmt != null) stmt.close();
>   +                    stmt.close();
>                    }
>                    catch (SQLException e)
>                    {
>   +                    if(log.isDebugEnabled())
>   +                        log.debug("Threw SQLException while in getLastInsert and closing
stmt" , e);
>                        // ignore it
>                    }
>                }
>   
>   
>   
>   1.10      +5 -3      db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java
>   
>   Index: SequenceManagerStoredProcedureImpl.java
>   ===================================================================
>   RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerStoredProcedureImpl.java,v
>   retrieving revision 1.9
>   retrieving revision 1.10
>   diff -u -r1.9 -r1.10
>   --- SequenceManagerStoredProcedureImpl.java	22 May 2004 10:03:02 -0000	1.9
>   +++ SequenceManagerStoredProcedureImpl.java	23 May 2004 16:38:37 -0000	1.10
>   @@ -293,10 +293,12 @@
>            {
>                try
>                {
>   -                if (stmt != null) stmt.close();
>   +                stmt.close();
>                }
>   -            catch (SQLException ignore)
>   +            catch (SQLException sqle)
>                {
>   +                if(log.isDebugEnabled())
>   +                    log.debug("Threw SQLException while in createSequence and closing
stmt", sqle);
>                    // ignore it
>                }
>            }
>   
>   
>   
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message