Added future tolerance to Date10 and Date4 parsers; simplified the use of generics in all the FieldParseInfo subclasses. Added a test for the future tolerance of date parsers.
git-svn-id: https://j8583.svn.sourceforge.net/svnroot/j8583/j8583@85 db60a039-f72e-0410-b1d2-baa000846441
This commit is contained in:
@@ -37,8 +37,7 @@ public class LllbinParseInfo extends FieldParseInfo {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IsoValue<?> parse(byte[] buf, int pos, CustomField<T> custom)
|
||||
throws ParseException {
|
||||
public IsoValue<?> parse(byte[] buf, int pos, CustomField<?> custom) throws ParseException {
|
||||
if (pos < 0) {
|
||||
throw new ParseException(String.format("Invalid position %d", pos), pos);
|
||||
}
|
||||
@@ -56,7 +55,8 @@ public class LllbinParseInfo extends FieldParseInfo {
|
||||
if (custom == null) {
|
||||
return new IsoValue<byte[]>(type, binval, binval.length, null);
|
||||
} else {
|
||||
IsoValue<T> v = new IsoValue<T>(type, custom.decodeField(
|
||||
@SuppressWarnings("unchecked")
|
||||
IsoValue<?> v = new IsoValue(type, custom.decodeField(
|
||||
length == 0 ? "" : new String(buf, pos + 3, length)), length, custom);
|
||||
if (v.getValue() == null) {
|
||||
//problems decoding? return the string
|
||||
@@ -67,8 +67,7 @@ public class LllbinParseInfo extends FieldParseInfo {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> IsoValue<?> parseBinary(byte[] buf, int pos,
|
||||
CustomField<T> custom) throws ParseException {
|
||||
public IsoValue<?> parseBinary(byte[] buf, int pos, CustomField<?> custom) throws ParseException {
|
||||
length = ((buf[pos] & 0x0f) * 100) + (((buf[pos + 1] & 0xf0) >> 4) * 10) + (buf[pos + 1] & 0x0f);
|
||||
if (length < 0) {
|
||||
throw new ParseException(String.format("Invalid LLLBIN length %d pos %d", length, pos), pos);
|
||||
@@ -81,7 +80,8 @@ public class LllbinParseInfo extends FieldParseInfo {
|
||||
if (custom == null) {
|
||||
return new IsoValue<byte[]>(type, _v, null);
|
||||
} else {
|
||||
IsoValue<T> v = new IsoValue<T>(type, custom.decodeField(HexCodec.hexEncode(_v)), custom);
|
||||
@SuppressWarnings("unchecked")
|
||||
IsoValue<?> v = new IsoValue(type, custom.decodeField(HexCodec.hexEncode(_v)), custom);
|
||||
if (v.getValue() == null) {
|
||||
return new IsoValue<byte[]>(type, _v, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user