1

My text file has 00 as state. I want to pass 00 to setState metod of Person object using BeanIO. But getting exception like Invalid state:Required field not set. It is accepting spaces but not zeros.

My mapping file is:

<beanio>
    <stream name="acesFile" format="fixedlength" strict="true">
        <record name="personObj" class="com.hbe.conversion.businessObjects.Person"  occurs="0+">
            <field name="state" position="0" length="2" required="true" padding="0"      />
        </record>
    </stream>
</beanio>

Method in Person class :

public void setState(String state) {
    this.state = state;
}
srk
  • 11
  • 1

1 Answers1

1

Try setting keepPadding="true" on the field definition.

Kevin Seim
  • 11
  • 1