[QFJ-324] Message bodylength calculation incorrect Created: 01/Aug/08  Updated: 15/Nov/12  Resolved: 19/Aug/08

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

Type: Bug Priority: Default
Reporter: Fuzzy Gruber Assignee: Unassigned
Resolution: Not a bug Votes: 0
Labels: None


 Description   

quickfix.Message.bodylength() returns a smaller value than quickfix.Message.toString().

This is because CTRL+A characters are not counted in the value of bodylength().

(If this is a feature and not a bug, it should be documented)



 Comments   
Comment by Fuzzy Gruber [ 01/Aug/08 ]

I mean quickfix.Message.toString().length()

Comment by Jörg Thönnes [ 01/Aug/08 ]

BodyLength is a Standard FIX Header tag. Its contents is defined in the FIX specification, e.g. FIX 4.4 Vol. 2, page 4:

> The message length is indicated in the BodyLength field and is verified by counting the number of characters in
> the message following the BodyLength field up to, and including, the delimiter immediately preceding the
> CheckSum tag ("10=").

So this value must differ from a plain toString().length(). And it is documented in the FIX spec.

Cheers, Jörg

Comment by Fuzzy Gruber [ 04/Aug/08 ]

Jörg,

The BodyLength FIELD you're talking about would be retrieved using:
BodyLength bodyLength = new BodyLength();
message.get(bodyLength);
int fixBodyLength = bodyLength.getValue();

I understand this to be different compared to Message.bodylength()?

Thanks

-James

Comment by Steve Bate [ 19/Aug/08 ]

The m.bodyLength() value is the same as the tag 9 (BodyLength) in a fully constructed message. You also must retrieve tag 9 from the message header, not from the body.

Generated at Sat May 18 04:31:49 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.