[FAST-299] UInt32 Decoding Issue Created: 20/Feb/19  Updated: 20/Feb/19

Status: Open
Project: OpenFAST
Component/s: Types
Affects Version/s: 1.1.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Thomas Laue Assignee: Jacob Northey
Resolution: Unresolved Votes: 0
Labels: None


 Description   

I noticed that certain uint32 values are not decoded correctly but are decoded as '0'. This happens e.g. for 16384.

See the following example:

import java.io.ByteArrayInputStream;

import org.openfast.Context;
import org.openfast.Message;
import org.openfast.QName;
import org.openfast.codec.FastDecoder;
import org.openfast.codec.FastEncoder;
import org.openfast.template.MessageTemplate;
import org.openfast.template.TemplateRegistry;

public class UInt32DecodingIssue {

	public static void main(String[] args) throws Exception {
		Context fastContext = new Context();
		TemplateRegistry tr = FASTMessageTemplateLoader.getTemplateRegistry("TestTemplate.xml");
		FastEncoder fen = new FastEncoder(fastContext);
		fastContext.setTemplateRegistry(tr);
		MessageTemplate template = tr.get(new QName("TestMessage"));
		Message message = new Message(template);
		message.setInteger("TestField", 16384);
		byte[] b = fen.encode(message);
		FastDecoder fdec = new FastDecoder(fastContext, new ByteArrayInputStream(b));
		Message decodedMsg = fdec.readMessage();
		System.out.println("Decoded uint32 value is " + decodedMsg.getInt("TestField"));
	}

}

using the following template file:

TestTemplate.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates>
  <template id="1" name="TestMessage">
    <uInt32 name="TestField" id="1"/>
  </template>
</templates>

If I try this for 16383 or 16385, the values are decoded correctly. For 16384 the result is 0. Same issue with 268435456.


Generated at Sat Nov 23 15:58:10 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.