[QFJ-52] NPE on invalid message group Created: 16/Aug/06  Updated: 12/Apr/07  Resolved: 07/Sep/06

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.0.2
Fix Version/s: 1.1.0

Type: Bug Priority: Default
Reporter: Chris Audley Assignee: Steve Bate
Resolution: Fixed Votes: 0
Labels: None
Environment:

Any runtime environment


Attachments: Text File group.patch    

 Description   

The parseGroup method in Message does not correctly detect an invalid group that starts with a non-subgroup field that is not the appropriate 'first field' for the group.

For instance, this incorrect NoRelatedSym group:

NoRelatedSym (146): 1
SecurityID (48): 31406TPB1
SecurityIDSource (22): 1
....

The first field should be a Symbol(55), but the symbol field is missing in this message. The parseGroup method will try to add the SecurityID (48) field to the group, but the group reference is still null because it hasn't encountered the correct first field yet. The fix is to check the firstFieldFound flag and throw an InvalidMessage exception if it isn't true. This is done correctly in the code for a subgroup field.

As a side note, Quickfix/C++ accepts this message without problem, but it probably shouldn't.



 Comments   
Comment by Chris Audley [ 16/Aug/06 ]

patch correct NPE in Message.parseGroup when group does not start with
appropriate first field

Comment by Steve Bate [ 17/Aug/06 ]

Hi Chris,

Thanks for the bug report. I'll apply the patch.

Comment by Chris Audley [ 17/Aug/06 ]

After having patched this problem, I think there is still a problem. When a group is missing the first field, quickfixj emits a log message about actual body length not matching expected body length.

Shouldn't this method be throwing a FieldNotFound exception that is caught by the session object and a Reject or BusinessMessageReject message sent to the sender as appropriate?

Comment by Steve Bate [ 07/Sep/06 ]

Added a regressions for the fix.

Generated at Sat Nov 23 11:29:39 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.