Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-315

Field type EXCHANGE is mapped to type CHAR, whereas the ENUM should be of String type. Breaks generating source code.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.2
    • Component/s: Build
    • Labels:
      None
    • Environment:
      Windows XP Pro

      Description

      In the Fields.xsl file used at code generation time, there are three field types mapped and a default as follows;

      <xsl:template name="values">
      <xsl:for-each select="value">
      <xsl:choose>
      <xsl:when test="../@type='STRING'">public static final String <xsl:value-of select="@description"/> = "<xsl:value-of select="@enum"/>";
      </xsl:when>
      <xsl:when test="../@type='BOOLEAN'">public static final boolean <xsl:value-of select="@description"/> = <xsl:call-template name="y-or-n-to-bool" />;
      </xsl:when>
      <xsl:when test="../@type='INT'">public static final int <xsl:value-of select="@description"/> = <xsl:value-of select="@enum"/>;
      </xsl:when>
      <xsl:otherwise>public static final char <xsl:value-of select="@description"/> = '<xsl:value-of select="@enum"/>';
      </xsl:otherwise>
      </xsl:choose>
      </xsl:for-each>

      The missing entry for "EXCHANGE" should be:

      <xsl:when test="../@type='EXCHANGE'">public static final String <xsl:value-of select="@description"/> = "<xsl:value-of select="@enum"/>";
      </xsl:when>

      The default FIX44.xml file does not actually have any entries listed for "SecurityExchange" and thus this issue never crops up when genrating the QuickFix/J source on the normal FIX44.xml file (or other versions), however, if any entry is added under the fields as the following example;

      <field name="SourceExchange" number="6565" type="EXCHANGE">
      <value description="SCOACH SWITZERLAND" enum="XQMH"/>
      <value description="SWISS EXCHANGE" enum="XSWX"/>
      <value description="VIRT-X" enum="XVTX"/>
      </field>

      the code generation will try to generate the type EXCHANGE to be a "char" enum, with field names that are longer than 1 char, or in the above case; "XQMH" etc. And as such the code will not compile. Full result:

      public class SecurityExchange extends StringField
      {
      static final long serialVersionUID = 20050617;

      public static final int FIELD = 207;
      public static final char SCOACH_SWITZERLAND = 'XQMH';
      public static final char SWX_SWISS_EXCHANGE = 'XSWX';
      public static final char SWX_EUROPE = 'XVTX';

      public SecurityExchange()

      { super(207); }

      public SecurityExchange(String data)

      { super(207, data); }

      }

      For more details on the ENUM values, here is a FIX reference document outlining all of it:

      http://www.onixs.biz/fixdictionary/4.4/app_6_c.html

      As a side note, It also seems that other custom field types that are defaulted to String.class in FieldType.java will fall into the "char" enum mapping as there is no "catch clause" for them in the xsl definition. Example:

      public final static FieldType Exchange = new FieldType("EXCHANGE");
      public final static FieldType MonthYear = new FieldType("MONTHYEAR");
      public final static FieldType Time = new FieldType("TIME");

      among others.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rainlord Emil Crumhorn
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: