[Geoserver-devel] [JIRA] (GEOS-8073) Performing a WMTS GetCapabilities request with layer groups provokes a NPE

Nuno Oliveira created an issue

GeoServer / BugGEOS-8073

Performing a WMTS GetCapabilities request with layer groups provokes a NPE

Issue Type:

BugBug

Assignee:

Unassigned

Attachments:

stacktrace.txt

Components:

GWC

Created:

05/Apr/17 12:04 PM

Priority:

MediumMedium

Reporter:

Nuno Oliveira

To reproduce this error just perform a WMTS get capabilities request where group layers are included, a NULL pointer exception will be throw (full stack trace attached):

java.lang.NullPointerException
	at java.util.HashMap.putMapEntries(HashMap.java:500)
	at java.util.HashMap.putAll(HashMap.java:784)
	at org.geowebcache.service.wmts.WMTSGetCapabilities.getLegendsInfo(WMTSGetCapabilities.java:516)

This happens because GeoServer doesn’t returns an empty map (default behavior of the overridden method) but instead NULL when no legends are available. This typically happens for layer groups which don’t have legends associated.

The line of code that does this:
https://github.com/geoserver/geoserver/blob/master/src/gwc/src/main/java/org/geoserver/gwc/layer/GeoServerTileLayer.java#L1277-L1280

GWC code can also be made more robust by ignoring NULL values.

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v1000.883.0#100040-sha1:084968a)

Atlassian logo