Skip to content

Commit 25565ef

Browse files
committed
check for header and trailer
1 parent 24214ee commit 25565ef

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,7 @@ private void load(InputStream inputStream, DocumentBuilderFactory factory) throw
11551155
private int getIntegerAttributeIfDefined(final Element documentElement, final String attribute) throws ConfigError {
11561156
try {
11571157
return documentElement.hasAttribute(attribute)
1158+
// TODO
11581159
? Integer.valueOf(documentElement.getAttribute(attribute)) : 0;
11591160
} catch (NumberFormatException e) {
11601161
throw new ConfigError("Attribute " + attribute + " could not be parsed as Integer.", e);
@@ -1168,6 +1169,11 @@ public int getNumMessageCategories() {
11681169
private void load(Document document, String msgtype, Node node) throws ConfigError {
11691170
String name;
11701171
final NodeList fieldNodes = node.getChildNodes();
1172+
1173+
if (countElementNodes(fieldNodes) == 0 && (msgtype == HEADER_ID || msgtype == TRAILER_ID)) {
1174+
throw new ConfigError("No fields found: msgType=" + msgtype);
1175+
}
1176+
11711177
for (int j = 0; j < fieldNodes.getLength(); j++) {
11721178
final Node fieldNode = fieldNodes.item(j);
11731179

0 commit comments

Comments
 (0)