Hi,
I think I might have found a Class Cast bug where a StringBuilder is
expected but in certain cases a String is returned...It appears that
in org.geotools.filter.text.ecql.ECQL this method:
public static String toCQL( Filter filter ){
FilterToECQL toCQL = new FilterToECQL();
StringBuilder output = (StringBuilder) filter.accept(
toCQL, new StringBuilder() );
return output.toString();
}
is performing a cast to StringBuilder from accept methods for filters.
Almost all FilterVisitors return a String Builder except for the
method in class org.geotools.filter.text.ecql.FilterToECQL
public Object visit(Id filter, Object extraData) {}
this method returns a String causing the case to fail when
org.opengis.filter.Id is the Filter...
I've attached a sample class that causes the issue.
If this is not an issue let me know! If it is, how can I file a bug
report?
Thanks!
Andrew
package test;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.factory.GeoTools;
import org.geotools.feature.visitor.IdFinderFilterVisitor;
import org.geotools.filter.FidFilterImpl;
import org.geotools.filter.text.ecql.ECQL;
import org.junit.Test;
import org.opengis.filter.Filter;
import org.opengis.filter.FilterFactory;
import org.opengis.filter.FilterVisitor;
import org.opengis.filter.Id;
import org.opengis.filter.identity.Identifier;
import java.util.Collections;
import java.util.Set;
public class FilterFailTest {
@Test
public void test(){
FilterFactory ff = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
Filter filter = ff.id( Collections.singleton(ff.featureId("fred")));
ECQL.toCQL(filter);
}
}
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel