[Geoserver-devel] Getting TIME parameter into CoverageReader

Hi, everybody.

I'm trying to implement a TIME parameter in my own GridFormat, similar to the one in ImageMosaicFormat. It seemed to go pretty smoothly, and I can make requests that don't use the parameter fine (these retrieve the most recent layer available in the time-parameterized store).

The problem comes when I try to make requests that use the parameter. Then I get...

09 Feb 15:09:53 ERROR [geoserver.ows] -
java.lang.NullPointerException
     at org.geoserver.data.util.CoverageUtils.mergeParameter(CoverageUtils.java:401)
     at org.geoserver.wms.WMS.getWMSReadParameters(WMS.java:778)
     at org.geoserver.wms.GetMap.run(GetMap.java:304)
     at org.geoserver.wms.GetMap.run(GetMap.java:107)
     at org.geoserver.wms.DefaultWebMapService.getMap(DefaultWebMapService.java:353)
     .

It seems to be related to the fact that my GridFormat has no required parameters other than AbstractGridFormat.READ_GRIDGEOMETRY2D. Inside CoverageUtils.getParameters this one is treated separately; other than that, nothing is added to the parameters array, so the method returns null. Then, when this null array is handed off to CoverageUtils.mergeParameter to insert the TIME parameter value, it generates the NullPointerException.

Is there another way I'm supposed to be doing this? Or is this a bug; possibly CoverateUtils.getParameters should return an empty array instead of a null one in the cases where it finds no parameter values?

Thanks in advance.