[geotk] CSW client : unmarshalling issue

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Wed May 11 04:00:30 EDT 2011


Hello Damiano

Le 11/05/11 09:46, Damiano ALBANI a écrit :
> The exception that is thrown is :
> (...snip...)
> Caused by: java.lang.NullPointerException
>     at 
> org.geotoolkit.metadata.iso.extent.DefaultExtent.<clinit>(DefaultExtent.java:59)
>     ... 38 more
>
> Basically, in the DefaultExtend class, the "static { }" initializer fails due 
> to the "geographicElements" collection being a null object.

You have spotted a tricky corner case! The collection is not supposed to be 
null... except when marshalling an optional element to XML. This exception 
occurs because the DefaultExtent static initializer is executed *during* XML 
marshalling. I'm going to fix that now and the fix will be available tomorrow in 
the 3.x-SNAPSHOT versions.

As a workaround, you could add the following line at the begining of your code:

DefaultExtent.WORLD.getGeographicElements();

You don't need to do anything with the returned value. The intend is just to 
trig class initialization before the XML marshalling begin.

Thanks for spotting this bug!

     Martin



More information about the Geotoolkit mailing list