GeoTools
  1. GeoTools
  2. GEOT-3026

Invalid Filter Construction for WFS-1.0.0

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.3
    • Fix Version/s: 2.6.4, 2.7-M0
    • Component/s: xml
    • Labels:
      None
    • Environment:
      Windows 7 (x64), Java 1.6.0_19,

      Description

      Invalid Filter-Construction for a GetFeature-Request on WFS 1.0.0. The Class org.geotools.xml.filter.FilterOpsComplexTypes.FilterType creates two filter terms (Line 885 - 891) by calling encodeFilter() twice. The first time for the real filter, the second time for a Fid-Filter (usually empty). The result is a filter-element with a nested filter-element. This is not allowed by the OGC Filter Specification and causes errors on some implementing WFS.

        Activity

        Hide
        Jody Garnett added a comment -
        Okay I can see the code you are talking about:

        if( !visitor.getFilter().equals(Filter.EXCLUDE) ){
            encodeFilter(visitor.getFilter(),output,hints);
        }
        encodeFilter(visitor.getFidFilter(), output, hints);

        So here is an idea ....

        A FID Filter is kind of a magic accident of the XSD definition; explicitly set up so you can do a query using either a real filter providing a test that can be performed against each and every filter; or using a set of FeatureIDs.

        I kind of think of them as a "filter" or a "selection" ... and the filter XSD is set up so you cannot mix and match these two in the same query (you cannot "NOT" a "selection").

        With this in mind how about the following modification:
        if(!visitor.getFidFilter().getIDs().isEmpty()){
           encodeFilter(visitor.getFidFilter(), output, hints);
        }


        Show
        Jody Garnett added a comment - Okay I can see the code you are talking about: if( !visitor.getFilter().equals(Filter.EXCLUDE) ){     encodeFilter(visitor.getFilter(),output,hints); } encodeFilter(visitor.getFidFilter(), output, hints); So here is an idea .... A FID Filter is kind of a magic accident of the XSD definition; explicitly set up so you can do a query using either a real filter providing a test that can be performed against each and every filter; or using a set of FeatureIDs. I kind of think of them as a "filter" or a "selection" ... and the filter XSD is set up so you cannot mix and match these two in the same query (you cannot "NOT" a "selection"). With this in mind how about the following modification: if(!visitor.getFidFilter().getIDs().isEmpty()){    encodeFilter(visitor.getFidFilter(), output, hints); }
        Hide
        Martin Firl added a comment -
        This sounds ok to me. Theoretically, we still violate the specification, but it's in users hand to use the FID Filter or not. So it's a compromise that works.
        Show
        Martin Firl added a comment - This sounds ok to me. Theoretically, we still violate the specification, but it's in users hand to use the FID Filter or not. So it's a compromise that works.
        Hide
        Jody Garnett added a comment -
        The user would need to make an "invalid" filter before we would violate the specification.
        Show
        Jody Garnett added a comment - The user would need to make an "invalid" filter before we would violate the specification.
        Hide
        Jody Garnett added a comment -
        Patch applied as described; it would be handy if Martin could test and/or tell us a server that has trouble that we should test against?
        Show
        Jody Garnett added a comment - Patch applied as described; it would be handy if Martin could test and/or tell us a server that has trouble that we should test against?
        Hide
        Martin Firl added a comment -
        I could successfuly test this bugfix whith the following WFS:
        http://cardo3.idu.de/net3/public/ogc.ashx?PkgId=39&Service=WFS&Request=GetCapabilities
        Show
        Martin Firl added a comment - I could successfuly test this bugfix whith the following WFS: http://cardo3.idu.de/net3/public/ogc.ashx?PkgId=39&Service=WFS&Request=GetCapabilities

          People

          • Assignee:
            Jody Garnett
            Reporter:
            Martin Firl
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: