Skip to content

BeanIO reads preceding content when processing a segment #130

Description

@GoogleCodeExporter
BEANIO VERSION: 2.1.0
JDK VERSION: Same error for both 32 and 64 versions of 1.8.0_25

I'm using annoted classes for the mapping; one for the main record and one for 
the segment.

THE CODE:
(getters removed)
@Record(minOccurs = 1)
@Fields({
    @Field(name = "type", at = 0, rid = true, literal = "053")
})
public class Ip0053 {
    @Field(at = 3, length = 7, format = "yyDDDHH")
    private Date effectiveTimestamp;
    @Field(at = 10, length = 1)
    private Character active;
    @Field(at = 11, length = 3)
    private String tableId;
    @Field(at = 14, length = 11)
    private long feeCodePointer;
    @Field(at = 25, length = 3)
    private String rateType;
    @Field(at = 28, length = 3)
    private String paymentParty;
    @Field(at = 31, length = 3)
    private short currencyCodeNumeric;
    @Field(at = 34, length = 1)
    private short exponent;
    @Field(at = 46, length = 4)
    private String programType;
    @Field(at = 50, length = 2)
    private String feeTypeCode;
    @Field(at = 52, length = 2)
    private short noOfFeeSegments;    
    @Segment(minOccurs = 1, maxOccurs = 10)
    Collection<Ip0053Segment> ip0053Segment;
}

AND

public class Ip0053Segment {
    @Field(at = 0, length = 17)
    private long transactionAmountRangeLow;
    @Field(at = 17, length = 11)
    private long interchangeRate;
    @Field(at = 28, length = 2)
    private String rateDirection;
    @Field(at = 30, length = 11)
    private long unitFee;
    @Field(at = 41, length = 2)
    private String feeDirection;
    @Field(at = 43, length = 12)
    private String minimumFeeLimit;
    @Field(at = 55, length = 12)
    private String maximumFeeLimit;
    @Field(at = 67, length = 2)
    private String minimumMaximumDirection;
}

THE INPUT:
0531021214A04900000000001000ACQ0322               
00010000000000000000000000000000CR00000650000CR                        CR
(123 characters; note the blank portion)

THE OUTPUT:
I write out all field errors.

KEY: minimumFeeLimit
Invalid field length, expected 12 characters
KEY: maximumFeeLimit
Expected minimum 1 occurrences
KEY: interchangeRate
Type conversion error: Invalid Long value '000650000CR'
KEY: minimumMaximumDirection
Expected minimum 1 occurrences
KEY: unitFee
Type conversion error: Invalid Long value 'Q0322'
KEY: transactionAmountRangeLow
Type conversion error: Invalid Long value '0531021214A049000'
Type conversion error: Invalid Long value '0000000000000CR00'
Invalid 'ip0053' record at line 2

If I remove minOccurs and maxOccursfrom the segment declaration I get less:
KEY: unitFee
Type conversion error: Invalid Long value 'Q0322'
KEY: transactionAmountRangeLow
Type conversion error: Invalid Long value '0531021214A049000'
Invalid 'ip0053' record at line 2

Original issue reported on code.google.com by thra...@gmail.com on 14 Jan 2015 at 1:27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions