GeoTools
  1. GeoTools
  2. GEOT-267

DbaseFileHeader bug in attribute class assignement

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.RC1
    • Fix Version/s: None
    • Component/s: shapefile plugin
    • Labels:
      None
    • Environment:
      Windows, Java

      Description

      DbaseFileHeader mistakes when a "number" type arrives: it always assigns "Integer" type.
      If the number is too big, it could not fit into an Integer (as in my case), so I made this modification in getFieldClass:

      case 'N':
      if (fields[i].decimalCount == 0)

      { if (fields[i].fieldLength>9) typeClass = Long.class; else typeClass = Integer.class; }

      else

      { typeClass = Double.class; }

      break;

      1. DbaseFileHeader.java
        21 kB
        Alessandro Monopoli

        Activity

        Hide
        Alessandro Monopoli added a comment -
        Sure I can! :-) Sorry for the delay
        Show
        Alessandro Monopoli added a comment - Sure I can! :-) Sorry for the delay
        Hide
        Alessandro Monopoli added a comment -
        Ehmm... I don't find the link to upload a file :-(
        Show
        Alessandro Monopoli added a comment - Ehmm... I don't find the link to upload a file :-(
        Hide
        Andrea Aime added a comment -
        Can you send it to me then? andrea.aime@aliceposta.it
        A small one, please :-)
        Show
        Andrea Aime added a comment - Can you send it to me then? andrea.aime@aliceposta.it A small one, please :-)
        Hide
        Jody Garnett added a comment -
        This is a patch to allow larger numbers out of a shapefile.
        Show
        Jody Garnett added a comment - This is a patch to allow larger numbers out of a shapefile.
        Hide
        Andrea Aime added a comment -
        The current code reads as:

        {code}
        case 'N':
                    if (fields[i].decimalCount == 0) {
                        if (fields[i].fieldLength < 10) {
                            typeClass = Integer.class;
                        } else {
                            typeClass = Long.class;
                        }
                    } else {
                        typeClass = Double.class;
                    }
                    break;
        {code}

        So I guess the user suggestion was merged
        Show
        Andrea Aime added a comment - The current code reads as: {code} case 'N':             if (fields[i].decimalCount == 0) {                 if (fields[i].fieldLength < 10) {                     typeClass = Integer.class;                 } else {                     typeClass = Long.class;                 }             } else {                 typeClass = Double.class;             }             break; {code} So I guess the user suggestion was merged

          People

          • Assignee:
            Jesse Eichar
            Reporter:
            Alessandro Monopoli
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: