Folks (especially Jody),

I know this is more of a GeoTools 2.6 question, but...

I wanted to sort a FeatureCollection, hence I wrote something like:

FilterFactory filterFactory = CommonFactoryFinder
.getFilterFactory(null);

SortByImpl sort = (SortByImpl) filterFactory.sort(
BulletinIngestor.NAMECOLUMN, SortOrder.ASCENDING);

SubFeatureList outList = new SubFeatureList(outColl, sort);

Iterator<SimpleFeature> featIter = (Iterator<SimpleFeature>) outList
.openIterator();

But the last line gave me an NPE...

I investigated a bit, and it turned out that openIterator() eventually called 
createIndex(), which in turn called getFeatureMember(), which relies on the 
index 
member variable, which is created by createIndex() !

So, unless I got it wrong, I presume there is something flawed in 
SubFeatureList, 
since it relies on the sorted List to produce the sorted List instead on 
relying 
the un-sorted Collection.

I solved the issue by subclassing SubFeatureList and overriding 
getFeatureMember: 
shall I open an issue and attach a patch to solve the problem directly within 
SubFeatureList ?

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to