Demo Request page testing

Description

Chris Snider from email:

The first example may be a problem with the demo request page (or the nurck50095 store as per ):

Verified Demos Displays

  • Demo Requests

  • Choose WCS_describeCoverage.xml

  • URL populates, Body Populates

  • Submit

  • EXCEPTION

  • Error screen ( Log Exception)

The second example looks to be a more general failure due to wicket upgrade, or a change to the OWS dispatch system:

  • Close Popup window

  • Select ANY other Request from drop down:

    • URL changes

    • Body is blank

  • Submitting always produces exception

    or

Environment

None

Activity

Show:
Niels Charlier
May 5, 2016, 4:05 PM

From the list:

While working on the Demo Request bug (https://osgeo-org.atlassian.net/browse/GEOS-7513), I came across an issue with Resources. The bug is caused by buggy serialisation of a Resource instance stored in a Wicket Page.

It was me who made the Resource interface extend Serializable so that all Resources could be used as serializables.
The idea behind that was that Files are serializable and that made it easier to replace the use of "File" by the use of "Resource" in the webui pages amongst other things.

However, now I realise that this was a wrong thing to do. Resources are usually implemented as non-static inner classes, and it is an anti-pattern to make those Serializable, see:
https://www.securecoding.cert.org/confluence/display/java/SER05-J.+Do+not+serialize+instances+of+inner+classes

Making the Resource implementation classes static is also not an option. They need to reference their store, because there can be different stores at once and resources need to call their store for certain operations. Changing that would require rethinking the resource API altogether. It can't be the case that we serialize the store and get multiple copies of it. It is a spring bean that refers to other spring beans such as LockProvider, FileWatcher etc. We can't make all of that serializable and create new copies from all of them, just because we are serializing a webui page.

Anyway, I want to roll back this change. As far as I can see there are only two places in which the serialisation of resources is relied upon:

  • the Demo Request page as mentioned,

  • the importer module.

The alternative solution is to use a String with the path instead and rely upon the Resources.fromPath method - which uses the datadirectorystore for relative paths and Files.asResource for absolute paths.

I had the idea to simplify the multiple use of this pattern by creating a Resources.serializable(Resource) method which wraps a serializable resource around a non-serializable resource, relying on the Resources.fromPath method to do the serialisation. This way we need minimal change to the aforementioned modules.

Niels Charlier
May 19, 2016, 11:43 AM
Jody Garnett
May 19, 2016, 7:18 PM

Pull request provided to enable nurck50095 store (https://github.com/geoserver/geoserver/pull/1604)

Andrea Aime
February 15, 2017, 11:47 AM

Mass closing all resolved issues not modified in the last 4 weeks

Fixed

Assignee

Niels Charlier

Reporter

Jody Garnett

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure