java.lang.NegativeArraySizeException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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. {code:java} 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); } } {code} {noformat} 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) {noformat} Could you please have a look.
    via by Alexander Piskarev,
    • 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)
    No Bugmate found.