Utilize StandardCharsets

Closes gh-10972
This commit is contained in:
Johnny Lim
2017-11-10 05:43:06 +09:00
committed by Stephane Nicoll
parent e9c81bf702
commit bd0dcfb172
30 changed files with 77 additions and 85 deletions

View File

@@ -16,7 +16,7 @@
package org.springframework.boot.autoconfigure.jersey;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -105,7 +105,7 @@ public class JerseyAutoConfigurationServletContainerTests {
jerseyServlet.setServlet(new ServletContainer());
jerseyServlet.setOverridable(false);
context.addChild(jerseyServlet);
String pattern = UDecoder.URLDecode("/*", Charset.forName("UTF-8"));
String pattern = UDecoder.URLDecode("/*", StandardCharsets.UTF_8);
context.addServletMappingDecoded(pattern, servletName);
}

View File

@@ -17,7 +17,7 @@
package org.springframework.boot.autoconfigure.web;
import java.net.InetAddress;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -141,7 +141,7 @@ public class ServerPropertiesTests {
public void testCustomizeUriEncoding() throws Exception {
bind("server.tomcat.uri-encoding", "US-ASCII");
assertThat(this.properties.getTomcat().getUriEncoding())
.isEqualTo(Charset.forName("US-ASCII"));
.isEqualTo(StandardCharsets.US_ASCII);
}
@Test

View File

@@ -16,7 +16,7 @@
package org.springframework.boot.autoconfigure.web.servlet;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -160,10 +160,10 @@ public class HttpEncodingAutoConfigurationTests {
.getLocaleCharsetMappings().size()).isEqualTo(2);
assertThat(this.context.getBean(MockServletWebServerFactory.class)
.getLocaleCharsetMappings().get(Locale.ENGLISH))
.isEqualTo(Charset.forName("UTF-8"));
.isEqualTo(StandardCharsets.UTF_8);
assertThat(this.context.getBean(MockServletWebServerFactory.class)
.getLocaleCharsetMappings().get(Locale.FRANCE))
.isEqualTo(Charset.forName("UTF-8"));
.isEqualTo(StandardCharsets.UTF_8);
}
@SuppressWarnings({ "unchecked", "rawtypes" })