You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org> on 2005/04/13 22:30:16 UTC

[jira] Closed: (IBATISNET-33) SimpleDaoSession's OpenConnection method missing "else" statement

     [ http://issues.apache.org/jira/browse/IBATISNET-33?page=history ]
     
Gilles Bayon closed IBATISNET-33:
---------------------------------

    Resolution: Fixed

Moved logging but not as suggested

> SimpleDaoSession's OpenConnection method missing "else" statement
> -----------------------------------------------------------------
>
>          Key: IBATISNET-33
>          URL: http://issues.apache.org/jira/browse/IBATISNET-33
>      Project: iBatis for .NET
>         Type: Improvement
>     Versions: DataAccess 1.5
>  Environment: [assembly: AssemblyVersion("1.5.458")]
>     Reporter: Ron Grabowski
>     Assignee: Gilles Bayon
>     Priority: Trivial

>
> The OpenConnection method looks something like this:
> if (_logger.IsDebugEnabled)
> {
>  _logger.Debug("Open Connection");
> }
> if (_connection == null)
> {
>  // code...
> }
> else if (_connection.State != ConnectionState.Open)
> {
>  // code...
> }
> If the "if" and "else if" statements fails, an incorrect message will be written to the log file. Perhaps a third "else" statement can be added:
> if (_connection == null)
> {
>  if (_logger.IsDebugEnabled)
>  {
>   _logger.Debug("Open Connection");
>  }
>  // code...
> }
> else if (_connection.State != ConnectionState.Open)
> {
>  if (_logger.IsDebugEnabled)
>  {
>   _logger.Debug("Open Connection");
>  }
>  // code...
> }
> else
> {
>  // if this isn't suppose to happen, throw an exception...
>  if (_logger.IsDebugEnabled)
>  {
>   _logger.Debug("Re-using Connection [" + _connection.GetHashCode() + "].");
>  }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira