Openfast ArrayIndexOutOfBoundsException creating messages

Imported from previous forum

Hello everyone,

I’ve been developing an application which uses Openfast as fast converter engine. I’m creating the Message object manually and setting it up in a MessageOutputStream.
My problem is:
When I call the method, writeMessage, from MessageOutputStream I got the error ArrayIndexOutOfBoundsException.
Debugging Openfast code, I could notice that the error occurs when I try to add more sequence’s child fields than the whole message has. I mean, my message template has 3 fields, where one of them is a sequence which has another 10 child fields, then when I call encode method, I got ArrayIndexOutOfBoundsException.
My stack is shown below:
java.lang.ArrayIndexOutOfBoundsException: 2
at org.openfast.BitVector.set(BitVector.java:61)
at org.openfast.BitVectorBuilder.set(BitVectorBuilder.java:31)
at org.openfast.template.operator.OperatorCodec.getValueToEncode(OperatorCodec.java:127)
at org.openfast.template.Scalar.encode(Scalar.java:146)
at org.openfast.template.Group.encode(Group.java:174)
at org.openfast.template.Sequence.encode(Sequence.java:177)
at org.openfast.template.Group.encode(Group.java:174)
at org.openfast.template.MessageTemplate.encode(MessageTemplate.java:97)
at org.openfast.codec.FastEncoder.encode(FastEncoder.java:48)
at org.openfast.MessageOutputStream.writeMessage(MessageOutputStream.java:66)
at org.openfast.MessageOutputStream.writeMessage(MessageOutputStream.java:52)
at com.mycompany.feeder_simulator.bean_to_fast.openfast_parser.OpenfastParserVisitor.visit(OpenfastParserVisitor.java:314)
at com.mycompany.feeder_simulator.xml_to_bean.beans.market_data_incremental_refresh_bean.MarketDataIncrementalRefreshBean.accept(MarketDataIncrementalRefreshBean.java:64)
at com.mycompany.feeder_simulator.bean_to_fast.Bean2Fast.convertToFast(Bean2Fast.java:49)
at com.mycompany.feeder_simulator.FeederSimulator.send(FeederSimulator.java:34)
at com.mycompany.feeder_simulator.FeederSimulator.main(FeederSimulator.java:62)

I’m creating my sequences and my message as below:

this.messageTemplate = this.templateLoader.getTemplateRegistry().get(“SecurityList”);
Message outObj = new Message(this.messageTemplate);
this.messageOut.registerTemplate(30, this.messageTemplate);

if (inObj.getMsgSeqNum() != null)
outObj.setInteger(“MsgSeqNum”, inObj.getMsgSeqNum());

if (inObj.getSendingTime() != null)
outObj.setLong(“SendingTime”, inObj.getSendingTime());

if (inObj.getRelatedSym() != null) {
Sequence RelatedSymSequence = this.messageTemplate.getSequence(“RelatedSym”);
SequenceValue RelatedSymSequenceValue = new SequenceValue(RelatedSymSequence);

 List<RelatedSymSecurityListBean> RelatedSymList = inObj.getRelatedSym();

 for (RelatedSymSecurityListBean RelatedSymInGroup : RelatedSymList) {
      GroupValue RelatedSymOutGroup = new GroupValue(RelatedSymSequence.getGroup());

      if (RelatedSymInGroup.getSecurityID() != null)
          RelatedSymOutGroup.setString("SecurityID", RelatedSymInGroup.getSecurityID());

By the way, my application needs to read a XML defined by me, convert its using XStream to an object, create Openfast Message object and encode to FAST.

Help?

Did you try and post this over on the openfast project site?

http://sourceforge.net/mailarchive/forum.php?forum_name=openfast-user

We have a new committer. This forum is for FAST specific questions - the above link is for OpenFAST.

Did you try and post this over on the openfast project site?

openfast-user Mailing List for OpenFAST

We have a new committer. This forum is for FAST specific questions - the above link is for OpenFAST.
Done!
Anyway thanks for your reply.

cheers

Sergio Santiago