Ticket #178 (closed defect: fixed)
Trouble parsing the CQL expressions, upgrade geotools version
| Reported by: | mcoudert | Owned by: | mcoudert |
|---|---|---|---|
| Priority: | minor | Milestone: | v2.5.0 |
| Component: | General | Version: | v2.4.2 |
| Keywords: | CSW Geotools CQL | Cc: | groldan@… |
Description
Reported by Gabriel Roldan http://n2.nabble.com/Parsing-CQL-and-upgrade-geotools-version-td4172050.html
I found that GN was having trouble parsing the CQL expressions in my requests, so I went ahead and took a look. I'm working on GeoNetwork trunk from svn.
What I found is that AbstractOperation?.convertCQL(String):Element is using the GeoTool?'s old xml tech to encode the org.opengis.filter.Filter to an XML string. That is, org.geotools.filter.FilterTransformer? instead of org.geotools.xml.Encoder. The rest of the code base seems to correctly being using org.geotools.xml.Parser (the Encoder counterpart).
Problem is FilterTransformer? is old and I guess it works only with Filter 1.0., and it fails with an exception if trying to encode a PropertyIsLike? filter.
Changing the code as in the following patch to use Encoder instead solves the problem: < http://pastebin.com/m2daef52f>, but with the catch of having to upgrade the geotools version used by GeoNetwork. Currently GN uses GeoTools? 2.5.1, which ignored a PropertyIsLike? filter producing an empty Filter xml string. Upgrading to the latest 2.5 release solves it.
