[FAST-64] NegativeArraySizeException while decoding ProductSnapshot Created: 07/Oct/16 Updated: 12/Oct/16 |
|
Status: | Open |
Project: | OpenFAST |
Component/s: | None |
Affects Version/s: | 1.1.2 |
Fix Version/s: | None |
Type: | Bug | Priority: | Default |
Reporter: | Alexander Piskarev | Assignee: | Jacob Northey |
Resolution: | Unresolved | Votes: | 0 |
Labels: | None | ||
Environment: |
Java 1.7/1.8 Eurex Sim T7 4.0 |
Attachments: | emdda_output.txt fastdata.bin RDDFastTemplates-1.1.xml |
Description |
Hi, OpenFAST team. While decoding new version of reference data from Eurex T7 4.0 with RDDFastTemplates-1.1.xml (http://www.eurexchange.com/blob/2732742/809e0a1d9dc6cb9dae4126affe1c9395/data/Eurex-Market---Reference-Data-Interfaces---XML-FAST-Templates---FIXML-schema-files.zip) with openfast-1.1.2 I have found some decoding errors including NegativeArraySizeException. Using following small test I could reproduce it. public static void main(String[] args) throws IOException { MessageTemplateLoader templateLoader = new XMLMessageTemplateLoader(); List<MessageTemplate> templates = new ArrayList<>(); MessageTemplate[] hardcodedTemplates = templateLoader.load(new ByteArrayInputStream("<template id=\"120\" name=\"FastReset\"></template>".getBytes())); templates.addAll(Arrays.asList(hardcodedTemplates)); try (InputStream templateSource = Main.class.getClassLoader().getResourceAsStream("RDDFastTemplates-1.1.xml")) { templates.addAll(Arrays.asList(templateLoader.load(templateSource))); } try (InputStream fastEncodedStream = Main.class.getClassLoader().getResourceAsStream("fastdata.bin")) { MessageInputStream messageIn = new MessageInputStream(fastEncodedStream); messageIn.getContext().setTraceEnabled(true); for (MessageTemplate mt : templates) { messageIn.registerTemplate(Integer.valueOf(mt.getId()), mt); } Message message = null; do { message = messageIn.readMessage(); System.out.println(message); } while (message != null); } } Exception in thread "main" java.lang.NegativeArraySizeException at org.openfast.ByteUtil.combine(ByteUtil.java:125) at org.openfast.util.Util.applyDifference(Util.java:82) at org.openfast.template.operator.DeltaStringOperatorCodec.decodeValue(DeltaStringOperatorCodec.java:77) at org.openfast.template.Scalar.decodeValue(Scalar.java:174) at org.openfast.template.Scalar.decode(Scalar.java:234) at org.openfast.template.Group.decodeFieldValues(Group.java:293) at org.openfast.template.Group.decodeFieldValues(Group.java:256) at org.openfast.template.Group.decode(Group.java:223) at org.openfast.template.Sequence.decode(Sequence.java:206) at org.openfast.template.Group.decodeFieldValues(Group.java:293) at org.openfast.template.MessageTemplate.decode(MessageTemplate.java:126) at org.openfast.codec.FastDecoder.readMessage(FastDecoder.java:95) at org.openfast.MessageInputStream.readMessage(MessageInputStream.java:70) at local.Main.main(Main.java:38) Could you please have a look. |
Comments |
Comment by Alexander Piskarev [ 07/Oct/16 ] |
Also I want to add that own Eurex test tool emdda decodes this data file with the same RDDFastTemplate-1.1 template without faults (it use QuickFix internally). |
Comment by Alexander Piskarev [ 12/Oct/16 ] |
Actually something goes wrong with parsing second ProductSnapshot e.g. PrimaryServiceLocationID: 80c0 -> 224.0.50.89@(0, @) is read incorrectly from position with offset 839 but should read from 848. Output of right packet decoding (by e emdda tool) attached. |
Comment by Alexander Piskarev [ 12/Oct/16 ] |
Solution from http://www.quickfixj.org/jira/browse/FAST-49 has solved this issue |