Skip to content

Commit b8f196b

Browse files
committed
QFJ-881: FieldType.MultipleValueString are not created from FIX5+ xml files
- added FieldType.MultipleStringValue and treated it the same way as FieldType.MultipleValueString - this avoids changes to existing data dictionaries - this problem originated from the official FPL repository where FIX versions prior to FIX5.0 had data type MultipleValueString and starting from FIX5.0 had data type MultipleStringValue
1 parent b68825e commit b8f196b

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

quickfixj-codegenerator/src/main/resources/org/quickfixj/codegenerator/Fields.xsl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public class <xsl:value-of select="@name"/> extends <xsl:call-template name="get
108108
<xsl:when test="@type='LENGTH'">int</xsl:when>
109109
<xsl:when test="@type='COUNTRY'">String</xsl:when>
110110
<xsl:when test="@type='MULTIPLESTRINGVALUE'">String</xsl:when>
111+
<xsl:when test="@type='MULTIPLEVALUESTRING'">String</xsl:when>
111112
<xsl:otherwise>String</xsl:otherwise>
112113
</xsl:choose>
113114
</xsl:template>
@@ -134,6 +135,7 @@ public class <xsl:value-of select="@name"/> extends <xsl:call-template name="get
134135
<xsl:when test="@type='LENGTH'">Int</xsl:when>
135136
<xsl:when test="@type='COUNTRY'">String</xsl:when>
136137
<xsl:when test="@type='MULTIPLESTRINGVALUE'">String</xsl:when>
138+
<xsl:when test="@type='MULTIPLEVALUESTRING'">String</xsl:when>
137139
<xsl:otherwise>String</xsl:otherwise>
138140
</xsl:choose>
139141
</xsl:template>
@@ -152,7 +154,9 @@ public class <xsl:value-of select="@name"/> extends <xsl:call-template name="get
152154
</xsl:when>
153155
<xsl:when test="../@type='MULTIPLESTRINGVALUE'">public static final String <xsl:value-of select="@description"/> = "<xsl:value-of select="@enum"/>";
154156
</xsl:when>
155-
<xsl:when test="../@type='BOOLEAN'">public static final boolean <xsl:value-of select="@description"/> = <xsl:call-template name="y-or-n-to-bool" />;
157+
<xsl:when test="../@type='MULTIPLEVALUESTRING'">public static final String <xsl:value-of select="@description"/> = "<xsl:value-of select="@enum"/>";
158+
</xsl:when>
159+
<xsl:when test="../@type='BOOLEAN'">public static final boolean <xsl:value-of select="@description"/> = <xsl:call-template name="y-or-n-to-bool" />;
156160
</xsl:when>
157161
<xsl:when test="../@type='INT'">public static final int <xsl:value-of select="@description"/> = <xsl:value-of select="@enum"/>;
158162
</xsl:when>

quickfixj-core/src/main/java/quickfix/DataDictionary.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ public boolean isDataField(int field) {
454454
}
455455

456456
private boolean isMultipleValueStringField(int field) {
457-
return fieldTypes.get(field) == FieldType.MultipleValueString;
457+
return (fieldTypes.get(field) == FieldType.MultipleValueString)
458+
|| (fieldTypes.get(field) == FieldType.MultipleStringValue);
458459
}
459460

460461
/**
@@ -728,6 +729,8 @@ private void checkValidFormat(StringField field) throws IncorrectDataFormat {
728729
// String
729730
} else if (fieldType == FieldType.MultipleValueString) {
730731
// String
732+
} else if (fieldType == FieldType.MultipleStringValue) {
733+
// String
731734
} else if (fieldType == FieldType.Exchange) {
732735
// String
733736
} else if (fieldType == FieldType.Boolean) {

quickfixj-core/src/main/java/quickfix/FieldType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public String toString() {
8383
public final static FieldType Qty = new FieldType("QTY", Double.class);
8484
public final static FieldType Currency = new FieldType("CURRENCY");
8585
public final static FieldType MultipleValueString = new FieldType("MULTIPLEVALUESTRING");
86+
public final static FieldType MultipleStringValue = new FieldType("MULTIPLESTRINGVALUE"); // QFJ-881
8687
public final static FieldType Exchange = new FieldType("EXCHANGE");
8788
public final static FieldType UtcTimeStamp = new FieldType("UTCTIMESTAMP", Date.class);
8889
public final static FieldType Boolean = new FieldType("BOOLEAN", Boolean.class);

quickfixj-core/src/test/java/quickfix/FieldTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@
2828
import static junit.framework.Assert.assertEquals;
2929
import org.junit.Test;
3030
import org.quickfixj.CharsetSupport;
31+
import quickfix.field.MDUpdateAction;
3132
import quickfix.field.RawData;
3233
import quickfix.field.Side;
34+
import quickfix.field.TradeCondition;
35+
import quickfix.fix50.MarketDataIncrementalRefresh;
3336

3437
public class FieldTest {
3538

@@ -250,6 +253,23 @@ public void testFieldhashCode() throws Exception {
250253
assertEqualsAndHash(new UtcTimeStampField(11, date), new UtcTimeStampField(11, date));
251254
}
252255

256+
// QFJ-881
257+
@Test
258+
public void testMultipleStringValue() throws Exception {
259+
260+
assertEquals(FieldType.MultipleStringValue, FieldType.fromName("notused", "MULTIPLESTRINGVALUE"));
261+
assertEquals(FieldType.MultipleValueString, FieldType.fromName("notused", "MULTIPLEVALUESTRING"));
262+
263+
MarketDataIncrementalRefresh md = new MarketDataIncrementalRefresh();
264+
MarketDataIncrementalRefresh.NoMDEntries value = new MarketDataIncrementalRefresh.NoMDEntries();
265+
value.set(new MDUpdateAction(MDUpdateAction.NEW));
266+
value.set(new TradeCondition("A B"));
267+
md.addGroup(value);
268+
269+
DataDictionary dd = new DataDictionary("FIX50.xml");
270+
dd.validate(md);
271+
}
272+
253273
private void assertEqualsAndHash(Field<?> field1, Field<?> field2) {
254274
assertEquals("fields not equal", field1, field2);
255275
assertEquals("fields hashcode not equal", field1.hashCode(), field2.hashCode());

0 commit comments

Comments
 (0)