I am not sure yet,

Checking that line:
https://github.com/geotools/geotools/blob/master/modules/library/coverage/src/main/java/org/geotools/image/ImageWorker.java#L548
:

    public Range extractNoDataProperty(final RenderedImage image) {
>         Object property = image.getProperty(NoDataContainer.GC_NODATA);
>         if (property != null) {
>
> *if (property instanceof NoDataContainer) {*                return
> ((NoDataContainer) property).getAsRange();
>             } else if (property instanceof Double) {
>                 return RangeFactory.create((Double) property, (Double)
> property);
>             }
>         }
>         return null;
>     }


That line in bold does match up
with 
javax.media.jai.RenderedImageAdapter.getProperty(RenderedImageAdapter.java:189)
so I am going to ask what version of GeoTools you are running?
Looking at the source code for RenderedImageAdapter here
<https://github.com/eclipse/imagen/blob/master/modules/core/src/main/java/org/eclipse/imagen/RenderedImageAdapter.java#L191>
(an
open source fork) shows that getProperty is final, so chances are the image
is null.

Can you step through with the debugger and check if the image is null?  I
would ask that you check the tutorial dependencies to ensure you have
everything needed for the wms client to work.
--
Jody Garnett


On Mon, 6 Jul 2020 at 09:42, maca delic <macade...@gmx.de> wrote:

> Hi, i was going through the image tutroial (
> https://docs.geotools.org/latest/userguide/tutorial/raster/image.html).
> And just copy & pasted the wmslab class from the tutorial (from the extra
> things to try) and executed it. A swing window opens, which displays the
> wms, but as soon as i click the button to display the full extent of all
> layers without doing anything else i get a nullpointer:
>
> java.lang.NullPointerException
>     at
> javax.media.jai.RenderedImageAdapter.getProperty(RenderedImageAdapter.java:189)
>     at
> org.geotools.image.ImageWorker.extractNoDataProperty(ImageWorker.java:548)
>     at org.geotools.image.ImageWorker.setImage(ImageWorker.java:567)
>     at org.geotools.image.ImageWorker.<init>(ImageWorker.java:510)
>     at
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRendererUtilities.affine(GridCoverageRendererUtilities.java:684)
>     at
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.affine(GridCoverageRenderer.java:515)
>     at
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.symbolize(GridCoverageRenderer.java:442)
>     at
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.renderImage(GridCoverageRenderer.java:761)
>     at
> org.geotools.renderer.lite.gridcoverage2d.GridCoverageRenderer.paint(GridCoverageRenderer.java:910)
>     at
> org.geotools.renderer.lite.StreamingRenderer$RenderCoverageReaderRequest.execute(StreamingRenderer.java:3900)
>     at
> org.geotools.renderer.lite.StreamingRenderer$PainterThread.run(StreamingRenderer.java:4011)
>     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>     at java.util.concurrent.FutureTask.run(Unknown Source)
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>     at java.lang.Thread.run(Unknown Source)
>
> Why does that happen? I tried multiple wms and it's the same for all. I
> didn't change the code, just copied from the tutorial.
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to