[FAST-30] Default value of a mandatory field is ignored at encoding step Created: 17/Sep/10  Updated: 17/Sep/10

Status: Open
Project: OpenFAST
Component/s: Message Object Model
Affects Version/s: 1.0.0
Fix Version/s: None

Type: Bug Priority: Default
Reporter: Clin Fabrice Assignee: Jacob Northey
Resolution: Unresolved Votes: 0
Labels: None


 Description   

default value + mandatory attribute is a strange combination but it used in some known templates (i.e. euronext)

Here is a proposal:

class: org.openfast.template.Group
method: encode

FieldValue fieldValue = groupValue.getValue(fieldIndex);
Field field = getField(fieldIndex);

//*************************************************************************************************************************
if (field instanceof Scalar && fieldValue == null && ((Scalar) field).getOperator() == Operator.DEFAULT)
fieldValue = ((Scalar) field).getDefaultValue();
//*************************************************************************************************************************

if (!field.isOptional() && fieldValue == null)
Global.handleError(FastConstants.GENERAL_ERROR, "Mandatory field " + field + " is null");


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