0

I am trying to parse an input text file ( not CSV) which is fixedFormat.

@FixedLengthDataRecord(ignoreMissingChars = true, ignoreTrailingChars= true)
public class ParsedDataRec {

@DataField(pos = 3, length=5, required=false)
public String field1;

@DataField(pos = 9, length=5, required=false, default="0")
public int field2;

@DataField(pos = 15, length=4, required=false)
public String field3;

}

I have input text file like this:

000ACBDC099867AAAAAAZZZZZZ

000ACBDC0 < space ->< space ->< space ->< space ->< space -> AAAAAAZZZZZZ

Please note that Record1 = 000ACBDC099867AAAAAAZZZZZZ Record2 = 000ACBDC0< space ->< space ->< space ->< space ->< space ->AAAAAAZZZZZZ The error is happenning as camel tries to parse the field2 which in some records is just spaces. How to avoid error in those records

For the second record I get IllegalArguementException. I already made the record optional. Also please note ignoreMissingChars = true.

Please let me know how i can resolve this issue.

Thanks a lot in advance

theBittor
  • 786
  • 1
  • 11
  • 20
user2442578
  • 31
  • 1
  • 1
  • 3
  • Please note that Record1 = 000ACBDC099867AAAAAAZZZZZZ Record2 = 000ACBDC0AAAAAAZZZZZZ The error is happenning as camel tries to parse the field2 which in some records is just spaces. How to avoid error in those records – user2442578 Jan 13 '21 at 18:54
  • Which version of Camel are you using? – theBittor Jan 19 '21 at 11:58

0 Answers0