[mapguide][MG200][Modified] No error checking with map view parameters

Walt Welton-Lair walt.welton-lair at autodesk.com
Fri Apr 7 17:14:59 EDT 2006


You can view the artifact detail at the following URL:

    https://mapguide.osgeo.org/servlets/Scarab/id/MG200

Type:
Defect

Artifact ID:
MG200 (No error checking with map view parameters)

Modified by:
Walt Welton-Lair
waltweltonlair (walt.welton-lair at autodesk.com)

The following modifications were made to this artifact:
---------------------------------------------------------------------

-- Developer Notes set to new value:
Old value:
Here's a sumary of changes I made:

1/ Updated the MgMap constructor to set more valid defaults for the scale, width, height, and dpi.  Before these were all 0.  Now scale, width, and height are 1, and dpi is 96.

2/ The MgController class now validates any map view parameters that are supplied.  It verifies that the scale, width, height, and dpi are greater than zero.

3/ Map view command are supplied via HTTP requests, and the MgController class raises InvalidArgumentExceptions when a bad command is encountered.  The displayed error message used to look like:

Invalid argument(s): [2] = "0" The value cannot be less than or equal to zero.

The [2] refers to the second argument passed to the ApplyMapViewCommands method.  I changed this to instead display the parameter name in the brackets:

Invalid argument(s): [SETDISPLAYDPI] = "0" The value cannot be less than or equal to zero.

While this isn't the traditional way we use MgInvalidArgumentException it's fine in this case since the arguments are the parameters supplied with the HTTP request.

New value:
Here's a sumary of changes I made:

1/ Updated the MgMap constructor to set more valid defaults for the scale, width, height, and dpi.  Before these were all 0.  Now scale, width, and height are 1, and dpi is 96.

2/ The MgController class now validates any map view parameters that are supplied.  It verifies that the scale, width, height, and dpi are greater than zero.

3/ Map view command are supplied via HTTP requests, and the MgController class raises InvalidArgumentExceptions when a bad command is encountered.  The displayed error message used to look like:

Invalid argument(s): [2] = "0" The value cannot be less than or equal to zero.

The [2] refers to the second argument passed to the ApplyMapViewCommands method.  I changed this to instead display the parameter name in the brackets:

Invalid argument(s): [SETDISPLAYDPI] = "0" The value cannot be less than or equal to zero.

While this isn't the traditional way we use MgInvalidArgumentException it's fine in this case since the arguments are the parameters supplied with the HTTP request.

4/ Got rid of some duplicate code in MgHtmlController::ApplyMapViewCommands.  The super class already did the same checks.

5/ Updated the public API on ServerRenderingService to validate map view parameters.  Besides adding checks for scale/width/height/dpi being greater than zero, I also added checks ensuring that the number of pixels in requested images did not exceed a maximum value, which I set at 16k*16k.  Without this check you could request a huge image that would bring the server down.

6/ Added a new error message to server_en.res and web_en.res.




---------------------------------------------------------------------
This message was automatically generated by Project Tracker.








More information about the Mapguide_issues mailing list