Skip to content

Commit 61ead21

Browse files
committed
improved exception message
1 parent fefd7a9 commit 61ead21

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,8 +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
1159-
? Integer.valueOf(documentElement.getAttribute(attribute)) : 0;
1158+
? Integer.parseInt(documentElement.getAttribute(attribute)) : 0;
11601159
} catch (NumberFormatException e) {
11611160
throw new ConfigError("Attribute " + attribute + " could not be parsed as Integer.", e);
11621161
}
@@ -1171,7 +1170,7 @@ private void load(Document document, String msgtype, Node node) throws ConfigErr
11711170
final NodeList fieldNodes = node.getChildNodes();
11721171

11731172
if (countElementNodes(fieldNodes) == 0 && (msgtype == HEADER_ID || msgtype == TRAILER_ID)) {
1174-
throw new ConfigError("No fields found: msgType=" + msgtype);
1173+
throw new ConfigError("No fields found in " + msgtype);
11751174
}
11761175

11771176
for (int j = 0; j < fieldNodes.getLength(); j++) {

quickfixj-base/src/test/java/quickfix/DataDictionaryTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public void testHeaderWithNoChildren40() throws Exception {
275275
data += "</fix>";
276276

277277
expectedException.expect(ConfigError.class);
278-
expectedException.expectMessage("No fields found: msgType=HEADER");
278+
expectedException.expectMessage("No fields found in HEADER");
279279

280280
new DataDictionary(new ByteArrayInputStream(data.getBytes()));
281281
}
@@ -302,7 +302,7 @@ public void testHeaderWithTextElement40() throws Exception {
302302
data += "</fix>";
303303

304304
expectedException.expect(ConfigError.class);
305-
expectedException.expectMessage("No fields found: msgType=HEADER");
305+
expectedException.expectMessage("No fields found in HEADER");
306306

307307
new DataDictionary(new ByteArrayInputStream(data.getBytes()));
308308
}
@@ -328,7 +328,7 @@ public void testTrailerWithNoChildren40() throws Exception {
328328
data += "</fix>";
329329

330330
expectedException.expect(ConfigError.class);
331-
expectedException.expectMessage("No fields found: msgType=TRAILER");
331+
expectedException.expectMessage("No fields found in TRAILER");
332332

333333
new DataDictionary(new ByteArrayInputStream(data.getBytes()));
334334
}
@@ -355,7 +355,7 @@ public void testTrailerWithTextElement40() throws Exception {
355355
data += "</fix>";
356356

357357
expectedException.expect(ConfigError.class);
358-
expectedException.expectMessage("No fields found: msgType=TRAILER");
358+
expectedException.expectMessage("No fields found in TRAILER");
359359

360360
new DataDictionary(new ByteArrayInputStream(data.getBytes()));
361361
}

0 commit comments

Comments
 (0)