Re: [Quickfix-developers] Field validation problems
Brought to you by:
orenmnero
|
From: Djalma R. d. S. F. <drs...@gm...> - 2007-01-19 18:06:06
|
Hi Andrei,
For fields inside repeating groups, the current QF implementation does not
make this kind of validation that you're expecting.
Thus, your application should be aware and handle this kind of exception to
avoid crashing.
But, following are some changes that I made to the
DataDictionary::iterate(...) method to achieve the result expected and
receive the Reject message reporting the validation failure.
8=3D
FIX.4.4=019=3D229=0135=3DD=0134=3D2=0149=3DP-MEARECLION-KMT=0152=3D20070119=
-17:36:04.730=0156=3DExecutor1=0111=3D8CAEF67868D248628722FCA1B4731A52=0121=
=3D3=0122=3D4=0138=3D100=0140=3D2=0144=3D2700=0148=3DBFMRB3600102=0154=3D1=
=0155=3DA18J07=0160=3D20060830-16:06:39=01453=3D1=01448=3DP-MEARECLION-KMT=
=01447=3DAARS=01452=3D12=0110=3D001=01
8=3D
FIX.4.4=019=3D128=0135=3D3=0134=3D2=0149=3DExecutor1=0152=3D20070119-17:36:=
04.730=0156=3DP-MEARECLION-KMT=0145=3D2=0158=3DIncorrectdata
format for value=01371=3D447=01372=3DD=01373=3D6=0110=3D222=01
// New method signature
void iterate( const FieldMap& map, const MsgType& msgType, bool IsGroup =3D
false );
// implementation
void DataDictionary::iterate( const FieldMap& map, const MsgType& msgType,
bool IsGroup )
{ QF_STACK_PUSH(DataDictionary::iterate)
int lastField =3D 0;
FieldMap::iterator i;
for ( i =3D map.begin(); i !=3D map.end(); ++i )
{
const FieldBase& field =3D i->second;
if( i !=3D map.begin() && (field.getField() =3D=3D lastField) )
throw RepeatedTag( lastField );
checkHasValue( field );
if ( m_hasVersion )
{
checkValidFormat( field );
checkValue( field );
}
if ( m_beginString.getValue().length() && shouldCheckTag(field) )
{
checkValidTagNumber( field );
if ( !Message::isHeaderField( field, this )
&& !Message::isTrailerField( field, this ) )
{
if (!IsGroup) // workaround
checkIsInMessage( field, msgType );
checkGroupCount( field, map, msgType );
}
}
lastField =3D field.getField();
}
// iterate through nested repeating groups
FIX::FieldMap::g_const_iterator g_it =3D map.g_begin();
for(; g_it !=3D map.g_end(); ++g_it)
{
const std::vector<FIX::FieldMap*> & fmvector =3D g_it->second;
std::vector<FIX::FieldMap*>::const_iterator fmvec_it =3D
fmvector.begin();
for (; fmvec_it !=3D fmvector.end(); ++fmvec_it)
iterate(**fmvec_it,msgType,true);
}
QF_STACK_POP
}
I had to make the workaround because DataDictionary::m_messageFields is not
loaded with fields in the Groups; this is another more complicated problem,
I hope someone else will solve it in the future.
Regards,
Djalma
On 1/16/07, Andrei Goldchleger <an...@gm...> wrote:
>
> QuickFIX Documentation:
> http://www.quickfixengine.org/quickfix/doc/html/index.html
> QuickFIX Support: http://www.quickfixengine.org/services.html
>
> Hi there,
>
> I sent a message to a QuickFIX application which contained field
> PartyIDSource(447) with an incorrect value: It should be a char, but
> instead contained a string value. The message got through QuickFIX
> validation and caused the application to crash. The following message
> depicts the problem:
>
> 8=3D
> FIX.4.4|9=3D233|35=3DD|34=3D82|49=3DP-MEARECLION-KMT|52=3D20060830-19:06:=
39.468|56=3DFIXGatewayTI|11=3D8CAEF67868D248628722FCA1B4731A52|21=3D3|22=3D=
4|38=3D100|40=3D2|44=3D2700|48=3DBFMRB3600102|54=3D1|55=3DA18J07|60=3D20060=
830-16:06:39|453=3D1|448=3DP-MEARECLION-KMT|447=3DAARS|452=3D12|10=3D004|
>
> Using QF 1.12.4 via the .NET wrapper:
>
>
> if (partiesGroup.isSetPartyIDSource())
> {
> partyIDSource =3D partiesGroup.getPartyIDSource
> ().getValue().ToString();
> }
>
>
> We get the following exception:
>
> Source: quickfix_net
> StackTrace: at _CxxThrowException(Void* , _s__ThrowInfo* )
> at FIX.CharConvertor.convert
> (basic_string<char\,std::char_traits<char>\,std::allocator<char>
> >* value)
> at QuickFix.Group.getField(CharField field)
> at QuickFix44.NewOrderSingle.NoPartyIDs.getPartyIDSource()
>
> Am I doing something wrong?
>
> Thanks,
>
> Andrei Goldchleger
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D=
DEVDEV
> _______________________________________________
> Quickfix-developers mailing list
> Qui...@li...
> https://lists.sourceforge.net/lists/listinfo/quickfix-developers
>
|