I think we may want to move this one to geotools user list :-) Try specifying the "sort" as part of you Query; this has much more consistent support between implementations.
SubFeatureList is usually used by data store implementors inside the: - FeatureCollection.subCollection( filter ) - FeatureCollection.sort( SortBy ) But yes it sounds like you found an issue; please be sure to include a test case with your patch so we can see what is going on. Jody On 05/07/2010, at 8:55 PM, Luca Morandini wrote: > 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 ------------------------------------------------------------------------------ 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 _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
