Browse Source

Merge branch '5.1.x'

pull/22689/head
Juergen Hoeller 6 years ago
parent
commit
3c02331983
  1. 2
      build.gradle
  2. 4
      spring-core/src/main/java/org/springframework/util/StringUtils.java
  3. 18
      spring-core/src/test/java/org/springframework/util/StringUtilsTests.java
  4. 4
      spring-web/spring-web.gradle
  5. 2
      spring-webflux/spring-webflux.gradle
  6. 4
      spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java

2
build.gradle

@ -46,7 +46,7 @@ ext { @@ -46,7 +46,7 @@ ext {
rxjava2Version = "2.2.7"
slf4jVersion = "1.7.26" // spring-jcl + consistent 3rd party deps
tiles3Version = "3.0.8"
tomcatVersion = "9.0.16"
tomcatVersion = "9.0.17"
undertowVersion = "2.0.19.Final"
gradleScriptDir = "${rootProject.projectDir}/gradle"

4
spring-core/src/main/java/org/springframework/util/StringUtils.java

@ -780,7 +780,9 @@ public abstract class StringUtils { @@ -780,7 +780,9 @@ public abstract class StringUtils {
if (tokens.length == 1) {
validateLocalePart(localeValue);
Locale resolved = Locale.forLanguageTag(localeValue);
return (resolved.getLanguage().length() > 0 ? resolved : null);
if (resolved.getLanguage().length() > 0) {
return resolved;
}
}
return parseLocaleTokens(localeValue, tokens);
}

18
spring-core/src/test/java/org/springframework/util/StringUtilsTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@ -765,4 +765,20 @@ public class StringUtilsTests { @@ -765,4 +765,20 @@ public class StringUtilsTests {
}
}
@Test
public void testInvalidLocaleWithLocaleString() {
assertEquals(new Locale("invalid"), StringUtils.parseLocaleString("invalid"));
assertEquals(new Locale("invalidvalue"), StringUtils.parseLocaleString("invalidvalue"));
assertEquals(new Locale("invalidvalue", "foo"), StringUtils.parseLocaleString("invalidvalue_foo"));
assertNull(StringUtils.parseLocaleString(""));
}
@Test
public void testInvalidLocaleWithLanguageTag() {
assertEquals(new Locale("invalid"), StringUtils.parseLocale("invalid"));
assertEquals(new Locale("invalidvalue"), StringUtils.parseLocale("invalidvalue"));
assertEquals(new Locale("invalidvalue", "foo"), StringUtils.parseLocale("invalidvalue_foo"));
assertNull(StringUtils.parseLocale(""));
}
}

4
spring-web/spring-web.gradle

@ -38,7 +38,7 @@ dependencies { @@ -38,7 +38,7 @@ dependencies {
exclude group: "javax.servlet", module: "javax.servlet-api"
}
optional("org.eclipse.jetty:jetty-reactive-httpclient:1.0.2")
optional("com.squareup.okhttp3:okhttp:3.13.1")
optional("com.squareup.okhttp3:okhttp:3.14.0")
optional("org.apache.httpcomponents:httpclient:4.5.7") {
exclude group: "commons-logging", module: "commons-logging"
}
@ -75,7 +75,7 @@ dependencies { @@ -75,7 +75,7 @@ dependencies {
testCompile("org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}")
testCompile("org.eclipse.jetty:jetty-server")
testCompile("org.eclipse.jetty:jetty-servlet")
testCompile("com.squareup.okhttp3:mockwebserver:3.13.1")
testCompile("com.squareup.okhttp3:mockwebserver:3.14.0")
testCompile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
testCompile("org.skyscreamer:jsonassert:1.5.0")
testCompile("org.xmlunit:xmlunit-matchers:2.6.2")

2
spring-webflux/spring-webflux.gradle

@ -53,7 +53,7 @@ dependencies { @@ -53,7 +53,7 @@ dependencies {
testCompile("org.eclipse.jetty:jetty-server")
testCompile("org.eclipse.jetty:jetty-servlet")
testCompile("org.eclipse.jetty:jetty-reactive-httpclient:1.0.2")
testCompile("com.squareup.okhttp3:mockwebserver:3.13.1")
testCompile("com.squareup.okhttp3:mockwebserver:3.14.0")
testCompile("org.jetbrains.kotlin:kotlin-script-runtime:${kotlinVersion}")
testRuntime("org.jetbrains.kotlin:kotlin-script-util:${kotlinVersion}")
testRuntime("org.jetbrains.kotlin:kotlin-compiler:${kotlinVersion}")

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@ -446,7 +446,7 @@ public abstract class ResponseEntityExceptionHandler { @@ -446,7 +446,7 @@ public abstract class ResponseEntityExceptionHandler {
}
/**
* A single place to customize the response body of all Exception types.
* A single place to customize the response body of all exception types.
* <p>The default implementation sets the {@link WebUtils#ERROR_EXCEPTION_ATTRIBUTE}
* request attribute and creates a {@link ResponseEntity} from the given
* body, headers, and status.

Loading…
Cancel
Save