Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.1.M2
-
Fix Version/s: None
-
Component/s: shapefile plugin
-
Labels:None
-
Environment:WinXPPro, Win2000, Java 1.4.2-b28
Description
We have a shapefile with a field of type NUMBER(11) (Precision=11 and scale=0) which gives truncated values when read.
We suspect that the bug lies in the method
getFieldClass(int i)
of class
org\geotools\data\shapefile\dbfDbaseFileHeader
since it does not take into account the possibility of values larger than Integer range.
This is the part of code we modified, which as far as we are concerned, resolve the problem:
case 'N':
if (fields[i].decimalCount == 0) {
if (fields[i].fieldLength<10)
else
{ typeClass = Long.class; }} else
{ typeClass = Double.class; }break;
Since we don't have a deep knowledge of the underlying behaviour of other components, we'd like to have a feedback of the correctness of our patch.