[Geoserver-devel] [jira] Created: (GEOS-4311) RenderedImageMapOutputFormat.readBestCoverage is improperly setting readParams

RenderedImageMapOutputFormat.readBestCoverage is improperly setting readParams
------------------------------------------------------------------------------

                 Key: GEOS-4311
                 URL: http://jira.codehaus.org/browse/GEOS-4311
             Project: GeoServer
          Issue Type: Bug
    Affects Versions: 2.1-RC1
            Reporter: Daniele Romagnoli
            Assignee: Daniele Romagnoli
             Fix For: 2.1-RC2, 2.1.x
         Attachments: wmsPatch_21x.patch, wmsPatch_trunk.patch

The readBestCoverage method is improperly setting the readParams for the incoming read operation, when it checks for interpolation and gridGeometry parameters.

Look at this part of code:

    final int size = length + (!foundGG && !foundInterpolation ? 2:1);
    GeneralParameterValue readParams2 = new GeneralParameterValue[length + size];
    System.arraycopy(readParams, 0, readParams2, 0, length);

As you can see it is creating a GeneralParameterValue array with (length+size) elements whilst the "size" variable has already been computed by adding some elements to "length".

This results in having a too long array with several null parameters.
Using that simple line will fix it:
    GeneralParameterValue readParams2 = new GeneralParameterValue[size];

Patches in attachment:
- wmsPatch_trunk.patch: for fixing trunk (to be applied on geoserverTrunk/src/wms subfolder)
- wmsPatch_21x.patch: for fixing 2.1.x branch (to be applied on geoserver21x/src/wms subfolder)

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira