We're updating the issue view to help you get more done. 

Deleting nested LayerGroups via catalog.remove will break the catalog

Description

If you delete a layerGroup that is contained within another layerGroup by any method that uses Catalog.remove() (rather than CascadingDeleteVisitor), you will corrupt the catalog; The deleteion will succed but not update the containing layer group, meaning that any further events to access the remaining layer group will fail with the following error:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 Caused by: java.lang.NullPointerException at org.geoserver.security.SecureCatalogImpl.checkAccess(SecureCatalogImpl.java:631) at org.geoserver.security.SecureCatalogImpl.checkAccess(SecureCatalogImpl.java:490) at org.geoserver.security.SecureCatalogImpl.checkAccess(SecureCatalogImpl.java:634) at org.geoserver.security.SecureCatalogImpl.filterGroups(SecureCatalogImpl.java:959) at org.geoserver.security.SecureCatalogImpl.getLayerGroupsByWorkspace(SecureCatalogImpl.java:328) at org.geoserver.catalog.impl.AbstractFilteredCatalog.getLayerGroupsByWorkspace(AbstractFilteredCatalog.java:259) at org.geoserver.catalog.impl.AbstractCatalogDecorator.getLayerGroupsByWorkspace(AbstractCatalogDecorator.java:466) at org.geoserver.catalog.impl.LocalWorkspaceCatalog.getLayerGroupsByWorkspace(LocalWorkspaceCatalog.java:210) at org.geoserver.catalog.rest.LayerGroupListResource.handleListGet(LayerGroupListResource.java:32) at org.geoserver.catalog.rest.LayerGroupListResource.handleListGet(LayerGroupListResource.java:1) at org.geoserver.catalog.rest.AbstractCatalogListResource.handleObjectGet(AbstractCatalogListResource.java:41) at org.geoserver.rest.ReflectiveResource.handleGet(ReflectiveResource.java:89) ... 89 more

This occurs because the LayerGroup still holds a reference to the deleted layer group, so we get stuck with a ResolvingProxy containing "null" in place of the deleted layerGroup.

Environment

None

Status

Assignee

Torben Barsballe

Reporter

Torben Barsballe

Triage

Fix versions

Affects versions

None

Priority

Medium