[Geoserver-devel] imagemosaic blank response issues

Hello,

A client needed to configure an imagemosaic datastore with a custom made mosaic configuration .properties file.
They were having issues: with native JAI the tiled image was showing black boxes and if transparentcolor was set to #0000000 an "java.lang.IllegalStateException: Unsupported data type" exception was produced; with non-native JAI some assertion exception in JAI was produced in either case. All problems occur in the method RasterLayerResponse.createBlankResponse (line 1655). I found that the problems were caused by the lack of a 'sample_image' present in the datastore dir, which is normally produced when the datastore is created (but only without a config file present yet). Without this sample_image all sorts of bad things happened, such as assuming a floating point color model that isn't even supported.

The problem could be solved by running geoserver once without the custom made config file, which forced it to make one and at that point in time it makes a sample_image as well, and then placing the custom config file back.

But I was wondering if the implementation couldn't be improved to let things go a bit more smoothly in cases like this. So I have a few questions/suggestions I'd like to get feedback on (because I am actually new to this module and not that familiar with the implementation):

Question 1 - In the coverage module: is it logical that with lack of sample model, the default color model when retrieving background values is a floating point (See org.geotools.resources.image.ImageUtilities.getBackgroundValues line 1124) considering that the floating point color model is not being supported for creating transparency in that same module (see ImageWorker.makeColorTransparent - line 1844)

Question 2 - In the imagemosaic module: should the lack of a sample image cause such issues? Could there perhaps be a more appropiate default color model defined at least in the ImageMosaic class (in RasterManager for example where the color model is loaded).

Question 3 - (related) could perhaps a sample image be created whenever it is missing, even when the configuration .properties file is already there?

Regards,
Niels