[Geoserver-devel] [jira] Created: (GEOS-4643) GetFeatureInfo and SLD substitution fails

GetFeatureInfo and SLD substitution fails
-----------------------------------------

                 Key: GEOS-4643
                 URL: https://jira.codehaus.org/browse/GEOS-4643
             Project: GeoServer
          Issue Type: Bug
          Components: WMS
    Affects Versions: 2.1.0, 2.1.x
            Reporter: Hajo Kliemeck
            Assignee: Andrea Aime
         Attachments: GetFeatureInfo-2-1-1.java.patch, GetFeatureInfo-trunk.java.patch

if I make a getfeatureinfo request, with a stylesheet included, to my wms server, it will not find any features although he should find at least one.
The request without a stylesheet will give me the desired feature.

The problem is that the FeatureCollection holding the FeatureReader and the Filter's from the SLD will be evaluated after the ENV-Cache was cleared.

{code}
EnvFunction.setLocalValues(request.getGetMapRequest().getEnv());
try {
    results = execute(request);
} finally {
    EnvFunction.clearLocalValues();
}

... evaluate collection ...

{code}

The solution: before the cache is emptied, the collection must be evaluated (in this case by DefaultFeatureCollection.addAll())

{code}
public DefaultFeatureCollection( FeatureCollection<SimpleFeatureType,SimpleFeature> collection ) {
    this( collection.getID(), collection.getSchema() );
    addAll(collection);
}
{code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira