Skip to content

Commit

Permalink
Correcting and harmonizing exceptionCode and locator usage in WCS (#4388
Browse files Browse the repository at this point in the history
).
  • Loading branch information
Schpidi committed Feb 12, 2015
1 parent 3cb915d commit c37b3bc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
30 changes: 15 additions & 15 deletions mapwcs11.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
**
*/

int msWCSException11(mapObj *map, const char *locator,
const char *exceptionCode, const char *version)
int msWCSException11(mapObj *map, const char *exceptionCode,
const char *locator, const char *version)
{
int size = 0;
char *errorString = NULL;
Expand Down Expand Up @@ -399,11 +399,11 @@ int msWCSGetCapabilities11(mapObj *map, wcsParamsObj *params,
i = msOWSNegotiateUpdateSequence(params->updatesequence, updatesequence);
if (i == 0) { /* current */
msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is equal to server (%s)", "msWCSGetCapabilities11()", params->updatesequence, updatesequence);
return msWCSException11(map, "updatesequence", "CurrentUpdateSequence", params->version);
return msWCSException11(map, "CurrentUpdateSequence", "updatesequence", params->version);
}
if (i > 0) { /* invalid */
msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is higher than server (%s)", "msWCSGetCapabilities11()", params->updatesequence, updatesequence);
return msWCSException11(map, "updatesequence", "InvalidUpdateSequence", params->version);
return msWCSException11(map, "InvalidUpdateSequence", "updatesequence", params->version);
}
}

Expand Down Expand Up @@ -490,7 +490,7 @@ int msWCSGetCapabilities11(mapObj *map, wcsParamsObj *params,
if ((script_url=msOWSGetOnlineResource(map, "CO", "onlineresource", req)) == NULL
|| (script_url_encoded = msEncodeHTMLEntities(script_url)) == NULL) {
msSetError(MS_WCSERR, "Server URL not found", "msWCSGetCapabilities11()");
return msWCSException11(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException11(map, "NoApplicableCode", "mapserv", params->version);
}
free( script_url );

Expand Down Expand Up @@ -931,7 +931,7 @@ int msWCSDescribeCoverage11(mapObj *map, wcsParamsObj *params, owsRequestObj *ow
msSetError( MS_WCSERR,
"COVERAGE %s cannot be opened / does not exist",
"msWCSDescribeCoverage()", params->coverages[j]);
return msWCSException11(map, "coverage", "CoverageNotDefined", params->version);
return msWCSException11(map, "CoverageNotDefined", "coverage", params->version);
}
}
}
Expand Down Expand Up @@ -1095,7 +1095,7 @@ int msWCSGetCoverageBands11( mapObj *map, cgiRequestObj *request,
field_id, rangesubset );
free(rangesubset);
free(field_id);
return msWCSException11(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException11(map, "NoApplicableCode", "mapserv", params->version);
}

free( field_id );
Expand Down Expand Up @@ -1135,7 +1135,7 @@ int msWCSGetCoverageBands11( mapObj *map, cgiRequestObj *request,
"msWCSGetCoverageBands11()",
axis_id, rangesubset );
free(rangesubset);
return msWCSException11(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException11(map, "NoApplicableCode", "mapserv", params->version);
}

/* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -1194,7 +1194,7 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
"Failed to find %s driver.",
"msWCSReturnCoverage11()",
image->format->driver+5 );
return msWCSException11(map, "mapserv", "NoApplicableCode",
return msWCSException11(map, "NoApplicableCode", "mapserv",
params->version);
}

Expand All @@ -1219,7 +1219,7 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
msFree(filename);
msSetError(MS_MISCERR, "msSaveImage() failed",
"msWCSReturnCoverage11()");
return msWCSException11(map, "mapserv", "NoApplicableCode",
return msWCSException11(map, "NoApplicableCode", "mapserv",
params->version);
}
}
Expand Down Expand Up @@ -1287,7 +1287,7 @@ int msWCSReturnCoverage11( wcsParamsObj *params, mapObj *map,
status = msSaveImage(map, image, NULL);
if( status != MS_SUCCESS ) {
msSetError( MS_MISCERR, "msSaveImage() failed", "msWCSReturnCoverage11()");
return msWCSException11(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException11(map, "NoApplicableCode", "mapserv", params->version);
}

msIO_fprintf( stdout, "\r\n--wcs--\r\n" );
Expand Down Expand Up @@ -1406,7 +1406,7 @@ int msWCSDescribeCoverage11(mapObj *map, wcsParamsObj *params,
msSetError( MS_WCSERR,
"WCS 1.1 request made, but mapserver requires libxml2 for WCS 1.1 services and this is not configured.",
"msWCSDescribeCoverage11()", "NoApplicableCode" );
return msWCSException11(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException11(map, "NoApplicableCode", "mapserv", params->version);
}

/* ==================================================================== */
Expand All @@ -1418,13 +1418,13 @@ int msWCSGetCapabilities11(mapObj *map, wcsParamsObj *params,
"WCS 1.1 request made, but mapserver requires libxml2 for WCS 1.1 services and this is not configured.",
"msWCSGetCapabilities11()", "NoApplicableCode" );

return msWCSException11(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException11(map, "NoApplicableCode", "mapserv", params->version);
}

int msWCSException11(mapObj *map, const char *locator, const char *exceptionCode, const char *version)
int msWCSException11(mapObj *map, const char *exceptionCode, const char *locator, const char *version)
{
/* fallback to reporting using 1.0 style exceptions. */
return msWCSException( map, locator, exceptionCode, "1.0.0" );
return msWCSException( map, exceptionCode, locator, "1.0.0" );
}

#endif /* defined(USE_WCS_SVR) && !defined(USE_LIBXML2) */
26 changes: 13 additions & 13 deletions mapwcs20.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ static int msWCSValidateAndFindAxes20(
static const int numAxis = 2;
char *validXAxisNames[] = {"x", "xaxis", "x-axis", "x_axis", "long", "long_axis", "long-axis", "lon", "lon_axis", "lon-axis", NULL};
char *validYAxisNames[] = {"y", "yaxis", "y-axis", "y_axis", "lat", "lat_axis", "lat-axis", NULL};
char **validAxisNames[2];
char **validAxisNames[2];
int iParamAxis, iAcceptedAxis, iName, i;

validAxisNames[0] = validXAxisNames;
Expand Down Expand Up @@ -1642,7 +1642,7 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
"Failed to find %s driver.",
"msWCSWriteFile20()",
image->format->driver+5 );
return msWCSException(map, "mapserv", "NoApplicableCode",
return msWCSException(map, "NoApplicableCode", "mapserv",
params->version);
}

Expand All @@ -1666,7 +1666,7 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
if( status != MS_SUCCESS ) {
msSetError(MS_MISCERR, "msSaveImage() failed",
"msWCSWriteFile20()");
return msWCSException20(map, "mapserv", "NoApplicableCode",
return msWCSException20(map, "NoApplicableCode", "mapserv",
params->version);
}
}
Expand Down Expand Up @@ -1716,7 +1716,7 @@ static int msWCSWriteFile20(mapObj* map, imageObj* image, wcs20ParamsObjPtr para
status = msSaveImage(map, image, NULL);
if( status != MS_SUCCESS ) {
msSetError( MS_MISCERR, "msSaveImage() failed", "msWCSWriteFile20()");
return msWCSException(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException(map, "NoApplicableCode", "mapserv", params->version);
}
if(multipart)
msIO_fprintf( stdout, "\r\n--wcs--\r\n" );
Expand Down Expand Up @@ -2623,15 +2623,15 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,
msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is equal to server (%s)",
"msWCSGetCapabilities20()", params->updatesequence, updatesequence);
xmlFreeDoc(psDoc);
return msWCSException(map, "updatesequence",
"CurrentUpdateSequence", params->version);
return msWCSException(map, "CurrentUpdateSequence", "updatesequence",
params->version);
}
if (i > 0) { /* invalid */
msSetError(MS_WCSERR, "UPDATESEQUENCE parameter (%s) is higher than server (%s)",
"msWCSGetCapabilities20()", params->updatesequence, updatesequence);
xmlFreeDoc(psDoc);
return msWCSException(map, "updatesequence",
"InvalidUpdateSequence", params->version);
return msWCSException(map, "InvalidUpdateSequence", "updatesequence",
params->version);
}
}
if(updatesequence != NULL) {
Expand Down Expand Up @@ -2661,7 +2661,7 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,
|| (script_url_encoded = msEncodeHTMLEntities(script_url)) == NULL) {
xmlFreeDoc(psDoc);
msSetError(MS_WCSERR, "Server URL not found", "msWCSGetCapabilities20()");
return msWCSException(map, "mapserv", "NoApplicableCode", params->version);
return msWCSException(map, "NoApplicableCode", "mapserv", params->version);
}
free(script_url);

Expand Down Expand Up @@ -2717,7 +2717,7 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,

/* Apply default formats */
msApplyDefaultOutputFormats(map);

/* Add formats list */
format_list = msWCSGetFormatsList20(map, NULL);
msLibXml2GenerateList(psNode, psWcsNs, "formatSupported", format_list, ',');
Expand Down Expand Up @@ -2750,7 +2750,7 @@ int msWCSGetCapabilities20(mapObj *map, cgiRequestObj *req,
if(status != MS_SUCCESS) {
xmlFreeDoc(psDoc);
xmlCleanupParser();
return msWCSException(map, "mapserv", "Internal", params->version);
return msWCSException(map, "Internal", "mapserv", params->version);
}
}
}
Expand Down Expand Up @@ -2986,7 +2986,7 @@ int msWCSDescribeCoverage20(mapObj *map, wcs20ParamsObjPtr params, owsRequestObj
static int msWCSGetCoverage20_FinalizeParamsObj(wcs20ParamsObjPtr params, wcs20AxisObjPtr *axes)
{
char *crs = NULL;

if (axes[0] != NULL) {
if(axes[0]->subset != NULL) {
msDebug("Subset for X-axis found: %s\n", axes[0]->subset->axis);
Expand Down Expand Up @@ -3604,7 +3604,7 @@ this request. Check wcs/ows_enable_request settings.", "msWCSGetCoverage20()", p
/* set the imagetype from the original outputformat back (it was removed by msSelectOutputFormat() */
msFree(map->imagetype);
map->imagetype = origImageType;

}
}

Expand Down

0 comments on commit c37b3bc

Please sign in to comment.