Uploaded image for project: 'OpenFAST'
  1. OpenFAST
  2. FAST-30

Default value of a mandatory field is ignored at encoding step

    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");

        Attachments

          Activity

            People

            • Assignee:
              jacob_northey Jacob Northey
              Reporter:
              clin Clin Fabrice
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: