[Geoserver-devel] [jira] Created: (GEOS-328) Multiple levels of logic operators

Multiple levels of logic operators
----------------------------------

         Key: GEOS-328
         URL: http://jira.codehaus.org/browse/GEOS-328
     Project: GeoServer
        Type: Bug
  Components: WFS
    Versions: 1.3.0-beta2
    Reporter: dblasby
Assigned to: Chris Holmes
     Fix For: 1.3-rc1

from : jfletcher@anonymised.com

I posted this issue to the geoserver list, but I think it's more
appropriately a GeoTools question. Not familiar enough with the lists to
know whether this should go to users or devel, so I apologize in advance
if this is in the wrong spot.

It seems that Filters sent to GeoServer which have > 2 levels of nested
logic fail. For example, the following structure will fail:

<And>
  <Or>
    <Not>
      <PropertyIsEqualTo.../>
    </Not>
    <PropertyIsEqualTo.../>
  </Or>
  <PropertyIsEqualTo.../>
</And>

With the following error:

Attempted to construct illegal filter: Logic Factory got an end message
that it can't process.

In org.geotools.filter.LogicSAXParser.start(...), a new LogicSAXParser
is created even if the existing one is not null, effectively limiting
the logic depth to 2 levels. Changing the line:

logicFactory = new LogicSAXParser();

to:

if (logicFactory == null) {
  logicFactory = new LogicSAXParser();
}

may solve the issue, but I'm not at all familiar with the GeoTools code
(I've only just looked at it yesterday) so my suggestion may have
ramifications of which I am unaware. I've also not tested it...

Any thoughts? Is the logic filter depth meant to be limited to 2
levels? Is my analysis correct?

John
---------------

actual test request (for UserBasic standard config):

<wfs:GetFeature service="WFS" version="1.0.0"
  outputFormat="GML2"
  xmlns:topp="http://www.openplans.org/topp&quot;
  xmlns:wfs="http://www.opengis.net/wfs&quot;
  xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:gml="http://www.opengis.net/gml&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/wfs
                      http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;
<wfs:Query typeName="states" >
   <Filter>
  <And>
  <Or>
    <Not>
       
       <PropertyIsEqualTo>
       <PropertyName>STATE_NAME</PropertyName>
       <Literal>daveville</Literal>
  </PropertyIsEqualTo>
       
     </Not>
         <PropertyIsEqualTo>
           <PropertyName>STATE_NAME</PropertyName>
           <Literal>belongadave</Literal>
      </PropertyIsEqualTo>

  </Or>
       <PropertyIsEqualTo>
         <PropertyName>STATE_NAME</PropertyName>
         <Literal>Wisconsin</Literal>
    </PropertyIsEqualTo>

</And>
</Filter>
    </wfs:Query>
</wfs:GetFeature>

-------------------------
-
  <ServiceExceptionReport version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/geoserver/data/capabilities//wfs/1.0.0/OGC-exception.xsd&quot;&gt;
-
  <ServiceException locator="org.vfny.geoserver.util.requests.readers.XmlRequestReader">

      org.xml.sax.SAXException: Attempted to construct illegal filter: Logic Factory got an end message that it can't process.
</ServiceException>
</ServiceExceptionReport>

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira