NHibernate.Engine.QueryParameters.ValidateParameters doesn't do anything.

Description

The ternary conditional operators in ValidateParameters is coded incorrectly and thus does nothing. The ternary is "test" ? "true" : "false", but what is coded is the opposite; the != null should be a == null.

public void ValidateParameters()
{
int typesLength = PositionalParameterTypes != null ? 0 : PositionalParameterTypes.Length;
int valuesLength = PositionalParameterValues != null ? 0 : PositionalParameterValues.Length;

if( typesLength != valuesLength )
{
throw new QueryException( "Number of positional parameter types (" + typesLength + ") does not match number of positional parameter values (" + valuesLength + ")" );
}
}

SHOULD BE:

public void ValidateParameters()
{
int typesLength = PositionalParameterTypes == null ? 0 : PositionalParameterTypes.Length;
int valuesLength = PositionalParameterValues == null ? 0 : PositionalParameterValues.Length;

if( typesLength != valuesLength )
{
throw new QueryException( "Number of positional parameter types (" + typesLength + ") does not match number of positional parameter values (" + valuesLength + ")" );
}
}

Environment

None

Activity

Show:

MikeM 
May 7, 2005 at 8:21 AM

deployed with 0.8

Former user 
April 27, 2005 at 2:05 AM

Fixed in CVS, thanks!

Fixed

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 26, 2005 at 10:37 AM
Updated May 7, 2005 at 8:21 AM
Resolved April 27, 2005 at 2:05 AM
Who's Looking?