diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java index 63ebc9f7324..31323f81e8b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2025 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. @@ -241,9 +241,9 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro } if (httpEntity instanceof ResponseEntity responseEntity) { - HttpStatusCode httpStatusCode = responseEntity.getStatusCode(); - outputMessage.getServletResponse().setStatus(httpStatusCode.value()); - if (HttpStatus.OK.value() == httpStatusCode.value()) { + HttpStatusCode returnStatus = responseEntity.getStatusCode(); + outputMessage.getServletResponse().setStatus(returnStatus.value()); + if (returnStatus.value() == HttpStatus.OK.value()) { HttpMethod method = inputMessage.getMethod(); if ((HttpMethod.GET.equals(method) || HttpMethod.HEAD.equals(method)) && isResourceNotModified(inputMessage, outputMessage)) { @@ -251,7 +251,7 @@ public class HttpEntityMethodProcessor extends AbstractMessageConverterMethodPro return; } } - else if (httpStatusCode.is3xxRedirection()) { + else if (returnStatus.is3xxRedirection()) { String location = outputHeaders.getFirst(HttpHeaders.LOCATION); if (location != null) { saveFlashAttributes(mavContainer, webRequest, location);