GetCapabilities on a single layer fails if a style is duplicated

Description

If I copy an existing style and assign it to the same layer it belong to, the GetCapabilities fails with a NullPointerException.

To reproduce:

  1. Start the platform independent binary package

  2. Go to http://localhost:8080/geoserver/topp/states/wms?service=WMS&version=1.3.0&request=GetCapabilities

  3. Notice the Layer is listed and the styles list is available

  4. Login to the admin panel

  5. Go to Styles and select "Add new style"

  6. Give it a name

  7. From "Copy from existing style" select "population" and hit "copy"

  8. Click "Apply"

  9. The "Publishing" tab should appear

  10. Open the "Publishing" tab

  11. In the "topp" "states" line, tick "Default" and "Associated" checkboxes

  12. Click Apply

  13. Go to http://localhost:8080/geoserver/topp/states/wms?service=WMS&version=1.3.0&request=GetCapabilities again

  14. Notice no styles are available

  15. Check the logs, see the NullPointerException

The log is:

Environment

Tested on CentOS 7 and Windows 10

Status

Assignee

Fernando Miño

Reporter

Gnafu

Triage

None

Fix versions

Affects versions

2.13.3
2.14.0

Components

Priority

Medium
Configure