Skip to content

Code duplication - checksum calculation #1283

Description

@philipwhiuk

Ideally we wouldn't duplicate the checksum calculation logic found here. If duplication is necessary we should have tests to ensure they're consistent.

https://github.com/quickfix-j/quickfixj/blob/master/quickfixj-base/src/main/java/quickfix/Message.java#L219

and

https://github.com/quickfix-j/quickfixj/blob/master/quickfixj-base/src/main/java/quickfix/MessageUtils.java#L277

and sort of

https://github.com/quickfix-j/quickfixj/blob/master/quickfixj-base/src/main/java/quickfix/FieldMap.java#L562

Weirdly the string-based algorithms work differently

  • Message#setChecksum : iterates backwards (an odd choice) and adds 1 (for an SOH it otherwise excludes?)
  • MessageUtils#checksum : iterates forwards but doesn't add 1

This would be a minor quibble I wouldn't have come across except that while trying to support multi-byte charsets it behaved weird and it took higher level tests to catch it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions