GeoTools
  1. GeoTools
  2. GEOT-2681

CQL implementation doesn't handle large numbers

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.8, 2.6-M3
    • Fix Version/s: 2.5.8, 2.6-M3
    • Component/s: cql
    • Labels:
      None

      Description

      Hi Russell,

      We are currently using the geotools library to parse queries to our geological unit web service. We use the CQL libraries shipped with Geotools for this.

      We came across an issue with the CQL classes when we try to parse a query with a number which has 16 digits. For example if we try to parse something like

      Gmlid = 123456789012345

      Using CQL.toFilter () it fails with the following exception. I assume this is happening because geotools library is trying to store this large number as an integer. This is a very critical issue for our system as we use these large number every where in our systems as ids.

      Exception in thread "main" java.lang.NumberFormatException: For input string: "123456789012345"
      at java.lang.NumberFormatException.forInputString(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at org.geotools.filter.text.commons.AbstractFilterBuilder.buildLiteralInteger(AbstractFilterBuilder.java:369)
      at

      Regards

      Anuruddha

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

      Russell,

      it looks to me like an implementation limitation in the CQL parser. Much
      of this is autogenerated so it should be straightforward to fix.

      The database drivers and filter implementation support Java Long. There
      is no reason of which I am aware for the CQL implementation to not
      support at least Long. BigInteger will cause more trouble, but Long will
      give you 18 digits.

      The XSD spec requires a minimum of 18 digit support.
      http://www.w3.org/TR/xmlschema-2/#decimal

      Kind regards,
      Ben.

      ------------------------------------------------------------------------------------------------------------------------------------------------
      Could the code please be changed to handle at least Longs? This would be big enough for Anuruddha.

        Activity

        Hide
        Mauricio Pazos added a comment -
        I will change the implementation to use Long valid values. The fix will have as limit Long.MAX_VALUE (2^63 - 1)

        cheers
        Show
        Mauricio Pazos added a comment - I will change the implementation to use Long valid values. The fix will have as limit Long.MAX_VALUE (2^63 - 1) cheers
        Hide
        Mauricio Pazos added a comment -
        Reopened to backport to 2.5.x branch
        Show
        Mauricio Pazos added a comment - Reopened to backport to 2.5.x branch

          People

          • Assignee:
            Mauricio Pazos
            Reporter:
            Russell Petty
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: