[QFJ-955] getHeader() and getTrailer() not behaving correctly Created: 27/Sep/18 Updated: 28/Sep/18 Resolved: 28/Sep/18 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | None |
Affects Version/s: | 2.1.0 |
Fix Version/s: | None |
Type: | Bug | Priority: | Default |
Reporter: | Simon | Assignee: | Christoph John |
Resolution: | Won't Fix | Votes: | 0 |
Labels: | QuickfixJ | ||
Environment: |
Windows, JDK8 |
Attachments: | NewFixMessagePrinter .java OldFixMessagePrinter.java |
Description |
Hi, JUnit Test: @Test 2.0.0 ====>>> 8=FIX.4.49=1535=AE55=[N/A]10=072 2.1.0 ====>>> 8=FIX.4.49=1535=AE55=[N/A]10=072 Any help would be much appreciated. Greetings, |
Comments |
Comment by Simon [ 27/Sep/18 ] |
Please correct description: -behavong + behaving |
Comment by Christoph John [ 27/Sep/18 ] |
Thanks for including a quick test! The calculation of length and checksum has been changed to be calculated in a StringBuffer instead of changing the Message instance every time when calling toString(). This works without problems since the result of toString() will be sent on the wire. Also you can retrieve body length and checksum when you receive a message since then the message will be parsed using Message.fromString(). Here is how you could retrieve body length and checksum from a message that you created: @Test public void testBodyLengthAndChecksum() throws FieldNotFound, InvalidMessage { TradeCaptureReport tradeCaptureReport = new TradeCaptureReport(); tradeCaptureReport.set(new Instrument(new Symbol("[N/A]"))); System.out.println(tradeCaptureReport.toString()); Message newMessage = new Message(); newMessage.fromString(tradeCaptureReport.toString(), null, false); System.out.println(newMessage.getHeader().getString(9)); System.out.println(newMessage.getTrailer().getString(10)); System.out.println(MessageUtils.checksum(tradeCaptureReport.toString())); } This might look a little cumbersome but actually I wonder what the use case behind this is? Why do you need to know the body lenght and checksum of a message that you just created? Cheers, P.S.: Please use the mailing list if unsure if it is a bug or not. Thanks |
Comment by Simon [ 27/Sep/18 ] |
Hi Chris, thanks for that fast reply. The use case is we save a pretty print version of a fix message in the database, therefore we have a "prettyPrinter" utility class that wasn't working correctly after update to 2.1.0. Greetings, |
Comment by Simon [ 27/Sep/18 ] |
Hi Chris, could you remove the file "FixMessagePrinter.java" ? Thanks |
Comment by Christoph John [ 28/Sep/18 ] |
Done. For further discussion please use the mailing list (maybe with a link to this issue). Thanks, |
Comment by Christoph John [ 28/Sep/18 ] |
P.S.: I found a slightly nicer alternative... System.out.println(MessageUtils.getStringField( tradeCaptureReport.toString(), 9 )); System.out.println(MessageUtils.getStringField( tradeCaptureReport.toString(), 10 )); |