Well the exception in this case seems to result from a call to
Feature.getName(), which affair for simple features isn't ever used. And in
the case of jdbc features we actually have a custom implementation based
directly on a jdbc ResultSet.

A few options here.

1. Implement getName() in ResultSetFeature and return null?
2. Ditch ResultSetFeature and use a normal feature that implements
getName().




On Wed, Jan 22, 2014 at 4:13 PM, Jody Garnett <jody.garn...@gmail.com>wrote:

> We have several examples of general purpose feature collection / feature
> iterator wrappers. Such as the combo provided for handling reprojection.
>
> It is unclear from your stack trace what the issue is, I expect your
> original Query did not list the attributes you are referring to?
>
> Jody Garnett
>
>
> On Thu, Jan 23, 2014 at 3:49 AM, carlo cancellieri <
> carlo.cancelli...@geo-solutions.it> wrote:
>
>> Hi list,
>>  I'm developing a new SimpleFeatureCollectionReader which wraps
>> a SimpleFeatureCollection (ContentFeatureCollection) to iterating over it.
>> I'm not sure why this is not supported using an H2 datastore as source.
>> Note that I've already tested this with shpfile with success.
>> Is it possible to create some general purpose FeatureCollectionReader?
>> What/where I'm wrong?
>>
>> Here is the stack trace:
>>
>> -----------------------------------------------------
>> java.lang.UnsupportedOperationException
>> at
>> org.geotools.jdbc.JDBCFeatureReader$ResultSetFeature.getName(JDBCFeatureReader.java:750)
>>  at
>> org.geotools.filter.expression.DirectPropertyAccessorFactory$DirectPropertyAccessor.canHandle(DirectPropertyAccessorFactory.java:58)
>> at
>> org.geotools.filter.expression.PropertyAccessors.findPropertyAccessors(PropertyAccessors.java:128)
>>  at
>> org.geotools.filter.AttributeExpressionImpl.evaluate(AttributeExpressionImpl.java:254)
>> at
>> org.geotools.filter.AttributeExpressionImpl.evaluate(AttributeExpressionImpl.java:231)
>>  at
>> org.geotools.filter.GeometryFilterImpl.getGeometries(GeometryFilterImpl.java:250)
>> at
>> org.geotools.filter.GeometryFilterImpl.evaluate(GeometryFilterImpl.java:388)
>>  at org.geotools.filter.AndImpl.evaluate(AndImpl.java:57)
>> at
>> org.geotools.data.FilteringFeatureReader.hasNext(FilteringFeatureReader.java:130)
>>  at org.geotools.data.MaxFeatureReader.hasNext(MaxFeatureReader.java:86)
>> at
>> org.geotools.data.store.ContentFeatureCollection$WrappingFeatureIterator.hasNext(ContentFeatureCollection.java:208)
>>  at
>> org.geotools.data.cache.utils.SimpleFeatureCollectionReader.hasNext(SimpleFeatureCollectionReader.java:73)
>> at
>> org.geotools.data.FilteringFeatureReader.hasNext(FilteringFeatureReader.java:127)
>>  at org.geotools.data.MaxFeatureReader.hasNext(MaxFeatureReader.java:86)
>> at
>> org.geotools.data.store.ContentFeatureCollection$WrappingIterator.hasNext(ContentFeatureCollection.java:259)
>>  at
>> org.geoserver.feature.RetypingFeatureCollection$RetypingIterator.hasNext(RetypingFeatureCollection.java:115)
>> at
>> org.geotools.feature.collection.DelegateFeatureIterator.hasNext(DelegateFeatureIterator.java:54)
>>  at
>> org.geotools.data.crs.ForceCoordinateSystemIterator.hasNext(ForceCoordinateSystemIterator.java:145)
>> at
>> org.geotools.feature.collection.DelegateFeatureIterator.hasNext(DelegateFeatureIterator.java:54)
>>  at
>> org.geoserver.template.DirectTemplateFeatureCollectionFactory$TemplateFeatureIterator.hasNext(DirectTemplateFeatureCollectionFactory.java:103)
>> at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:162)
>>  at freemarker.core.Environment.visit(Environment.java:428)
>> at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
>>  at freemarker.core.Environment.visit(Environment.java:221)
>> at freemarker.core.MixedContent.accept(MixedContent.java:92)
>>  at freemarker.core.Environment.visit(Environment.java:221)
>> at freemarker.core.Environment.process(Environment.java:199)
>>  at freemarker.template.Template.process(Template.java:237)
>> at
>> org.geoserver.wms.featureinfo.HTMLFeatureInfoOutputFormat.write(HTMLFeatureInfoOutputFormat.java:123)
>>  at
>> org.geoserver.wms.featureinfo.GetFeatureInfoResponse.write(GetFeatureInfoResponse.java:108)
>> at org.geoserver.ows.Dispatcher.response(Dispatcher.java:912)
>>  at
>> org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:276)
>> at
>> org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
>>  at
>> org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
>> at
>> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
>>  at
>> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
>> at
>> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
>>  at
>> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
>>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
>>  at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
>> at
>> org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
>>  at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>> at
>> org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
>>  at
>> org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at
>> org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at
>> org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
>> at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
>>  at
>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
>> at
>> org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
>>  at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
>> at
>> org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
>>  at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
>> at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
>>  at
>> org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
>> at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
>>  at
>> org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
>>  at
>> org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:53)
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
>>  at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
>> at
>> org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
>>  at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
>> at
>> org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
>>  at
>> org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:82)
>> at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
>>  at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:68)
>> at
>> org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
>>  at
>> org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:72)
>> at
>> org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
>>  at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
>> at
>> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
>>  at
>> org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:97)
>> at
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
>>  at
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at
>> org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
>> at
>> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
>>  at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
>> at
>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
>>  at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>> at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
>>  at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
>> at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>  at org.mortbay.jetty.Server.handle(Server.java:324)
>> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
>>  at
>> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
>> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
>>  at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
>> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
>>  at
>> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
>> at
>> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
>>
>> Cheers,
>> Carlo
>>
>>
>> --
>> ==
>> Our support, Your Success! Visit http://opensdi.geo-solutions.it for
>> more information.
>> ==
>>
>> Dott. Carlo Cancellieri
>> @cancellieric
>> Software Engineer
>>
>> GeoSolutions S.A.S.
>> Via Poggio alle Viti 1187
>> 55054  Massarosa (LU)
>> Italy
>> phone: +39 0584 962313
>> mobile: +39 3371094494
>> fax:   +39 0584 1660272
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>>
>> -------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------------
>> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
>> Learn Why More Businesses Are Choosing CenturyLink Cloud For
>> Critical Workloads, Development Environments & Everything In Between.
>> Get a Quote or Start a Free Trial Today.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
>> _______________________________________________
>> GeoTools-Devel mailing list
>> GeoTools-Devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>>
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-Devel mailing list
> GeoTools-Devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>


-- 
*Justin Deoliveira*
Vice President, Engineering | Boundless
jdeol...@boundlessgeo.com
@j_deolive <https://twitter.com/j_deolive>
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to