[Quickfix-developers] Problem with m_validStructure field into class Message
Brought to you by:
orenmnero
From: Abel M. <abe...@gm...> - 2012-02-27 15:33:40
|
Hi all, I found a problem within class Message and setString function. If you use setString function to read a message that has some fields in wrong order (i.e. header field into body message), setString function marks the object as invalid Message.cpp:325 if ( type != header ) { if(m_field == 0) m_field = field.getField(); m_validStructure = false; } If you, using setString function again, read another message that it's correct, m_validStructure remains with its false value. Then, if you try to check validity of the message, you will obtain an exception (function validate in class DataDictionary) if( (pSessionDD !=0 && pSessionDD->m_checkFieldsOutOfOrder) || (pAppDD != 0 && pAppDD->m_checkFieldsOutOfOrder) ) { if ( !message.hasValidStructure(field) ) throw TagOutOfOrder(field); } In Message.h: bool hasValidStructure(int& field) const { field = m_field; return m_validStructure; } So you will obtain a TagOutOfOrder exception, but message is ok!! I think, in order to solve this, you just need to set m_validStructure and m_field fields at the beginning of setString function to its initial values: void Message::setString( const std::string& string, bool doValidation, const DataDictionary* pSessionDataDictionary, const DataDictionary* pApplicationDataDictionary ) throw( InvalidMessage ) { QF_STACK_PUSH(Message::setString) clear(); std::string::size_type pos = 0; int count = 0; std::string msg; static int const headerOrder[] = { FIELD::BeginString, FIELD::BodyLength, FIELD::MsgType }; field_type type = header; >m_validStructure = true >m_field = 0 while ( pos < string.size() ) ...... What do you think? Is this a valid workaround for this problem? Best regards, Abel Monroy |