Browse Source

Add @Nullable to setLocale in MockHttpServletResponse

See gh-26493
pull/27236/head
Sam Brannen 3 years ago
parent
commit
5b3f11c543
  1. 5
      spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java
  2. 5
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java

5
spring-test/src/main/java/org/springframework/mock/web/MockHttpServletResponse.java

@ -358,7 +358,10 @@ public class MockHttpServletResponse implements HttpServletResponse { @@ -358,7 +358,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
}
@Override
public void setLocale(Locale locale) {
public void setLocale(@Nullable Locale locale) {
// Although the Javadoc for javax.servlet.ServletResponse.setLocale(Locale) does not
// state how a null value for the supplied Locale should be handled, both Tomcat and
// Jetty simply ignore a null value. So we do the same here.
if (locale == null) {
return;
}

5
spring-web/src/testFixtures/java/org/springframework/web/testfixture/servlet/MockHttpServletResponse.java

@ -358,7 +358,10 @@ public class MockHttpServletResponse implements HttpServletResponse { @@ -358,7 +358,10 @@ public class MockHttpServletResponse implements HttpServletResponse {
}
@Override
public void setLocale(Locale locale) {
public void setLocale(@Nullable Locale locale) {
// Although the Javadoc for javax.servlet.ServletResponse.setLocale(Locale) does not
// state how a null value for the supplied Locale should be handled, both Tomcat and
// Jetty simply ignore a null value. So we do the same here.
if (locale == null) {
return;
}

Loading…
Cancel
Save