HTTP 500 response doing a REST PUT to non-existent style (404 expected)

Description

Assumptions:

  • GeoServer is running on localhost:8080

  • Have a style bar in workspace foo

  • foo is the default workspace

Steps to reproduce:

Instead of the expected 404, you get a 500 responce and a null pointer exception in geoserver:

The root cause of this issue is in org.geoserver.catalog.rest.StyleFinder:54, which does a getStyleByName(name) to test if the style exists globaly. Since getStyleByName checks the default workspace, it returns the workspaced style, despite no workspace being provided.
When StyleResouce later tries to get the StyleInfo object, it uses catalog.getStyleByName( workspace, style ), with a null workspace, which returns null.

The same error occurs if you PUT to http://localhost:8080/geoserver/rest/styles/foo:bar.xml (which is an understandable mistake to make). In this instance, foo does not have to be the default workspace.

Environment

None

Assignee

Torben Barsballe

Reporter

Torben Barsballe

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure