[QFJ-872] toString() Method Breaks Repeating Groups Created: 23/Dec/15 Updated: 23/Dec/15 Resolved: 23/Dec/15 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Build |
Affects Version/s: | 1.6.0 |
Fix Version/s: | None |
Type: | Bug | Priority: | Critical |
Reporter: | Mike Starkie | Assignee: | Christoph John |
Resolution: | Not a bug | Votes: | 0 |
Labels: | QuickfixJ | ||
Environment: |
OS X 10.11.2 |
Attachments: | QuickFixGroupTest.java |
Description |
Given a valid FIX 4.4 Execution Report FIX string containing a repeating group passed as the single argument to the constructor of the Message type, immediately calling the toString() method on the new instance results in the repeating group being mangled. Below is the output of the sample program which demonstrates the bug. The first message has field 382[NoContraBrokers] in the correct place at the start of ContraGrp. The toString result has field 375[ContraBroker] coming before 382 which is incorrectly placed outside the group. Fix String before creating Message instance: Fix String after calling toString() on the new instance of Message: ----------------------- Sample Code ------------------------- package com.globalforge.infix; import quickfix.InvalidMessage; public class QuickFixGroupTest { public static String rs(String ins) { return ins.replaceAll("\u0001", "|"); } public static void main(String[] args) { catch (InvalidMessage e) { e.printStackTrace(); } } |
Comments |
Comment by Christoph John [ 23/Dec/15 ] |
This is no valid FIX4.4 message for several reasons:
Moreover, the position of the fields in the repeating groups should be the same as defined in the data dictionary (at least up to and including FIX4.4). But I don't remember if this is in line with the spec or a speciality of QF/J. After these changes the parsing succeeds. System.out.println("before: " + rs(FIX_44_EXEC_REPORT)); try { Message quickFixMsg = new Message(); final DataDictionary dataDictionary = new DataDictionary("FIX44.xml"); quickFixMsg.fromString(FIX_44_EXEC_REPORT, dataDictionary, true); System.out.println("after : " + rs(quickFixMsg.toString())); } catch (InvalidMessage e) { e.printStackTrace(); } |
Comment by Christoph John [ 23/Dec/15 ] |
Please post to the mailing list before opening a bug. Thanks |