[geotk] ClassCastException while rendering DataBufferUShort

Dieter Stüken d.stueken at conterra.de
Fri Oct 17 04:30:18 PDT 2014


To get an understanding of how grid coverages get loaded and rendered I tried to run ReliefShadowDemo.
Instead of any image I just got a warning instead:

WARNING java.awt.image.DataBufferUShort cannot be cast to java.awt.image.DataBufferShort

I traced it down to:

https://github.com/Geomatys/geotoolkit/blob/master/modules/storage/geotk-coverage-imagery/src/main/java/org/geotoolkit/image/iterator/PixelIterator.java#L899

In contrast to other cases TYPE_SHORT and  TYPE_USHORT have to be differentiated here since DataBufferUShort does not extend DataBufferShort :(

The Exception and its StackTrace then "kindly" turn into a warning at:

https://github.com/Geomatys/geotoolkit/blob/master/modules/display/geotk-render2d/src/main/java/org/geotoolkit/display2d/style/renderer/DefaultRasterSymbolizerRenderer.java#L356

After splitting the case statement it worked fine again.

Regards, Dieter.

PS: wondered why this ever worked before, but just noticed this code was optimized two weeks ago :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20141017/0cf32b69/attachment.html>


More information about the Geotoolkit mailing list