Details
-
Type: Bug
-
Status: Open
-
Priority: Default
-
Resolution: Unresolved
-
Affects Version/s: 1.0.0
-
Fix Version/s: None
-
Component/s: Message Object Model
-
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");