Merge branch '5.1.x'

This commit is contained in:
Juergen Hoeller 2019-03-25 13:59:24 +01:00
commit 3c02331983
6 changed files with 26 additions and 8 deletions

View File

@ -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"

View File

@ -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);
}

View File

@ -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 {
}
}
@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(""));
}
}

View File

@ -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 {
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")

View File

@ -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}")

View File

@ -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 {
}
/**
* 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.