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:
@@ -36,7 +36,7 @@ public class LllvarParseInfo extends FieldParseInfo {
|
||||
super(IsoType.LLLVAR, 0);
|
||||
}
|
||||
|
||||
public <T extends Object> IsoValue<?> parse(byte[] buf, int pos, CustomField<T> custom)
|
||||
public IsoValue<?> parse(byte[] buf, int pos, CustomField<?> custom)
|
||||
throws ParseException, UnsupportedEncodingException {
|
||||
if (pos < 0) {
|
||||
throw new ParseException(String.format("Invalid position %d", pos), pos);
|
||||
@@ -62,7 +62,8 @@ public class LllvarParseInfo extends FieldParseInfo {
|
||||
if (custom == null) {
|
||||
return new IsoValue<String>(type, _v, length, null);
|
||||
} else {
|
||||
IsoValue<T> v = new IsoValue<T>(type, custom.decodeField(_v), length, custom);
|
||||
@SuppressWarnings("unchecked")
|
||||
IsoValue<?> v = new IsoValue(type, custom.decodeField(_v), length, custom);
|
||||
if (v.getValue() == null) {
|
||||
//problems decoding? return the string
|
||||
return new IsoValue<String>(type, _v, length, null);
|
||||
@@ -71,8 +72,8 @@ public class LllvarParseInfo extends FieldParseInfo {
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Object> IsoValue<?> parseBinary(byte[] buf, int pos, CustomField<T> custom)
|
||||
throws ParseException, UnsupportedEncodingException {
|
||||
public IsoValue<?> parseBinary(byte[] buf, int pos, CustomField<?> custom)
|
||||
throws ParseException, UnsupportedEncodingException {
|
||||
length = ((buf[pos] & 0x0f) * 100) + (((buf[pos + 1] & 0xf0) >> 4) * 10) + (buf[pos + 1] & 0x0f);
|
||||
if (length < 0) {
|
||||
throw new ParseException(String.format("Invalid LLLVAR length %d pos %d", length, pos), pos);
|
||||
@@ -83,7 +84,8 @@ public class LllvarParseInfo extends FieldParseInfo {
|
||||
if (custom == null) {
|
||||
return new IsoValue<String>(type, new String(buf, pos + 2, length, getCharacterEncoding()), null);
|
||||
} else {
|
||||
IsoValue<T> v = new IsoValue<T>(type, custom.decodeField(new String(buf, pos + 2, length, getCharacterEncoding())), custom);
|
||||
@SuppressWarnings("unchecked")
|
||||
IsoValue<?> v = new IsoValue(type, custom.decodeField(new String(buf, pos + 2, length, getCharacterEncoding())), custom);
|
||||
if (v.getValue() == null) {
|
||||
return new IsoValue<String>(type, new String(buf, pos + 2, length, getCharacterEncoding()), null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user