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

Cascade Delete fails for a layer group contained within another layer group

Description

If you try to apply a CascadeDeleteVisitor to a layer group that is itself contained within another layer group, you will get the following error:

1 2 3 4 5 6 7 8 9 10 java.lang.IllegalArgumentException: Layer group has different number of styles than layers at org.geoserver.catalog.impl.CatalogImpl.validate(CatalogImpl.java:845) at org.geoserver.catalog.impl.CatalogImpl.save(CatalogImpl.java:938) at org.geoserver.security.SecureCatalogImpl.save(SecureCatalogImpl.java:1315) at org.geoserver.catalog.impl.AbstractFilteredCatalog.save(AbstractFilteredCatalog.java:740) at org.geoserver.catalog.impl.AbstractCatalogDecorator.save(AbstractCatalogDecorator.java:446) at org.geoserver.catalog.impl.LocalWorkspaceCatalog.save(LocalWorkspaceCatalog.java:218) at org.geoserver.catalog.CascadeDeleteVisitor.visit(CascadeDeleteVisitor.java:273) ...

Additionally, if you try to apply the CascadeDeleteVisitor to a store or workspace, when there is a global layer group containing only layers from that store/workspace and other layer groups containing such layers, the nested layer groups will not be removed properly, and you will wind up with empty layer groups that do not get automatically removed by the visitor.

Environment

None

Status

Assignee

Torben Barsballe

Reporter

Torben Barsballe

Triage

None

Fix versions

Affects versions

None

Priority

Medium