NOTE: Jira is for bug reports and feature requests.
If you are entering an issue to ask a question,
please use the QuickFIX/J support options. Thank you.

Issue Details (XML | Word | Printable)

Key: QFJ-536
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: SSE
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
QuickFIX/J

Checksum patch

Created: 28/Jun/10 02:56 PM   Updated: 08/Jul/10 03:15 PM
Return to search
Issue 11 of 71 issue(s)
Component/s: Engine
Affects Version/s: 1.4.0
Fix Version/s: 1.5.1

Environment: All


 Description  « Hide
The getGroups has the side effect of modifying i.e creating the empty group inside the message beeing read (with NoXXX field set to 0). The message serialization and checksum/length calculation inside quickfixj are not consistently treated for NoXXX=0 fields
(i.e: the checksum/length calculation uses the NoXXX=0 field and serialization ignores it).

Fixed: checksum/length calculation in QuickFIX/J for groups having NoXXX=0, in case that the library and getGroups+forwarding is used in a public call.


    int calculateLength() {
        int result = 0;
        int length = 0;
        for (Iterator<Field<?>> iter = fields.values().iterator(); iter.hasNext();) {
            Field<?> field = iter.next();
            if (field.getField() == BeginString.FIELD || field.getField() == BodyLength.FIELD
                    || field.getField() == CheckSum.FIELD || isGroupField(field.getField())) {
                continue;
            }
            length = field.getLength();
            result += length;
        }

        Iterator<Map.Entry<Integer, List<Group>>> iterator = groups.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<Integer, List<Group>> entry = iterator.next();
            List<Group> groupList = entry.getValue();
            if (groupList.size() > 0) { // ******* ADDED *******
IntField groupField = new IntField(((Integer) entry.getKey()).intValue());
groupField.setValue(groupList.size());
length = groupField.getLength();
result += length;
for (int i = 0; i < groupList.size(); i++) {
Group group = (Group) groupList.get(i);
length = group.calculateLength();
result += length;
}
            }
        }
        
        return result;

    }

    int calculateTotal() {

        int result = 0;
        for (Iterator<Field<?>> iter = fields.values().iterator(); iter.hasNext();) {
            Field<?> field = (Field<?>) iter.next();
            if (field.getField() == CheckSum.FIELD || isGroupField(field.getField())) {
                continue;
            }
            result += field.getTotal();
        }

        Iterator<Map.Entry<Integer, List<Group>>> iterator = groups.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<Integer, List<Group>> entry = iterator.next();
            List<Group> groupList = entry.getValue();
            if (groupList.size() > 0) { // ******* ADDED *******
IntField groupField = new IntField(((Integer) entry.getKey()).intValue());
groupField.setValue(groupList.size());
result += groupField.getTotal();
for (int i = 0; i < groupList.size(); i++) {
Group group = (Group) groupList.get(i);
result += group.calculateTotal();
}
            }
        }
        
        return result;
    }

(Internal reference: IC_57786)

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
There are no comments yet on this issue.