[Quickfix-users] Session::doTargetTooLow throws before printing onEvent msg if possDupFlag not prese
Brought to you by:
orenmnero
|
From: Brendan B. B. <br...@ka...> - 2003-07-11 22:57:55
|
Hello,
In bool Session::doTargetTooLow( const Message& msg ), is the
possDupFlag is not set, a FieldNotFound exception will be thrown on:
header.getField( possDupFlag );
This will prevent m_state.onEvent() from being called and displaying
the problem.
If one were to do a
if ( header.isSetField( possDupFlag ) ) header.getField( possDupFlag );
Then the call to BoolConvertor::convert( possDupFlag ) would throw.
Since
if ( !possDupFlag )
throw std::exception();
at the end will throw *after* the message is printed, would this be
the right fix:
bool Session::doTargetTooLow( const Message& msg )
{ QF_STACK_PUSH(Session::doTargetTooLow)
const Header & header = msg.getHeader();
MsgType msgType;
//#define ORIG 1
#if ORIG
// brendan; 7/11: onEvent Msg won't be printed if possDupFlag isn't
present in message
PossDupFlag possDupFlag(false);
#else
PossDupFlag possDupFlag();
#endif // #if ORIG
MsgSeqNum msgSeqNum;
header.getField( msgType );
#if ORIG
// brendan; 7/11: onEvent Msg won't be printed if possDupFlag isn't
present in message
if ( header.isSetField( possDupFlag ) ) header.getField( possDupFlag );
#else
header.getField( possDupFlag );
#endif // #if ORIG
header.getField( msgSeqNum );
m_state.onEvent( "MsgSeqNum too low RECEIVED: "
+ IntConvertor::convert( msgSeqNum )
+" EXPECTED: "
+ IntConvertor::convert( getExpectedTargetNum() )
+ " PosDup: " + BoolConvertor::convert( possDupFlag ) );
if ( !possDupFlag )
throw std::exception();
return doPossDup( msg );
QF_STACK_POP
}
?
Regards,
Brendan
|