Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions quickfixj-core/src/main/java/quickfix/DataDictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,9 @@ private void checkValidFormat(StringField field) throws IncorrectDataFormat {
if (fieldType == null) {
return;
}
if (!checkFieldsHaveValues && field.getValue().length() == 0) {
return;
}
try {
switch (fieldType) {
case STRING:
Expand Down
24 changes: 24 additions & 0 deletions quickfixj-core/src/test/java/quickfix/DataDictionaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import quickfix.field.BodyLength;
import quickfix.field.CheckSum;
import quickfix.field.ClOrdID;
import quickfix.field.EffectiveTime;
import quickfix.field.HandlInst;
import quickfix.field.LastMkt;
import quickfix.field.MsgSeqNum;
Expand Down Expand Up @@ -781,6 +782,29 @@ public void testGroupWithReqdComponentWithReqdFieldValidation() throws Exception
dictionary.validate(quoteRequest, true);
}

/**
* Field EffectiveTime(168) is defined as UTCTIMESTAMP so an empty string value is invalid but if we allow blank values that should not fail
* validation
* @throws Exception
*/
@Test
public void testAllowingBlankValuesDisablesFieldValidation() throws Exception {
final DataDictionary dictionary = getDictionary();
dictionary.setCheckFieldsHaveValues(false);
final quickfix.fix44.NewOrderSingle newSingle = new quickfix.fix44.NewOrderSingle(
new ClOrdID("123"), new Side(Side.BUY), new TransactTime(), new OrdType(OrdType.LIMIT)
);
newSingle.setField(new OrderQty(42));
newSingle.setField(new Price(42.37));
newSingle.setField(new HandlInst());
newSingle.setField(new Symbol("QFJ"));
newSingle.setField(new HandlInst(HandlInst.MANUAL_ORDER_BEST_EXECUTION));
newSingle.setField(new TimeInForce(TimeInForce.DAY));
newSingle.setField(new Account("testAccount"));
newSingle.setField(new StringField(EffectiveTime.FIELD));
dictionary.validate(newSingle, true);
}

//
// Group Validation Tests in RepeatingGroupTest
//
Expand Down