[QFJ-684] Support for binary data (BytesField) does not (and cannot) work on full range of bytes Created: 01/Jun/12  Updated: 04/May/21  Resolved: 04/May/21

Status: Closed
Project: QuickFIX/J
Component/s: None
Affects Version/s: 1.4.0
Fix Version/s: 3.0.0

Type: Bug Priority: Default
Reporter: Rhys Yarranton Assignee: Marcin L
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to QFJ-789 Fully support alternate encodings (ch... Open

 Description   

The BytesField support for putting raw bytes into a message does not work unless the bytes are compatible with the charset. e.g., the test below will fail. If QF/J is to support raw data fields (and encoded fields), some areas that currently work on/as Strings will need to change to work on byte[]s or ByteBuffers. In the mean time, if BytesField can't work, best to remove it.

public void testBytesFieldForReal()
throws Exception

{ byte[] data = new byte[256]; for(int i = 0; i < 256; ++i) data[i] = (byte)i; BytesField field = new BytesField(RawData.FIELD); field.setValue(data); StringBuilder sb = new StringBuilder(); field.toString(sb); byte[] tagBytes = sb.toString().getBytes(CharsetSupport.getCharset()); assertEquals(256 + 3, tagBytes.length); for(int i = 0; i < data.length; ++i) assertEquals(data[i], tagBytes[i + 3]); }

 Comments   
Comment by Christoph John [ 04/May/21 ]

https://github.com/quickfix-j/quickfixj/pull/289

Generated at Wed May 08 08:05:53 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.