[Geoserver-users] WFS Request Error - StringIndexOutOfBoundsException

Hi,

We are facing an issue when making a wfs request without any filter for some polygon data. When requesting the same data using “application/json” or “GML2” as the outputFormat all data is provided. Also when requesting only the feature (using cql) at which the error is raised the valid feature is returned, so it doesn’t look like there is something wrong with the data.

At first we thought it could be because of the amount of requested data (around 30MB in GML2), but when requesting some other layer (which has far more data) we don’t get this error.

Result of the Request:

<gml:Polygon srsName=“urn:x-ogc:def:crs:EPSG:4326” srsDimension=“2”>

gml:exterior

gml:LinearRing

gml:posList

<?xml version="1.0" encoding="UTF-8"?>

<ows:ExceptionReport xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:ows=“http://www.opengis.net/ows/1.1” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” version=“2.0.0” xsi:schemaLocation=“hidden”>

<ows:Exception exceptionCode=“NoApplicableCode”>

ows:ExceptionTextjava.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 java.lang.StringIndexOutOfBoundsException: String index out of range: -1 String index out of range: -1</ows:ExceptionText>

</ows:Exception>

</ows:ExceptionReport>

Error log:

java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at org.geotools.xsd.Encoder.encode(Encoder.java:729)

at org.geotools.xsd.Encoder.encode(Encoder.java:552)

at org.geoserver.wfs.xml.GML3OutputFormat.encode(GML3OutputFormat.java:386)

at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:312)

at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:198)

at org.geoserver.ows.Dispatcher.response(Dispatcher.java:1031)

at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:269)

at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)

at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)

at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)

at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)

at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)

at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)

at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)

at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:101)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:79)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)

at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.Server.handle(Server.java:505)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)

at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:207)

at java.lang.StringBuffer.setLength(StringBuffer.java:192)

at org.geotools.gml2.simple.GMLWriter.coordinates(GMLWriter.java:346)

at org.geotools.gml2.simple.GMLWriter.positions(GMLWriter.java:315)

at org.geotools.gml2.simple.GMLWriter.posList(GMLWriter.java:369)

at org.geotools.gml3.simple.LineStringEncoder.encode(LineStringEncoder.java:62)

at org.geotools.gml3.simple.LinearRingEncoder.encode(LinearRingEncoder.java:49)

at org.geotools.gml3.simple.PolygonEncoder.encodeRing(PolygonEncoder.java:96)

at org.geotools.gml3.simple.PolygonEncoder.encode(PolygonEncoder.java:80)

at org.geotools.gml3.simple.PolygonEncoder.encode(PolygonEncoder.java:35)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encodeValue(FeatureCollectionEncoderDelegate.java:213)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encodeFeature(FeatureCollectionEncoderDelegate.java:183)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encode(FeatureCollectionEncoderDelegate.java:137)

at org.geotools.xsd.Encoder.encode(Encoder.java:727)

… 103 more

Thanks in advance,

Bernd

This looks like it will be a challenge to solve, the Encoder line 729 looks like this:

// here we check for instanceof EncoderDelegate
if (next instanceof EncoderDelegate) {
// do not add entry to the stack, just delegate to encode
try {
((EncoderDelegate) next).encode(handler);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

···

Because the line number does not quite line up with any useful code need to ask you what version of geoserver you are running? Otherwise the stack trace does not help…
Still if failure is occurring here we may need to turn on very detailed logging (or use a debugger) to determine what is happening right when your error occurs.


Jody Garnett

Thank you for the quick response!

We are running version 2.16.0.

Using GEOSERVER_DEVELOPER_LOGGING returns the following log:

java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at org.geotools.xsd.Encoder.encode(Encoder.java:729)

at org.geotools.xsd.Encoder.encode(Encoder.java:552)

at org.geoserver.wfs.xml.GML32OutputFormat.encode(GML32OutputFormat.java:151)

at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:312)

at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:198)

at org.geoserver.wfs.WFSGMLMimeTypeEnforcer$ResponseWrapper.write(WFSGMLMimeTypeEnforcer.java:95)

at org.geoserver.ows.Dispatcher.response(Dispatcher.java:1031)

at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:269)

at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)

at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)

at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)

at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)

at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)

at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)

at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)

at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:101)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:79)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)

at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.Server.handle(Server.java:505)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)

at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:207)

at java.lang.StringBuffer.setLength(StringBuffer.java:192)

at org.geotools.gml2.simple.GMLWriter.coordinates(GMLWriter.java:346)

at org.geotools.gml2.simple.GMLWriter.positions(GMLWriter.java:315)

at org.geotools.gml2.simple.GMLWriter.posList(GMLWriter.java:369)

at org.geotools.gml3.simple.LineStringEncoder.encode(LineStringEncoder.java:62)

at org.geotools.gml3.simple.LinearRingEncoder.encode(LinearRingEncoder.java:49)

at org.geotools.gml3.simple.PolygonEncoder.encodeRing(PolygonEncoder.java:96)

at org.geotools.gml3.simple.PolygonEncoder.encode(PolygonEncoder.java:80)

at org.geotools.gml3.simple.PolygonEncoder.encode(PolygonEncoder.java:35)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encodeValue(FeatureCollectionEncoderDelegate.java:213)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encodeFeature(FeatureCollectionEncoderDelegate.java:183)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encode(FeatureCollectionEncoderDelegate.java:137)

at org.geotools.xsd.Encoder.encode(Encoder.java:727)

… 104 more

···

This looks like it will be a challenge to solve, the Encoder line 729 looks like this:

// here we check for instanceof EncoderDelegate

if (next instanceof EncoderDelegate) {

// do not add entry to the stack, just delegate to encode

try {

((EncoderDelegate) next).encode(handler);

} catch (Exception e) {

throw new RuntimeException(e);

}

}

Because the line number does not quite line up with any useful code need to ask you what version of geoserver you are running? Otherwise the stack trace does not help…

Still if failure is occurring here we may need to turn on very detailed logging (or use a debugger) to determine what is happening right when your error occurs.

Jody Garnett

On Mon, 2 Dec 2019 at 17:10, Loigge Bernd <Bernd.Loigge@…10218…> wrote:

Hi,

We are facing an issue when making a wfs request without any filter for some polygon data. When requesting the same data using “application/json” or “GML2” as the outputFormat all data is provided. Also when requesting only the feature (using cql) at which the error is raised the valid feature is returned, so it doesn’t look like there is something wrong with the data.

At first we thought it could be because of the amount of requested data (around 30MB in GML2), but when requesting some other layer (which has far more data) we don’t get this error.

Result of the Request:

<gml:Polygon srsName=“urn:x-ogc:def:crs:EPSG:4326” srsDimension=“2”>

gml:exterior

gml:LinearRing

gml:posList

<?xml version="1.0" encoding="UTF-8"?>

<ows:ExceptionReport xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:ows=“http://www.opengis.net/ows/1.1” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” version=“2.0.0” xsi:schemaLocation=“hidden”>

<ows:Exception exceptionCode=“NoApplicableCode”>

ows:ExceptionTextjava.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 java.lang.StringIndexOutOfBoundsException: String index out of range: -1 String index out of range: -1</ows:ExceptionText>

</ows:Exception>

</ows:ExceptionReport>

Error log:

java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at org.geotools.xsd.Encoder.encode(Encoder.java:729)

at org.geotools.xsd.Encoder.encode(Encoder.java:552)

at org.geoserver.wfs.xml.GML3OutputFormat.encode(GML3OutputFormat.java:386)

at org.geoserver.wfs.xml.GML3OutputFormat.write(GML3OutputFormat.java:312)

at org.geoserver.wfs.WFSGetFeatureOutputFormat.write(WFSGetFeatureOutputFormat.java:198)

at org.geoserver.ows.Dispatcher.response(Dispatcher.java:1031)

at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:269)

at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)

at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)

at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)

at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)

at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)

at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)

at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)

at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)

at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)

at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)

at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)

at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)

at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)

at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)

at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:101)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:79)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1602)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)

at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:152)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.Server.handle(Server.java:505)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)

at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)

at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:207)

at java.lang.StringBuffer.setLength(StringBuffer.java:192)

at org.geotools.gml2.simple.GMLWriter.coordinates(GMLWriter.java:346)

at org.geotools.gml2.simple.GMLWriter.positions(GMLWriter.java:315)

at org.geotools.gml2.simple.GMLWriter.posList(GMLWriter.java:369)

at org.geotools.gml3.simple.LineStringEncoder.encode(LineStringEncoder.java:62)

at org.geotools.gml3.simple.LinearRingEncoder.encode(LinearRingEncoder.java:49)

at org.geotools.gml3.simple.PolygonEncoder.encodeRing(PolygonEncoder.java:96)

at org.geotools.gml3.simple.PolygonEncoder.encode(PolygonEncoder.java:80)

at org.geotools.gml3.simple.PolygonEncoder.encode(PolygonEncoder.java:35)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encodeValue(FeatureCollectionEncoderDelegate.java:213)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encodeFeature(FeatureCollectionEncoderDelegate.java:183)

at org.geotools.gml2.simple.FeatureCollectionEncoderDelegate.encode(FeatureCollectionEncoderDelegate.java:137)

at org.geotools.xsd.Encoder.encode(Encoder.java:727)

… 103 more

Thanks in advance,

Bernd


Geoserver-users mailing list

Please make sure you read the following two resources before posting to this list:

If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users