From 95a09942ff71f2dfd20c84e75ce9c7b8f8d81a67 Mon Sep 17 00:00:00 2001 From: Enrique Zamudio Date: Fri, 20 Nov 2015 00:59:47 -0600 Subject: [PATCH] check for BigInteger #61 --- src/main/java/com/solab/iso8583/IsoValue.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/solab/iso8583/IsoValue.java b/src/main/java/com/solab/iso8583/IsoValue.java index 4e57de9..ea2eeff 100644 --- a/src/main/java/com/solab/iso8583/IsoValue.java +++ b/src/main/java/com/solab/iso8583/IsoValue.java @@ -21,6 +21,7 @@ package com.solab.iso8583; import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; +import java.math.BigInteger; import java.util.Date; import java.util.TimeZone; @@ -199,10 +200,12 @@ public class IsoValue implements Cloneable { if (type == IsoType.NUMERIC || type == IsoType.AMOUNT) { if (type == IsoType.AMOUNT) { if (value instanceof BigDecimal) { - return type.format((BigDecimal)value, 12); + return type.format((BigDecimal) value, 12); } else { return type.format(value.toString(), 12); } + } else if (value instanceof BigInteger) { + return type.format(encoder == null ? value.toString() : encoder.encodeField(value), length); } else if (value instanceof Number) { return type.format(((Number)value).longValue(), length); } else {