Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
1e4941e2
Commit
1e4941e2
authored
Nov 15, 2017
by
dreis2211
Committed by
Stephane Nicoll
Nov 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use StandardCharsets where possible
Closes gh-11036
parent
bcab23e5
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
11 deletions
+21
-11
MessageSourceProperties.java
...k/boot/autoconfigure/context/MessageSourceProperties.java
+2
-1
HttpEncodingProperties.java
...ework/boot/autoconfigure/http/HttpEncodingProperties.java
+2
-1
MailProperties.java
...ringframework/boot/autoconfigure/mail/MailProperties.java
+2
-1
AbstractViewResolverProperties.java
...utoconfigure/template/AbstractViewResolverProperties.java
+2
-1
ThymeleafProperties.java
...ork/boot/autoconfigure/thymeleaf/ThymeleafProperties.java
+2
-1
ViewResolverPropertiesTests.java
...t/autoconfigure/template/ViewResolverPropertiesTests.java
+4
-4
JavaCompilerFieldValuesParser.java
...ssor/fieldvalues/javac/JavaCompilerFieldValuesParser.java
+4
-0
FieldValues.java
...ork/boot/configurationsample/fieldvalues/FieldValues.java
+3
-2
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/context/MessageSourceProperties.java
View file @
1e4941e2
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
context
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
/**
* Configuration properties for Message Source.
...
...
@@ -37,7 +38,7 @@ public class MessageSourceProperties {
/**
* Message bundles encoding.
*/
private
Charset
encoding
=
Charset
.
forName
(
"UTF-8"
)
;
private
Charset
encoding
=
StandardCharsets
.
UTF_8
;
/**
* Loaded resource bundle files cache expiration, in seconds. When set to -1, bundles
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/http/HttpEncodingProperties.java
View file @
1e4941e2
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
http
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Locale
;
import
java.util.Map
;
...
...
@@ -32,7 +33,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties
(
prefix
=
"spring.http.encoding"
)
public
class
HttpEncodingProperties
{
public
static
final
Charset
DEFAULT_CHARSET
=
Charset
.
forName
(
"UTF-8"
)
;
public
static
final
Charset
DEFAULT_CHARSET
=
StandardCharsets
.
UTF_8
;
/**
* Charset of HTTP requests and responses. Added to the "Content-Type" header if not
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java
View file @
1e4941e2
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
mail
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -33,7 +34,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties
(
prefix
=
"spring.mail"
)
public
class
MailProperties
{
private
static
final
Charset
DEFAULT_CHARSET
=
Charset
.
forName
(
"UTF-8"
)
;
private
static
final
Charset
DEFAULT_CHARSET
=
StandardCharsets
.
UTF_8
;
/**
* SMTP server host.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractViewResolverProperties.java
View file @
1e4941e2
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
template
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
...
...
@@ -36,7 +37,7 @@ public abstract class AbstractViewResolverProperties {
private
static
final
MimeType
DEFAULT_CONTENT_TYPE
=
MimeType
.
valueOf
(
"text/html"
);
private
static
final
Charset
DEFAULT_CHARSET
=
Charset
.
forName
(
"UTF-8"
)
;
private
static
final
Charset
DEFAULT_CHARSET
=
StandardCharsets
.
UTF_8
;
/**
* Enable MVC view resolution for this technology.
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafProperties.java
View file @
1e4941e2
...
...
@@ -17,6 +17,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
thymeleaf
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
...
@@ -34,7 +35,7 @@ import org.springframework.util.MimeType;
@ConfigurationProperties
(
prefix
=
"spring.thymeleaf"
)
public
class
ThymeleafProperties
{
private
static
final
Charset
DEFAULT_ENCODING
=
Charset
.
forName
(
"UTF-8"
)
;
private
static
final
Charset
DEFAULT_ENCODING
=
StandardCharsets
.
UTF_8
;
public
static
final
String
DEFAULT_PREFIX
=
"classpath:/templates/"
;
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/template/ViewResolverPropertiesTests.java
View file @
1e4941e2
...
...
@@ -16,7 +16,7 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
template
;
import
java.nio.charset.
Charset
;
import
java.nio.charset.
StandardCharsets
;
import
org.junit.Test
;
...
...
@@ -47,7 +47,7 @@ public class ViewResolverPropertiesTests {
@Test
public
void
defaultContentTypeCustomCharset
()
{
ViewResolverProperties
properties
=
new
ViewResolverProperties
();
properties
.
setCharset
(
Charset
.
forName
(
"UTF-16"
)
);
properties
.
setCharset
(
StandardCharsets
.
UTF_16
);
assertThat
(
properties
.
getContentType
()).
hasToString
(
"text/html;charset=UTF-16"
);
}
...
...
@@ -55,7 +55,7 @@ public class ViewResolverPropertiesTests {
public
void
customContentTypeCustomCharset
()
{
ViewResolverProperties
properties
=
new
ViewResolverProperties
();
properties
.
setContentType
(
MimeTypeUtils
.
parseMimeType
(
"text/plain"
));
properties
.
setCharset
(
Charset
.
forName
(
"UTF-16"
)
);
properties
.
setCharset
(
StandardCharsets
.
UTF_16
);
assertThat
(
properties
.
getContentType
()).
hasToString
(
"text/plain;charset=UTF-16"
);
}
...
...
@@ -63,7 +63,7 @@ public class ViewResolverPropertiesTests {
public
void
customContentTypeWithPropertyAndCustomCharset
()
{
ViewResolverProperties
properties
=
new
ViewResolverProperties
();
properties
.
setContentType
(
MimeTypeUtils
.
parseMimeType
(
"text/plain;foo=bar"
));
properties
.
setCharset
(
Charset
.
forName
(
"UTF-16"
)
);
properties
.
setCharset
(
StandardCharsets
.
UTF_16
);
assertThat
(
properties
.
getContentType
())
.
hasToString
(
"text/plain;charset=UTF-16;foo=bar"
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/fieldvalues/javac/JavaCompilerFieldValuesParser.java
View file @
1e4941e2
...
...
@@ -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
);
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/fieldvalues/FieldValues.java
View file @
1e4941e2
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment