Crash in WMSWorkspaceQualifier.toCommaSeparatedList with empty list

Description

We are getting the following crash:

{{2015-10-20 14:57:23,942 ERROR [geoserver.ows] - java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.AbstractStringBuilder.setLength(AbstractStringBuilder.java:180) at java.lang.StringBuffer.setLength(StringBuffer.java:194) at org.geoserver.wms.WMSWorkspaceQualifier.toCommaSeparatedList(WMSWorkspaceQualifier.java:116) at org.geoserver.wms.WMSWorkspaceQualifier.qualifyLayerNamesKVP(WMSWorkspaceQualifier.java:68) at org.geoserver.wms.WMSWorkspaceQualifier.qualifyRequest(WMSWorkspaceQualifier.java:30) at org.geoserver.ows.WorkspaceQualifyingCallback.serviceDispatched(WorkspaceQualifyingCallback.java:44) at org.geoserver.ows.Dispatcher.fireServiceDispatchedCallback(Dispatcher.java:582) at org.geoserver.ows.Dispatcher.service(Dispatcher.java:577) at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:252) 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:622) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:28) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:75) at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:71) at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:71) at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:46) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:50) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311) at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:69) 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:73) at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:92) }}

Looking at the code it seems that an empty list is not being handled correctly.

Environment

RedHat 5.5

Activity

Jukka Rahkonen 
June 30, 2021 at 1:26 PM

Can’t reproduce with a request that does not have a layer but has a style

http://localhost:8080/geoserver/topp/wms?service=WMS&version=1.1.0&request=GetMap&layers=&bbox=-124.73142200000001%2C24.955967%2C-66.969849%2C49.371735&width=768&height=330&srs=EPSG%3A4326&styles=polygon&format=image/png

 

The result is a good error message

<ServiceException code="org.geoserver.wms.map.GetMapKvpRequestReader">
No LAYERS has been requested

Robert Ward 
July 25, 2016 at 8:50 AM

I checked all our logs but couldn't identify what the url was that caused the problem.

However I've just managed to replicate it with the following url:

http://localhost:8080/geo/dgmapping/wms?service=WMS&version=1.1.0&request=GetMap&layers=&styles=point

The problem is caused if there are styles specified and no layers.

Jody Garnett 
July 21, 2016 at 5:56 PM

Any update Robert? We need a way to reproduce this in order to try a fix....

Brad Hards 
October 23, 2015 at 10:56 AM

What is the query that you are using to reproduce this?

Cannot Reproduce

Details

Assignee

Reporter

Affects versions

Original estimate

Time tracking

No time logged1d remaining

Components

Priority

Created October 23, 2015 at 10:50 AM
Updated June 30, 2021 at 1:27 PM
Resolved June 30, 2021 at 1:27 PM