Andrew I have applied this fix to master, are you in position to verify the fix 
works for your app?

I also confirmed with the author that IN supports integers or quoted strings by 
design.
-- 
Jody Garnett

On 25 April 2014 at 2:24:29 pm, Jody Garnett ([email protected]) wrote:

Not it is cool, I am hijacking your bug report as I noticed that ECQL outputs 
"x IN (fred.1)" rather than "x IN ('fred.1')"  (i.e. with single quotes around 
the feature ids.

Fun fun.
Jody

Jody Garnett


On Fri, Apr 25, 2014 at 1:48 PM, Andrew Hulbert <[email protected]> wrote:
Yeah...hahaha I'll see if I can dig up a better example somewhere and send it 
to you. We must have some IN queries somewhere!

Thanks for adding it to the tracker.

Andrew


On Thu, Apr 24, 2014 at 11:39 PM, Jody Garnett <[email protected]> wrote:
Yep - confirmed it is a bug :)

I have reported it to our issue tracker here: 
https://jira.codehaus.org/browse/GEOT-4783

Thanks for the test case, while it is enough it is enough to produce a strack 
trace is does not quite verify functionality :)

    @Test
    public void test(){
        FilterFactory ff = 
CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        Filter filter = ff.id( Collections.singleton(ff.featureId("fred")));
        assertEquals("IN (fred)", ECQL.toCQL(filter) );
    }



Jody Garnett


On Fri, Apr 25, 2014 at 12:50 AM, Andrew Hulbert <[email protected]> wrote:
FYI I'm using geotools 11.0

It throws a ClassCastException before it printlns in the ICQL.toCQL method 
(line 230):


StringBuilder output = (StringBuilder) filter.accept( toCQL, new 
StringBuilder() );

Exception here:
java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.StringBuilder
    at org.geotools.filter.text.ecql.ECQL.toCQL(ECQL.java:230)
    at geomesa.core.FilterFailTest.test(FilterFailTest.java:26)

Specifically, its caused by the fact that the filter Id that is returned by the 
FilterFactory is visited by the class FilterToECQL line 100 which is the method 
that returns a String rather than a StringBuilder like it does for other 
Filters.

Test:
    @Test
    public void test(){
        FilterFactory ff = 
CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        Filter filter = ff.id( Collections.singleton(ff.featureId("fred")));

        System.out.println(ECQL.toCQL(filter)) ;
    }


On Thu, Apr 24, 2014 at 10:35 AM, Jody Garnett <[email protected]> wrote:
We should probably move this conversation over to the user list:

What does System.out.println( ECQL.toCQL( filter ) ) give you?



Jody Garnett


On Fri, Apr 25, 2014 at 12:18 AM, Andrew Hulbert <[email protected]> wrote:
Thanks for the Reply! Is the access pattern or usage of the API in this code 
incorrect then? It works for other filters but not for the id filter.

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);
    }

}

-Andrew




On Thu, Apr 24, 2014 at 10:15 AM, Jody Garnett <[email protected]> wrote:
I think that is by design, the toCQL method is not a "visitor" but instead a 
public utility method making it easier to call and use the visitor object.

I think we actually wrapped up all the utility methods into the CQL and ECQL 
classes to make this stuff easier to use.

Jody

Jody Garnett


On Thu, Apr 24, 2014 at 11:57 PM, Andrew Hulbert <[email protected]> wrote:
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


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel








------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to