gautamdudeja90 / beanio

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

Fixed length, optional, ignored fields do not honor non-space padding setting #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following side effect for the fix to issue #11 has been observed:

A field defined such as the one below will always marshal as spaces no matter 
the padding setting.

<field name="xxx" length="3" padding="A" ignore="true" />

As a workaround, if the stream is used for writing/marshaling only, you can set 
required="true" to marshal the field as "AAA".

The rules defined in issue #11 will likely be modified to exclude ignored 
fields from writing null values as all spaces (no matter the padding 
configuration), because ignored fields are always null.

Original issue reported on code.google.com by kevin.s...@gmail.com on 6 Oct 2011 at 1:37

GoogleCodeExporter commented 9 years ago
Upon further consideration, the rules as defined in issue #11 will not be 
changed.  Instead, the 'default' attribute will always be marshaled (when set) 
for fields where ignore="true".  Thus, in the previous example, the field could 
be marshaled as "AAA" using the following definition:

<field name="xxx" length="A" ignore="true" default="" />

If a default value is not set, the field will continue to marshaled as "   ".

This fix is planned for release 1.2.2.

Original comment by kevin.s...@gmail.com on 16 Dec 2011 at 4:45

GoogleCodeExporter commented 9 years ago
Fixed for release 1.2.2.  A configured field default will now be marshaled for 
ANY null property value or field where ignore=true.

For backwards compatibility, this feature can be disabled by setting 
'org.beanio.marshalDefaultEnabled' to 'false'.  See Configuration details in 
the reference guide.

Original comment by kevin.s...@gmail.com on 17 Dec 2011 at 4:31

GoogleCodeExporter commented 9 years ago

Original comment by kevin.s...@gmail.com on 18 Dec 2011 at 10:58