diff --git a/src/main/java/com/solab/iso8583/parse/LllvarParseInfo.java b/src/main/java/com/solab/iso8583/parse/LllvarParseInfo.java index 6c3ac72..1162bac 100644 --- a/src/main/java/com/solab/iso8583/parse/LllvarParseInfo.java +++ b/src/main/java/com/solab/iso8583/parse/LllvarParseInfo.java @@ -62,13 +62,9 @@ public class LllvarParseInfo extends FieldParseInfo { if (custom == null) { return new IsoValue(type, _v, length, null); } else { - @SuppressWarnings({"unchecked", "rawtypes"}) - IsoValue v = new IsoValue(type, custom.decodeField(_v), length, custom); - if (v.getValue() == null) { - //problems decoding? return the string - return new IsoValue(type, _v, length, null); - } - return v; + Object decoded = custom.decodeField(_v); + //If decode fails, return string; otherwise use the decoded object and its codec + return new IsoValue(type, decoded == null ? _v : decoded, length, decoded == null ? null : custom); } }