You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UserDefinedFields is only validated on message parsing in a very specific circumstance #247
We only check field validity in a specific circumstance
To Reproduce
StringioiWithUserDefinedField =
"8=FIX.4.2|9=75|35=6|49=Target|56=Sender|128=BUYSIDE|115=BIG-BANK-PLC|34=1|52=20160531-09:22:01.625|" +
"23=001|28=N|55=VOD.C|62=20170531-09:22:01.625|130=N|15=GBP|44=13.37|54=1|58=This is a comment|27=122|22=1|48=BH4HKS3|5001=ABC|10=206|";
StringioiInFixFormat = ioiWithUserDefinedField.replaceAll("\\|","\u0001")
DataDictionaryfix42Dictionary = newDataDictionary("FIX42.xml");
fix42Dictionary.setCheckUserDefinedFields(true)
Messagemessage = newMessage(ioiInFixFormat, fix42Dictionary, true);
Expected behavior
Constructor should throw FieldException with message: "Invalid tag number, field=5001"
system information:
Linux
Java version: JDK 8
QFJ Version: 2.2.0-SNAPSHOT
Additional context
This may be by design but it's not clear that it'll happen from the API. The boolean you pass is called validate, it's reasonable to expect that it should validate according to the dictionary settings.
The only circumstance we check for user defined fields is in parseGroup:
So you can check if Message.getException() is not NULL after your call. But yes, in a way it is unexpected. Should maybe be dependent on doValidation flag.
This was always the case (at least going back 6 years back.)
The validation happens in two places. One in DataDictionary and the other in the Message. The one in Message iterates over fields in the message and not in the dictionary so extra fields are not checked. There are probably some other nuances.
It is not nice, but at the when message is received the failure will be detected in one of two places
A side-effect of this is that, if an unknown tag is placed just after a group, then the field is rejected and the parsing stops.
In all other cases, the parsing continues.
I'd rather the parsing to continue in all cases, with no exception. Probably the test for unknown tags in groups should be made "smarter" and determine if the tag is to be considered still in the group or not before calling the validation.
In this way the behavior of the parser is asymmetric.
@drosso64 , with which version did you test this? There were changes done with https://www.quickfixj.org/jira/browse/QFJ-169 to consider the unknown field to be part of the repeating group.
Actually, the parser cannot decide whether the unknown tag is part of the repeating group or part of the parent message since the tag is unknown. Especially when there is only one repeating group instance there is no way to know whether the tag is part of the group or not. You can only guess at this point.
Hi @chrjohn, I'm testing the 2.1.1 version.
I've seen the code affected by https://www.quickfixj.org/jira/browse/QFJ-169 and actually I understand there's no way to determine whether the tag is part of the repeating group or not.
I'm testing the library in the context of [http://fixpusher.sourceforge.net/](url, a FIX testing tool I'm changing to my needs; the tool is used to test some FIX components of a trading market platform, and I needed a complete parsing of messages even in case of tags not defined in the dictionary.
That's how I noticed that when an unknown tags is at the end of a repeating group the parser throws an exception and stops the processing; on the other hand this didn't happen if the tag was simply moved in another position.
I was however able to circumvent the problem by setting AllowUnknownMsgFields to 'Y'.
If the tag is not in the dictionary you have no way of knowing whether it should be in the group or not. With a Dictionary and AllowUnknownMsgFields you will find that tags after a group might get placed in the group rather than in the message
Activity
chrjohn commentedon Dec 17, 2019
FieldExceptionis not thrown because of this:quickfixj/quickfixj-core/src/main/java/quickfix/Message.java
Lines 568 to 583 in 027e82b
So you can check if
Message.getException()is not NULL after your call. But yes, in a way it is unexpected. Should maybe be dependent ondoValidationflag.philipwhiuk commentedon Dec 19, 2019
UserDefinedFields isn't checked at all though.
getException()returns null.the-thing commentedon Mar 12, 2020
This was always the case (at least going back 6 years back.)
The validation happens in two places. One in DataDictionary and the other in the Message. The one in Message iterates over fields in the message and not in the dictionary so extra fields are not checked. There are probably some other nuances.
It is not nice, but at the when message is received the failure will be detected in one of two places
quickfixj/quickfixj-core/src/main/java/quickfix/mina/AbstractIoHandler.java
Line 135 in 027e82b
or
quickfixj/quickfixj-core/src/main/java/quickfix/Session.java
Line 994 in 027e82b
I remember that in the past every time we got invalid message from a venue we had to pass it via both validations to find out what was wrong.
drosso64 commentedon Jun 16, 2020
A side-effect of this is that, if an unknown tag is placed just after a group, then the field is rejected and the parsing stops.
In all other cases, the parsing continues.
I'd rather the parsing to continue in all cases, with no exception. Probably the test for unknown tags in groups should be made "smarter" and determine if the tag is to be considered still in the group or not before calling the validation.
In this way the behavior of the parser is asymmetric.
chrjohn commentedon Jun 17, 2020
@drosso64 , with which version did you test this? There were changes done with https://www.quickfixj.org/jira/browse/QFJ-169 to consider the unknown field to be part of the repeating group.
Actually, the parser cannot decide whether the unknown tag is part of the repeating group or part of the parent message since the tag is unknown. Especially when there is only one repeating group instance there is no way to know whether the tag is part of the group or not. You can only guess at this point.
drosso64 commentedon Jun 18, 2020
Hi @chrjohn, I'm testing the 2.1.1 version.
I've seen the code affected by https://www.quickfixj.org/jira/browse/QFJ-169 and actually I understand there's no way to determine whether the tag is part of the repeating group or not.
I'm testing the library in the context of [http://fixpusher.sourceforge.net/](url, a FIX testing tool I'm changing to my needs; the tool is used to test some FIX components of a trading market platform, and I needed a complete parsing of messages even in case of tags not defined in the dictionary.
That's how I noticed that when an unknown tags is at the end of a repeating group the parser throws an exception and stops the processing; on the other hand this didn't happen if the tag was simply moved in another position.
I was however able to circumvent the problem by setting AllowUnknownMsgFields to 'Y'.
philipwhiuk commentedon Jun 19, 2020
If the tag is not in the dictionary you have no way of knowing whether it should be in the group or not. With a Dictionary and AllowUnknownMsgFields you will find that tags after a group might get placed in the group rather than in the message