You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If value is optional, and uses the previous value (for example copy), then the null value is not stored.
Way to reproduce:
Object: string? Param
Msg1: "test"
Msg2: null
Msg3: null
There is error in decoding Msg3. Msg3 is decoded as "test", but should be decoded as null.
Error is in the fact, that null value is not stored, so when a message is sent using other Fast library, the presence bit is set to false because the value repeats it self, and the message is decoded from context, which is wrong in OpenFAST.net
To fix this, decode method in Scalar.cs should look like:
public override IFieldValue Decode(Stream inStream, Group decodeTemplate, Context context,
BitVectorReader presenceMapReader)
{
try
{
ScalarValue priorValue = null;
IDictionary dict = null;
QName key = Key;
ScalarValue value;
int pmapIndex = presenceMapReader.Index;
if (IsPresent(presenceMapReader))
{
if (context.TraceEnabled)
inStream = new RecordingInputStream(inStream);
if (!_operatorCodec.ShouldDecodeType)
return _operatorCodec.DecodeValue(null, null, this);
if (_operatorCodec.DecodeNewValueNeedsPrevious)
{
dict = context.GetDictionary(Dictionary);
priorValue = context.Lookup(dict, decodeTemplate, key);
ValidateDictionaryTypeAgainstFieldType(priorValue, _fastType);
}
ScalarValue decodedValue = _typeCodec.Decode(inStream);
value = _operatorCodec.DecodeValue(decodedValue, priorValue, this);
}
else
{
if (_operatorCodec.DecodeEmptyValueNeedsPrevious)
{
dict = context.GetDictionary(Dictionary);
priorValue = context.Lookup(dict, decodeTemplate, key);
ValidateDictionaryTypeAgainstFieldType(priorValue, _fastType);
}
value = _operatorCodec.DecodeEmptyValue(priorValue, this);
}
ValidateDecodedValueIsCorrectForType(value, _fastType);
#warning TODO: Review if this previous "if" statement is needed.
// if (Operator != Template.Operator.Operator.DELTA || value != null)
if (value != null &&
(_operatorCodec.DecodeNewValueNeedsPrevious || _operatorCodec.DecodeEmptyValueNeedsPrevious))
{
context.Store(dict ?? context.GetDictionary(Dictionary), decodeTemplate, key, value);
}
if (value == null &&
(_operatorCodec.DecodeNewValueNeedsPrevious || _operatorCodec.DecodeEmptyValueNeedsPrevious)) {
context.Store(dict ?? context.GetDictionary(Dictionary), decodeTemplate, key, value);
}
return value;
}
The text was updated successfully, but these errors were encountered:
There is bug in OpenFAST/Template/Scalar.cs file
If value is optional, and uses the previous value (for example copy), then the null value is not stored.
Way to reproduce:
Object: string? Param
Msg1: "test"
Msg2: null
Msg3: null
There is error in decoding Msg3. Msg3 is decoded as "test", but should be decoded as null.
Error is in the fact, that null value is not stored, so when a message is sent using other Fast library, the presence bit is set to false because the value repeats it self, and the message is decoded from context, which is wrong in OpenFAST.net
To fix this, decode method in Scalar.cs should look like:
The text was updated successfully, but these errors were encountered: