[Quickfix-developers] Required groups seem to during in DataDictionary validate
Brought to you by:
orenmnero
|
From: K. Lo S. <kls...@to...> - 2006-07-31 21:12:10
|
In required groups, such as MassQuote's NoQuoteSets,
In file FIX42.xml:316:
> <message name="MassQuote" msgtype="i" msgcat="app">
> [...]
> <group name="NoQuoteSets" required="Y">
seem to fail when validating required groups since required groups
for a message type are listed in a DataDictionary along with the
message type's required fields, but the DataDictionary only checks
that list against the message body's fields and not against the
message body's groups. In DataDictionary.checkHasRequired()'s code,
In file DataDictionary.java:730:
> Iterator fieldItr = requiredFieldsForMessage.iterator();
> while (fieldItr.hasNext()) {
> int field = ((Integer) fieldItr.next()).intValue();
> if (!body.isSetField(field)) {
> throw new FieldException
> (SessionRejectReason.REQUIRED_TAG_MISSING, field);
> }
> }
You'll see that FieldMap.isSetField() is used to check for each of
the requiredFieldsForMessage, but it should likely first determine if
the field DataDictionary.isGroup() and either use this
FieldMap.isSetField() or FieldMap.isGroupField() as appropriate. The
code could look like:
> Iterator fieldItr = requiredFieldsForMessage.iterator();
> while (fieldItr.hasNext()) {
> int field = ((Integer) fieldItr.next()).intValue();
> final boolean isFieldType = !this.isGroup(msgType, field);
> if (isFieldType && !body.isSetField(field)) {
> throw new FieldException
> (SessionRejectReason.REQUIRED_TAG_MISSING, field);
> } else if (!isSetField && !body.hasGroup(field)) {
> throw new FieldException
> (SessionRejectReason.REQUIRED_TAG_MISSING, field);
> }
> }
I can't imagine that this is actually a bug, since the browsing the
repository seems to tell me that this DataDictionary. checkHasRequired
() implementation has been around since July 2005. Would someone know
what I might be doing wrong?
Regards,
Lo
|