[#696] Uncaught exception when trying to export a mapfile twice

2008-07-27 05:57
Submitted by:
Anthony Lenton (elachuni)
Assigned to:
Nobody (None)
Uncaught exception when trying to export a mapfile twice

Detailed description
If you try to export a map using the umn_mapserver extension twice, an uncaught exception occurs.
The map needs to have at least one non-default classification for error to occur.

To reproduce this bug:
* Open thuban
* Add a layer to the map, say Iceland's political.shp
* Click twice on the only layer in the left bar to bring up the Layer Properties dialog.
* Select any Classification field, for example Area.
* Add a singleton classification, and set it up any how. Extra points for pretty colors.
* Click Ok to close the Layer Properties dialog.
* Click on Experimental->MapServer->Create mapfile
* Click on Experimental->MapServer->Edit mapfile->Map
* Set some width and height (say 50x50)
* Click on Experimental->MapServer->Export mapfile
* Select any filename and click Ok
* Click on Experimental->MapServer->Export mapfile, again
* Select any filename (can be the same as before or not) and click Ok.

An unhandled exception occurred:
removeClass(): Child array error. Cannot remove class, invalid index 1
(please report to http://thuban.intevation.org/bugtracker.html)

Traceback (most recent call last):
File "/home/anthony/svn/thuban/trunk/thuban/Thuban/UI/mainwindow.py", line 300, in invoke_command
File "/home/anthony/svn/thuban/trunk/thuban/Thuban/UI/command.py", line 121, in Execute
apply(self.function, (context,) + self.args + args, kw)
File "/home/anthony/svn/thuban/trunk/thuban/Extensions/umn_mapserver/mf_export.py", line 163, in export_mapfile
thuban_to_map(context, theMap)
File "/home/anthony/svn/thuban/trunk/thuban/Extensions/umn_mapserver/mf_export.py", line 105, in thuban_to_map
tblayer_to_map(tb_map, map)
File "/home/anthony/svn/thuban/trunk/thuban/Extensions/umn_mapserver/mf_export.py", line 73, in tblayer_to_map
File "/home/anthony/svn/thuban/trunk/thuban/Extensions/umn_mapserver/mapfile.py", line 1071, in add_thubanlayer
File "/home/anthony/svn/thuban/trunk/thuban/Extensions/umn_mapserver/mapfile.py", line 735, in remove_allclasses
File "/usr/lib/python2.5/site-packages/mapscript.py", line 1114, in removeClass
def removeClass(*args): return _mapscript.layerObj_removeClass(*args)
MapServerChildError: removeClass(): Child array error. Cannot remove class, invalid index 1

I believe that this is a problem with the umn_mapserver that keeps track of the classes in the map and doesn't realise when the mapObj is created anew underneath, so it tries to clear the classes on an already clear layer when it comes round to exporting the second time.

No comments have been posted

No attached documents

No changes have been made to this item