[Geoserver-devel] [JIRA] (GEOS-7865) Revert changes when a CatalogException is thrown

Torben Barsballe created an issue

GeoServer / ImprovementGEOS-7865

Revert changes when a CatalogException is thrown

Issue Type:

ImprovementImprovement

Assignee:

Unassigned

Created:

17/Nov/16 8:25 PM

Priority:

MediumMedium

Reporter:

Torben Barsballe

From “CatalogListener.java”:

> * In general the catalog protects itself against misbehaved listeners that throw
> * exceptions. However sometimes it is the case in which a listener must report an error
> * via exception. For such purposes {@link CatalogException} should be thrown.

When the catalog actually recieves a CatalogException, it just re-throws it and does not do any work to revert any changes that have been made.

This can cause various problems. For example, for GEOS-4754 Open , when we try and create a layer group it gets added to the catalog, then the persistor throws a CatalogException, meaning that the layer group is not persisted. However, the act of adding the layer group to the catalog is never reverted.

A couple things need to be done here:
a) Some documentation work to clarify the pupose / intended usage of CatalogException, particularily whether or not the catalog is responsible for reverting changes, or if this is a responsibility of whatever is using the catalog / catching the CatalogException.
b) If CatalogException is intended to be thrown upstream (which is appears it is), the Catalog interface should be modified to indicate that certain methods can throw CatalogException. This is a rather substantial API change

Add Comment

Add Comment

This message was sent by Atlassian JIRA (v1000.552.3#100018-sha1:65669cd)

Atlassian logo