Consistent use of JDK 7 StandardCharsets over Charset.forName
Issue: SPR-14492
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.http.converter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,7 +40,7 @@ import org.springframework.util.StreamUtils;
|
||||
*/
|
||||
public class StringHttpMessageConverter extends AbstractHttpMessageConverter<String> {
|
||||
|
||||
public static final Charset DEFAULT_CHARSET = Charset.forName("ISO-8859-1");
|
||||
public static final Charset DEFAULT_CHARSET = StandardCharsets.ISO_8859_1;
|
||||
|
||||
|
||||
private final List<Charset> availableCharsets;
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -56,8 +57,6 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
|
||||
|
||||
private static final String FILENAME_WITH_CHARSET_KEY = "filename*=";
|
||||
|
||||
private static final Charset US_ASCII = Charset.forName("us-ascii");
|
||||
|
||||
|
||||
private Set<String> multipartParameterNames;
|
||||
|
||||
@@ -161,7 +160,7 @@ public class StandardMultipartHttpServletRequest extends AbstractMultipartHttpSe
|
||||
filename = filename.substring(index + 1);
|
||||
}
|
||||
if (charset != null) {
|
||||
filename = new String(filename.getBytes(US_ASCII), charset);
|
||||
filename = new String(filename.getBytes(StandardCharsets.US_ASCII), charset);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
|
||||
Reference in New Issue
Block a user