On Mon, Oct 10, 2011 at 3:07 PM, Flavio Pompermaier <[email protected]> wrote:
> I replied to this post:
>
> http://www.mail-archive.com/[email protected]/msg20713.html
>
> I started to use geotools from few days so maybe there's a good reason
> for this behaviour..
>
> Is it sufficient to do this in the  private String fieldString(Object
> obj, final int col)  method?
>
>  case 'd':
>         if (obj==null)
>                o="";
>        else
>            o = formatter.getFieldString((Date) (obj == null ?
> NULL_DATE : obj));
>            break;
>
> instead of this?:
>
>  case 'd':
>            o = formatter.getFieldString((Date) (obj == null ?
> NULL_DATE : obj));
>            break;
> )

I don't believe so. The various specs for dbf around are not clear on how to
treat null values, but the approach taken by shapelib seems reasonable, a
field is null if it's made only with spaces:
http://shapelib.maptools.org/dbf_api.html
However DBF is a format with a fixed record length, so a single space won't
do, we'll need 8 (since that's the width of YYYYMMDD).
A proper patch will make sure this work both read and write wise, with tests

Cheers
Andrea

-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to