diff --git a/src/main/java/com/solab/iso8583/MessageFactory.java b/src/main/java/com/solab/iso8583/MessageFactory.java index a2a0746..f5b751d 100644 --- a/src/main/java/com/solab/iso8583/MessageFactory.java +++ b/src/main/java/com/solab/iso8583/MessageFactory.java @@ -413,7 +413,10 @@ public class MessageFactory { if (index == null) { log.error(String.format("ISO8583 MessageFactory has no parsing guide for message type %04x [%s]", type, new String(buf))); - return null; + throw new ParseException(String.format( + "ISO8583 MessageFactory has no parsing guide for message type %04x [%s]", + type, + new String(buf)), 0); } //First we check if the message contains fields not specified in the parsing template boolean abandon = false; @@ -424,7 +427,7 @@ public class MessageFactory { } } if (abandon) { - return m; + throw new ParseException("ISO8583 MessageFactory cannot parse fields", 0); } //Now we parse each field if (useBinary) {