Uploaded image for project: 'GeoServer'
  1. GeoServer
  2. GEOS-7852

REST API implementation for setting defaults violates Catalog API

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.10.1, 2.11-beta
    • Component/s: REST
    • Labels:
      None

      Description

      The REST API implementation of handleObjectPut for NamespaceResource and WorkspaceResource has an odd implementation for case of setting the default value.
      It passes a partial (name / prefix set, everything else null, including Id) Info object to catalog.setDefault[Workspace/Namespace]:

      https://github.com/geoserver/geoserver/blob/master/src/restconfig/src/main/java/org/geoserver/catalog/rest/NamespaceResource.java#L88
      https://github.com/geoserver/geoserver/blob/master/src/restconfig/src/main/java/org/geoserver/catalog/rest/WorkspaceResource.java#L121

      Just looking at the CatalogInfo / CatalogFacade interfaces, the behaviour for this is undefined, but the implication is that you should be passing valid Catalig objects to the CatalogFacade method.

      Looking at the implementation, it appears this only works because there is a special case hardcoded in to handle it:
      https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/catalog/impl/DefaultCatalogFacade.java#L645
      https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/catalog/impl/DefaultCatalogFacade.java#L744

      The REST API implementation should be fixed.

        Attachments

          Activity

            People

            • Assignee:
              tbarsballe Torben Barsballe
              Reporter:
              tbarsballe Torben Barsballe
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: