From 67c5522e926bdbfa96e83a200534d78efc360227 Mon Sep 17 00:00:00 2001 From: chochos Date: Fri, 18 May 2012 15:29:44 +0000 Subject: [PATCH] Simplify creation of return value git-svn-id: https://j8583.svn.sourceforge.net/svnroot/j8583/j8583@104 db60a039-f72e-0410-b1d2-baa000846441 --- .../java/com/solab/iso8583/parse/LllvarParseInfo.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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); } }