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

Gilles Bayon reassigned IBATISNET-33:
-------------------------------------

    Assign To: Gilles Bayon

> 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

Reply via email to