Hi,
not sure who's the IndexedShapefileDataStore maintainer (guess Jesse?), but
I'm quite sure I found a bug while working on
http://jira.codehaus.org/browse/GEOT-1192
- DbaseFileHeader sets the maximum lenght of an Integer field to 9 (see line
129 in DbaseFileHeader).
- ShapefileDataStore (line 1141) respects it, but IndexedShapefileDataStore
(line 1500) does not. So a schema with an int attribute created through
IndexedShapefile... gets saved and then reloaded as Long instead of Integer.
The strange thing is I still don't know why I got trapped on it while
migrating main to use opengis Filtes (symptom being
ShapefileRTreeReadWriteTest.testAll started to fail), but that's another
history.
IndexedShapefileDataStore.java:
1497 // @todo respect field length
1498 if ((colType == Integer.class) || (colType ==
Short.class)
1499 || (colType == Byte.class)) {
1500 header.addColumn(colName, 'N',
Math.min(fieldLen, 10), 0);
1501 } else if (colType == Long.class) {
ShapefileDataStore.java:
1138 // @todo respect field length
1139 if ((colType == Integer.class) || (colType == Short.class)
1140 || (colType == Byte.class)) {
1141 header.addColumn(colName, 'N', Math.min(fieldLen, 9), 0);
1142 } else if (colType == Long.class) {
DbaseFileHeader.java:
127 case 'N':
128 if (fields[i].decimalCount == 0) {
129 if (fields[i].fieldLength<10) {
130 typeClass = Integer.class;
131 } else {
132 typeClass = Long.class;
133 }
regards,
Gabriel
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel