Expected/Received Length seems wrong in error message

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Expected/Received Length seems wrong in error message

Rich Holm
QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html
QuickFIX FAQ: http://www.quickfixengine.org/wikifix/index.php?QuickFixFAQ
QuickFIX Support: http://www.quickfixengine.org/services.html


Does this code look right?  I am receiving invalid messages from a FIX
engine (unrelated issue).
However, when looking at the code, it seems that this error message is
backwards.  Should
aBodyLength (actual?) be the expected length and bodyLength() be the
received length?

It looks like the checksum is incorrect too...

Cheers,
Rich


void Message::validate()
{ QF_STACK_PUSH(Message::validate)

  try
  {
    BodyLength aBodyLength;
    m_header.getField( aBodyLength );
    if ( aBodyLength != bodyLength() )
    {
      std::stringstream text;
      text << "Expected BodyLength=" << bodyLength()
           << ", Recieved BodyLength=" << (int)aBodyLength;
      throw InvalidMessage(text.str());
    }  

    CheckSum aCheckSum;
    m_trailer.getField( aCheckSum );
    if ( aCheckSum != checkSum() )
    {
      std::stringstream text;
      text << "Expected CheckSum=" << checkSum()
           << ", Recieved CheckSum=" << (int)aCheckSum;
      throw InvalidMessage(text.str());
    }
  }
  catch ( FieldNotFound& )
  {
    throw InvalidMessage("BodyLength or CheckSum missing");
  }

  QF_STACK_POP
}



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Quickfix-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quickfix-developers