[Geoserver-devel] Catalog's *InfoImpl.toString() broken

Hi,

Info objects toString() method can return null, this is a break in the Object.toString contract. Reason being toString is returning this.name verbatim.
It's causing problems at least when setting up a unit test for a new resource, BaseWicketTester relies on it for GeoServerWicketTestSupport.print. May not be a big deal, but may be we should just fix the toString() implementations?

Cheers,
Gabriel

Gabriel Roldan ha scritto:

Hi,

Info objects toString() method can return null, this is a break in the Object.toString contract. Reason being toString is returning this.name verbatim.
It's causing problems at least when setting up a unit test for a new resource, BaseWicketTester relies on it for GeoServerWicketTestSupport.print. May not be a big deal, but may be we should just fix the toString() implementations?

Agreed, breaking the api contract is a good reason along for a
fix. I guess using getClass().getSimpleName() + "(" + this.name + ")"
or something like that would do the trick?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Gabriel Roldan ha scritto:

Hi,

Info objects toString() method can return null, this is a break in the Object.toString contract. Reason being toString is returning this.name verbatim.
It's causing problems at least when setting up a unit test for a new resource, BaseWicketTester relies on it for GeoServerWicketTestSupport.print. May not be a big deal, but may be we should just fix the toString() implementations?

Agreed, breaking the api contract is a good reason along for a
fix. I guess using getClass().getSimpleName() + "(" + this.name + ")"
or something like that would do the trick?

Works for me.

-Justin

Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.