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

GroupValue.isDefined should handle undefined fields correctly

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.0.1
    • Component/s: Message Object Model
    • Labels:
      None
    • Environment:
      WinXP SP3; JavaSE 1.5; OpenFAST from SVN trunk.

      Description

      A call to GroupValue.isDefined giving a field name that is not mentioned in the template used to encode/decode the message results in an IllegalArgumentException. The exception is misleading because the field might be defined when other templates are used to transmit this particular message type. isDefined() should simply return "false" if the field is not declared in the template meaning the field is not included in this instance of the message.

      The following stack trace shows an occurrence of this problem:

      Exception in thread "main" java.lang.IllegalArgumentException: The field "MDEntryID" does not exist in group MDEntries
      at org.openfast.GroupValue.getValue(GroupValue.java:180)
      at org.openfast.GroupValue.isDefined(GroupValue.java:329)
      at com.oci.trader.marketdata.MarketDataConsumer.processMDEntry(MarketDataConsumer.java:121)
      <SNIP>

      The field MDEntryID is defined for the Market Data Incremental Refresh message being decoded here (see "FIX 4.4 with Errata 20030618 Volume 3" page 68, but this particular counterparty doesn't this optional field so they omitted it from their template.

      --------
      Work around:

      private boolean fieldPresent(GroupValue groupValue, String fieldName)

      { return groupValue.getGroup().hasField(fieldName) && groupValue.isDefined(fieldName); }

        Attachments

          Activity

            People

            • Assignee:
              jacob_northey Jacob Northey
              Reporter:
              wilsond Dale Wilson
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: