Use StandardCharsets where possible
Closes gh-11036
This commit is contained in:
committed by
Stephane Nicoll
parent
bcab23e538
commit
1e4941e29a
@@ -94,6 +94,10 @@ public class JavaCompilerFieldValuesParser implements FieldValuesParser {
|
||||
Map<String, Object> values = new HashMap<>();
|
||||
values.put("Boolean.TRUE", true);
|
||||
values.put("Boolean.FALSE", false);
|
||||
values.put("StandardCharsets.ISO_8859_1", "ISO-8859-1");
|
||||
values.put("StandardCharsets.UTF_8", "UTF-8");
|
||||
values.put("StandardCharsets.UTF_16", "UTF-16");
|
||||
values.put("StandardCharsets.US_ASCII", "US-ASCII");
|
||||
wellKnownStaticFinals = Collections.unmodifiableMap(values);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.boot.configurationsample.fieldvalues;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.springframework.boot.configurationsample.ConfigurationProperties;
|
||||
import org.springframework.util.MimeType;
|
||||
@@ -41,7 +42,7 @@ public class FieldValues {
|
||||
|
||||
private static final Integer INTEGER_OBJ_CONST = 4;
|
||||
|
||||
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
|
||||
|
||||
private static final MimeType DEFAULT_MIME_TYPE = MimeType.valueOf("text/plain");
|
||||
|
||||
@@ -77,7 +78,7 @@ public class FieldValues {
|
||||
|
||||
private Integer integerObjectConst = INTEGER_OBJ_CONST;
|
||||
|
||||
private Charset charset = Charset.forName("US-ASCII");
|
||||
private Charset charset = StandardCharsets.US_ASCII;
|
||||
|
||||
private Charset charsetConst = DEFAULT_CHARSET;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user