Ensure status in ErrorPageFilter defaults to 200

Fixes gh-1369. Note that this is caused by the ErrorPageFilter, so
only a problem when deployed as a WAR.
This commit is contained in:
Dave Syer
2014-08-13 08:14:09 -07:00
parent 0cf1c6f0e5
commit 2fae4afe95
3 changed files with 24 additions and 1 deletions

View File

@@ -93,10 +93,17 @@ public class MetricFilterAutoConfiguration {
int status = getStatus(response);
Object bestMatchingPattern = request
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
HttpStatus httpStatus = HttpStatus.OK;
try {
httpStatus = HttpStatus.valueOf(status);
}
catch (Exception e) {
// not convertible
}
if (bestMatchingPattern != null) {
suffix = bestMatchingPattern.toString().replaceAll("[{}]", "-");
}
else if (HttpStatus.valueOf(status).is4xxClientError()) {
else if (httpStatus.is4xxClientError()) {
suffix = UNKNOWN_PATH_SUFFIX;
}
String gaugeKey = getKey("response" + suffix);