From 2c501c3f438db868081c825412ce0f1353f897b5 Mon Sep 17 00:00:00 2001 From: chochos Date: Tue, 30 Nov 2010 02:29:37 +0000 Subject: [PATCH] The new copyFieldsFrom() method had problems with fields that had CustomField encoders. A getter has been added to IsoValue for the CustomField and it's used in the copyFieldsFrom() method. git-svn-id: https://j8583.svn.sourceforge.net/svnroot/j8583/j8583@58 db60a039-f72e-0410-b1d2-baa000846441 --- src/main/java/com/solab/iso8583/IsoMessage.java | 2 +- src/main/java/com/solab/iso8583/IsoValue.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/solab/iso8583/IsoMessage.java b/src/main/java/com/solab/iso8583/IsoMessage.java index 062c0a7..90c3d89 100644 --- a/src/main/java/com/solab/iso8583/IsoMessage.java +++ b/src/main/java/com/solab/iso8583/IsoMessage.java @@ -355,7 +355,7 @@ public class IsoMessage { for (int i : idx) { IsoValue v = src.getField(i); if (v != null) { - setValue(i, v.getValue(), v.getType(), v.getLength()); + setValue(i, v.getValue(), v.getEncoder(), v.getType(), v.getLength()); } } } diff --git a/src/main/java/com/solab/iso8583/IsoValue.java b/src/main/java/com/solab/iso8583/IsoValue.java index add7791..687d971 100644 --- a/src/main/java/com/solab/iso8583/IsoValue.java +++ b/src/main/java/com/solab/iso8583/IsoValue.java @@ -177,6 +177,11 @@ public class IsoValue implements Cloneable { return value == null ? 0 : toString().hashCode(); } + /** Returns the CustomField encoder for this value. */ + public CustomField getEncoder() { + return encoder; + } + /** Writes the formatted value to a stream, with the length header * if it's a variable length type. */ public void write(OutputStream outs, boolean binary) throws IOException {