2

I'm working with Apache Camel Bindy, the version of Camel is 2.18.1. I have a text file, from where I'm reading the content. I read line by line and convert values using this class:

@FixedLengthRecord(length = 60, ignoreTrailingChars = true)
public class RecordClassBody implements Serializable {

and one of my properties is:

@DataField(pos = 4, length = 3, paddingChar = '0', trim = true)
private Integer count;

The thing is that when the value in the line is "000" the returning value of count is null, if I removed trim = true it works fine and the integer value is 0, but I need the trim. I can't find why is this happening and the true solution for this.

Jack1987
  • 727
  • 1
  • 14
  • 26
  • You say that you need the trim to be true, but the issue is that when you have `"000"`, and trim 0, you get "", which can't be converted to an integer. Without the trim, what happens when you have 003 say? Do you get 3? If so, why do you need then trim? – Screwtape Jan 24 '19 at 08:22
  • 1
    @Screwtape when the value is 003 the return is 3. The need for trim is because can be blank spaces, like " 3 " – Jack1987 Jan 24 '19 at 16:08

0 Answers0