#3972 closed defect (fixed)
WCS 1.0: WCS Exceptions raise mapscript exceptions
Reported by: | fschindler | Owned by: | sdlime |
---|---|---|---|
Priority: | high | Milestone: | 6.2 release |
Component: | WCS Server | Version: | unspecified |
Severity: | normal | Keywords: | WCS exception mapscript |
Cc: | sdlime, schpidi, tomkralidis, dmorissette, assefa |
Description
WCS Exceptions in WCS 1.0 requests called from mapscript applications raise an exception instead of returning a proper result.
For WCS 1.1 and WCS 2.0 this is not the case, as the exception message is normally returned an can be read with the according msIO_...
mapscript functions.
The following python application raises the said exception (because the coverage id is not found):
import mapscript ows_req = mapscript.OWSRequest() ows_req.setParameter('SERVICE','WCS') ows_req.setParameter('REQUEST','DescribeCoverage') ows_req.setParameter('VERSION','1.0.0') ows_req.setParameter('COVERAGE','invalid_id') map = mapscript.mapObj('test.map') mapscript.msIO_installStdoutToBuffer() dispatch_status = map.OWSDispatch(ows_req) print mapscript.msIO_getStdoutBufferBytes()
The used map file:
MAP CONFIG "MS_ERRORFILE" "stderr" WEB METADATA "ows_onlineresource" "http://something?" "ows_enable_request" "*" END END LAYER NAME "a" DUMP TRUE DATA "test.tif" TYPE RASTER METADATA "ows_srs" "EPSG:4326" END END END
The exception raised:
Traceback (most recent call last): File "describe.py", line 13, in <module> dispatch_status = map.OWSDispatch(ows_req) _mapscript.MapServerError: msWCSDescribeCoverage(): WCS server error. COVERAGE invalid_id cannot be opened / does not exist
The problem occurs in msWCSException
, as the error stack is not cleared with msResetErrorList
, which is done in the other WCS exception handlers.
The following patch resolves the issue:
-
mapwcs.c
179 179 msIO_printf(" </ServiceException>\n"); 180 180 msIO_printf("</ServiceExceptionReport>\n"); 181 181 182 msResetErrorList(); 183 182 184 return MS_FAILURE; 183 185 }
Patch to resolve the described problem