Fix #20 use FieldParseInfo's own CustomField if available

This commit is contained in:
Enrique Zamudio
2013-11-27 11:03:47 -06:00
parent 3b1cf15c3e
commit 38b161c1c6
@@ -423,7 +423,11 @@ public class MessageFactory<T extends IsoMessage> {
log.warn("Field {} is not really in the message even though it's in the bitmap", i);
bs.clear(i - 1);
} else {
IsoValue<?> val = fpi.parseBinary(i, buf, pos, getCustomField(i));
CustomField<?> decoder = fpi.getDecoder();
if (decoder == null) {
decoder = getCustomField(i);
}
IsoValue<?> val = fpi.parseBinary(i, buf, pos, decoder);
m.setField(i, val);
if (val != null) {
if (val.getType() == IsoType.NUMERIC || val.getType() == IsoType.DATE10
@@ -450,7 +454,11 @@ public class MessageFactory<T extends IsoMessage> {
log.warn("Field {} is not really in the message even though it's in the bitmap", i);
bs.clear(i - 1);
} else {
IsoValue<?> val = fpi.parse(i, buf, pos, getCustomField(i));
CustomField<?> decoder = fpi.getDecoder();
if (decoder == null) {
decoder = getCustomField(i);
}
IsoValue<?> val = fpi.parse(i, buf, pos, decoder);
m.setField(i, val);
//To get the correct next position, we need to get the number of bytes, not chars
pos += val.toString().getBytes(fpi.getCharacterEncoding()).length;