geoserver / geoserver-cloud

Cloud Native GeoServer is GeoServer ready to use in the cloud through dockerized microservices.
http://geoserver.org/geoserver-cloud
Other
245 stars 74 forks source link

pgconfig: NPE evaluating InternalVolatileFunction #424

Closed groldan closed 7 months ago

groldan commented 7 months ago

Some Catalog decorators like AdvertisedCatalog, and other beans like DefaultResourceAccessManager use org.geotools.filter.expression.InternalVolatileFunction functions in the Filter passed to Catalog query methods. These functions are inherently non-translatable to SQL, and can do anything with the CatalogInfo they evaluate.

The PgsqlCatalogFacade resolves CatalogInfo relationships (ResolvingProxy) and other properties like the Catalog itself in its "outbound" function, but delegates the evaluation of Filters to the PgsqlCatalogInfoRepository for each CatalogInfo concrete type.

This in turn splits the provided Filter into supported (SQL translatable) and unsupported (evaluated in-process) parts.

Hence, at the time an InternalVolatileFunction is evaluated, either the ResolvingProxy relations or the Catalog property of a CatalogInfo may not yet be resolved, producing the NullPointerException.

A number of refactorings in this patch favor composition over inheritance to better use inbound/outbound resolvers, and moves the resolving bit from PgsqlCatalogFacade down to the PgsqlCatalogInfoRepository itself.