Skip to content

Commit ad88c02

Browse files
committed
Restore formatting change following revert
1 parent 4989843 commit ad88c02

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodProcessor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ else if (mediaType.equals(MediaType.ALL) || mediaType.equals(MEDIA_TYPE_APPLICAT
281281
inputMessage, outputMessage);
282282
if (body != null) {
283283
if (logger.isDebugEnabled()) {
284-
Object formatted = (body instanceof CharSequence ? "\"" + body + "\"" : body);
285-
logger.debug("Writing [" + formatted + "]");
284+
logger.debug("Writing [" + formatValue(body) + "]");
286285
}
287286
addContentDispositionHeader(inputMessage, outputMessage);
288287
if (genericConverter != null) {
@@ -399,6 +398,10 @@ private MediaType getMostSpecificMediaType(MediaType acceptType, MediaType produ
399398
return (MediaType.SPECIFICITY_COMPARATOR.compare(acceptType, produceTypeToUse) <= 0 ? acceptType : produceTypeToUse);
400399
}
401400

401+
static String formatValue(Object body) {
402+
return (body instanceof CharSequence ? "\"" + body + "\"" : body.toString());
403+
}
404+
402405
/**
403406
* Check if the path has a file extension and whether the extension is
404407
* either {@link #WHITELISTED_EXTENSIONS whitelisted} or explicitly

spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,8 @@ protected ModelAndView invokeHandlerMethod(HttpServletRequest request,
885885
mavContainer = (ModelAndViewContainer) asyncManager.getConcurrentResultContext()[0];
886886
asyncManager.clearConcurrentResult();
887887
if (logger.isDebugEnabled()) {
888-
logger.debug("Resume with async result [" +
889-
(result instanceof CharSequence ? "\"" + result + "\"" : result) + "]");
888+
String formatted = AbstractMessageConverterMethodProcessor.formatValue(result);
889+
logger.debug("Resume with async result [" + formatted + "]");
890890
}
891891
invocableMethod = invocableMethod.wrapConcurrentResult(result);
892892
}

0 commit comments

Comments
 (0)