When a record element is ignored in the configuration XML produces a NullPointer at parsing:
Example configuration:
<record-definition> <bean name="street" class="main.Street" /> <bean name="person" class="main.Person" /> <line> <record-element length="40" beanref="person.name" converter-name="char"> <conversion-option name="justify" value="left" /> </record-element> <record-element length="2" beanref="person.age" converter-name="integer"> </record-element> <record-element length="30" beanref="person.ocuppation" converter-name="char"> <conversion-option name="justify" value="left" /> </record-element> <record-element length="5" beanref="street.zipCode" converter-name="integer"> </record-element> <record-element length="3" beanref="street.number" converter-name="integer"> </record-element> <record-element length="2" ignore-field="true"/> <!-- NullPointer --> <record-element length="50" beanref="street.address" converter-name="char" /> </line> </record-definition>
In the class LineBO (line 220), when you run the code:
if (recordElement.getCardinality().getBeanRef() != null) {
you get a null pointer exception because there is no cardinality (the record-element is ignored).
There should be a check to know if the record must be parsed (recordElement.isIgnoreField())
When a record element is ignored in the configuration XML produces a NullPointer at parsing:
Example configuration:
<record-definition> <bean name="street" class="main.Street" /> <bean name="person" class="main.Person" /> <line> <record-element length="40" beanref="person.name" converter-name="char"> <conversion-option name="justify" value="left" /> </record-element> <record-element length="2" beanref="person.age" converter-name="integer"> </record-element> <record-element length="30" beanref="person.ocuppation" converter-name="char"> <conversion-option name="justify" value="left" /> </record-element> <record-element length="5" beanref="street.zipCode" converter-name="integer"> </record-element> <record-element length="3" beanref="street.number" converter-name="integer"> </record-element> <record-element length="2" ignore-field="true"/> <!-- NullPointer --> <record-element length="50" beanref="street.address" converter-name="char" /> </line> </record-definition>In the class LineBO (line 220), when you run the code:
if (recordElement.getCardinality().getBeanRef() != null) {you get a null pointer exception because there is no cardinality (the record-element is ignored).
There should be a check to know if the record must be parsed (recordElement.isIgnoreField())