pradeepsjsu / beanio

Automatically exported from code.google.com/p/beanio
Apache License 2.0
0 stars 0 forks source link

It is writing a record group when the bean is null. Then a exception is raised. #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The group named "regC140" should not be written to the file because bean is 
null.
An exception is raised in the registry named "regC141List" because the bean 
"regC140" is null.

See part of mapping:

...
<group name="regC140" order="6" maxOccurs="1" 
class="coffeepot.br.sped.fiscal.blocos.blocoC.RegC140">
  <record name="regC140" order="1" minOccurs="1" maxOccurs="1" >
    <field name="delimiter" literal="" ignore="true"/>
    <field name="reg" rid="true" literal="C140" ignore="true" />          
    <field name="indEmit" typeHandler="emissaoDocumentoHandler" />
    <field name="indTit" typeHandler="tipoTituloCreditoHandler" />
    <field name="descTit" type="string"/>
    <field name="numTit" type="string"/>               
    <field name="qtdParc" type="int"/>
    <field name="vlTit" type="double"/>                
    <field name="delimiter" literal="" ignore="true"/>
  </record>

  <record name="regC141List" class="coffeepot.br.sped.fiscal.blocos.blocoC.RegC141" order="2" collection="list" >
    <field name="delimiter" literal="" ignore="true"/>
    <field name="reg" rid="true" literal="C141" ignore="true" />
    <field name="numParc" type="int"/>
    <field name="dtVcto" type="date"/>
    <field name="vlParc" type="double"/>                
    <field name="delimiter" literal="" ignore="true"/>
  </record>
</group>
...

Should not be writing the record "regC140" when the bean is null.

I'm using BeanIO 2.0.6, JDK 7.

Attached the project with the problem.
The xml mapping: in other sources: 
coffeepot.br.sped.fiscal.beanio.blocoC.RegC100.xml
The test class: coffeepot.br.sped.fiscal.blocos.blocoC.BlocoCTest

Original issue reported on code.google.com by jean.mer...@gmail.com on 5 Jun 2013 at 2:23

Attachments:

GoogleCodeExporter commented 8 years ago
I don't have JDK1.7 installed to run your code, but I suspect the only issue is 
that you need to add minOccurs="0" to that group definition.

Thanks,
Kevin

Original comment by kevin.s...@gmail.com on 6 Jun 2013 at 2:21

GoogleCodeExporter commented 8 years ago
This issue will be closed if no further information is provided.

Original comment by kevin.s...@gmail.com on 14 Jun 2013 at 3:24

GoogleCodeExporter commented 8 years ago
Closed due to lack of further information.

Original comment by kevin.s...@gmail.com on 19 Jun 2013 at 1:36