Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ import org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver;
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
* @see AnnotatedElementUtils#findMergedAnnotation
|
||||
* @see ResponseStatus
|
||||
*/
|
||||
public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionResolver implements MessageSourceAware {
|
||||
|
||||
@@ -99,14 +99,14 @@ public class ResponseStatusExceptionResolver extends AbstractHandlerExceptionRes
|
||||
|
||||
int statusCode = responseStatus.code().value();
|
||||
String reason = responseStatus.reason();
|
||||
if (this.messageSource != null) {
|
||||
reason = this.messageSource.getMessage(reason, null, reason, LocaleContextHolder.getLocale());
|
||||
}
|
||||
if (!StringUtils.hasLength(reason)) {
|
||||
response.sendError(statusCode);
|
||||
}
|
||||
else {
|
||||
response.sendError(statusCode, reason);
|
||||
String resolvedReason = (this.messageSource != null ?
|
||||
this.messageSource.getMessage(reason, null, reason, LocaleContextHolder.getLocale()) :
|
||||
reason);
|
||||
response.sendError(statusCode, resolvedReason);
|
||||
}
|
||||
return new ModelAndView();
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ public abstract class AbstractMessageConverterMethodArgumentResolver implements
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new HttpMessageNotReadableException("Could not read document: " + ex.getMessage(), ex);
|
||||
throw new HttpMessageNotReadableException("I/O error while reading input message", ex);
|
||||
}
|
||||
|
||||
if (body == NO_VALUE) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -156,8 +156,8 @@ public abstract class AbstractMessageConverterMethodProcessor extends AbstractMe
|
||||
* @param inputMessage the input messages. Used to inspect the {@code Accept} header.
|
||||
* @param outputMessage the output message to write to
|
||||
* @throws IOException thrown in case of I/O errors
|
||||
* @throws HttpMediaTypeNotAcceptableException thrown when the conditions indicated by {@code Accept} header on
|
||||
* the request cannot be met by the message converters
|
||||
* @throws HttpMediaTypeNotAcceptableException thrown when the conditions indicated
|
||||
* by the {@code Accept} header on the request cannot be met by the message converters
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <T> void writeWithMessageConverters(T value, MethodParameter returnType,
|
||||
|
||||
Reference in New Issue
Block a user