[QFJ-280] Improve behavior of parsing out-of-order fields Created: 24/Dec/07  Updated: 15/Jan/08  Resolved: 12/Jan/08

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.2.1
Fix Version/s: 1.3.1

Type: Improvement Priority: Default
Reporter: CaiQi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None


 Description   

The order of fromString() is parseHeader(),parseBody(dd),parseTrailer(dd).
Problem 1:
When extracting header, if a body/trailer's field appears in header, the field will be pushed to body and the extraction end up. This field will be considered
as the first field of the body. This will cause Other fields followed dropped.

Problem 2:
When extracting body, if a trailer's field appers in it, it's the same as problem 1.

Problem 3:
When extracting body, if a header's field appers in it, it will be set back into the header. In this case, the header's field could be set in the body which cannot be validated.
e.g. This message can be received.
8=IMIX.1.09=15335=D11=00034=84049=ICBC50=operator00152=20071207-
10:06:38.50556=XXX11=12344=148=asd54=155=WAKEN354=7355=12\001493=711=99989=memory10=XXX

Solution :

In parseBody():
If headerfield is set in body or bodyfield is set in header, throw exception.
If the field has been set in head, throw exception.

In parseTrailer():
If the field has been set in head/body, throw exception.
If trailerfield is set in header/body; or header/body field is set in trailer, throw exception.



 Comments   
Comment by Steve Bate [ 12/Jan/08 ]

I've slightly modified the parsing and added some additional test cases. The cases you mention will parse without an exception but the message will be marked as having an invalid structure. If the first 3 headers fields are not correct, that will still result in an immediate exception.

Generated at Sun May 19 22:38:13 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.