Hi all,

I have a unit test in place which fires checks critical pixels of a
transformed GridCoverage. The wired constellation is that the code works
when the test runs standalone: "gradle -Dtest.single=ReprojectionTest test"
but will fail when it is part of the full test run "gradle test"

The projection itself is straight forward:

GridCoverage2D transformedCoverage = (GridCoverage2D)
Operations.DEFAULT.resample(coverage, targetCrs)

Trying to extract the BufferedImage out of it is throwing a
NullPointerException (see stack below). Here's the code:

BufferedImage bi =
((PlanarImage)transformedCoverage.getRenderedImage()).getAsBufferedImage();

And here is the NPE:
java.lang.NullPointerException
        at com.sun.media.jai.util.SunCachedTile.<init>(SunCachedTile.java:80)
        at com.sun.media.jai.util.SunTileCache.add(SunTileCache.java:257)
        at javax.media.jai.OpImage.addTileToCache(OpImage.java:1087)
        at javax.media.jai.OpImage.getTile(OpImage.java:1142)
        at javax.media.jai.PlanarImage.copyData(PlanarImage.java:2343)
        at javax.media.jai.RenderedOp.copyData(RenderedOp.java:2299)
        at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2525)
        at javax.media.jai.PlanarImage.getAsBufferedImage(PlanarImage.java:2546)

Again: everything works fine when the test runs standalone but will throw
that exception in global context.

Thanks and best regards,
tee



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/NPE-in-PlanarImage-when-running-unit-tests-tp5280333.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to