[Geoserver-devel] [JIRA] (GEOS-10661) ValidationException thrown by REST API when creating feature type with custom field names

Eric Stadtherr created an issue

GeoServer / BugGEOS-10661

ValidationException thrown by REST API when creating feature type with custom field names

Issue Type:

BugBug

Affects Versions:

2.21.0

Assignee:

Unassigned

Components:

REST

Created:

20/Sep/22 3:50 PM

Environment:

Running in tomcat:9.0-jdk11-openjdk-slim based container

Priority:

MediumMedium

Reporter:

Eric Stadtherr

GeoServer returns a “500” error and logs a org.geoserver.catalog.ValidationException exception when using the REST API to create a feature type that defines a custom name for a field.

The exception logged is:

org.geoserver.catalog.ValidationException: The CQL source expression for attribute <custom name> refers to attributes unavailable in the data source: [<custom name>]
	at org.geoserver.catalog.impl.FeatureTypeValidator.validate(FeatureTypeValidator.java:90) ~[gs-main-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]
	at org.geoserver.catalog.impl.FeatureTypeValidator.validate(FeatureTypeValidator.java:48) ~[gs-main-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]
	at org.geoserver.catalog.impl.CatalogImpl.validate(CatalogImpl.java:515) ~[gs-main-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]
	at org.geoserver.security.SecureCatalogImpl.validate(SecureCatalogImpl.java:1320) ~[gs-main-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]
	at org.geoserver.catalog.impl.AbstractFilteredCatalog.validate(AbstractFilteredCatalog.java:633) ~[gs-main-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]
	at org.geoserver.catalog.impl.AbstractCatalogDecorator.validate(AbstractCatalogDecorator.java:274) ~[gs-main-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]
	at org.geoserver.rest.catalog.FeatureTypeController.featureTypePost(FeatureTypeController.java:281) ~[gs-restconfig-2.21-SNAPSHOT.jar:2.21-SNAPSHOT]

Steps to reproduce the issue:
#. build and run geoserver 2.21.x with elasticsearch extension
#. from web UI, create workspace
#. from web UI, create elasticsearch datastore in workspace
#. from web UI, create a layer from the elasticsearch datastore and specify a custom name for at least one field that differs from the actual field name
#. export feature type from REST API - GET /rest/workspaces/<workspace>/featuretypes/<featuretype>
#. delete layer
#. create identical feature type from exported file - POST /rest/workspaces/<workspace>/datastores/<datastore>/featuretypes

The error can be reproduced without first creating and the layer in the web UI, and skipping right to the POST of the feature type, but this method is both an easy way to construct a valid feature type document, and demonstrates that a valid layer produces the exception.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100207-sha1:866f7d8)

Atlassian logo