I modified this a bit but the code gives better error messages now.

john mcnally

On Thu, 2002-06-13 at 12:52, Stephen Haberman wrote:
> I was (am :-) having issues with my DataSourceFactory configuration and
> had been getting just NullPointerExceptions. After a few minutes of
> tracing it down, this patch gives the user a nice error message in the
> logs instead of a NullPointerException off in
> BasePeer.rollbackConnection (if passed a null connection, BasePeer would
> still try to roll it back).
> 
> This is not an essential patch, but it's still a good idea to check for
> the null values, right?
> 
> Thanks,
> Stephen 
> 
> ----
> 

> Index: src/java/org/apache/torque/util/BasePeer.java
> ===================================================================
> RCS file: 
>/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java,v
> retrieving revision 1.44
> diff -r1.44 BasePeer.java
> 421a422,426
> >         if (con == null)
> >         {
> >             return;
> >         }
> > 
> 
> Index: src/java/org/apache/torque/Torque.java
> ===================================================================
> RCS file: 
>/home/cvspublic/jakarta-turbine-torque/src/java/org/apache/torque/Torque.java,v
> retrieving revision 1.61
> diff -r1.61 Torque.java
> 822a829,832
> >             if (dsf == null)
> >             {
> >                 throw new TorqueException("There was no DataSourceFactory 
>configured for the connection " + name);
> >             }
> ----
> 

> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to