Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.5.1
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      All

      Description

      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)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sse SSE
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: