[Geoserver-devel] [jira] Created: (GEOS-4841) restconfig ClassCastException when creating app-schema feature type

restconfig ClassCastException when creating app-schema feature type
-------------------------------------------------------------------

                 Key: GEOS-4841
                 URL: https://jira.codehaus.org/browse/GEOS-4841
             Project: GeoServer
          Issue Type: Bug
    Affects Versions: 2.1.2, 2.1.x, 2.2.x
            Reporter: Ben Caradoc-Davies
            Assignee: Andrea Aime
             Fix For: 2.1.x, 2.2.x

restconfig throws a ClassCastException when a user attempts to post a featuretype.xml for an app-schema data store (i.e a DataAccess). See original user report and discussion, where it was pointed out that this worked for 2.0.2:
http://osgeo-org.1803224.n2.nabble.com/2-1-2-REST-create-featuretype-with-app-schema-datastore-td6950658.html

{noformat}
Caused by: java.lang.ClassCastException: org.geotools.data.complex.AppSchemaDataAccess cannot be cast to org.geotools.data.DataStore

    at org.geoserver.catalog.rest.FeatureTypeResource.handleObjectPost(FeatureTypeResource.java:111)

    at org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:120)

{noformat}

The solution is to use an instanceof guard to stop the code from attempting to manipulate stores it does not know how to handle (i.e. anything not a DataStore).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira