File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/main/java/org/mybatis/scripting/thymeleaf Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
- * Copyright 2018 the original author or authors.
2
+ * Copyright 2018-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
36
36
import java .io .InputStream ;
37
37
import java .io .InputStreamReader ;
38
38
import java .lang .reflect .InvocationTargetException ;
39
+ import java .nio .charset .Charset ;
39
40
import java .nio .charset .StandardCharsets ;
40
41
import java .util .Optional ;
41
42
import java .util .Properties ;
@@ -104,7 +105,9 @@ private ITemplateEngine createDefaultTemplateEngine() {
104
105
try (InputStream in = Resources .getResourceAsStream (
105
106
System .getProperty ("mybatis-thymeleaf.config.file" , "mybatis-thymeleaf.properties" ))) {
106
107
if (in != null ) {
107
- String encoding = System .getProperty ("mybatis-thymeleaf.config.encoding" , StandardCharsets .UTF_8 .name ());
108
+ Charset encoding = Optional .ofNullable (System .getProperty ("mybatis-thymeleaf.config.encoding" ))
109
+ .map (Charset ::forName )
110
+ .orElse (StandardCharsets .UTF_8 );
108
111
try (InputStreamReader inReader = new InputStreamReader (in , encoding );
109
112
BufferedReader bufReader = new BufferedReader (inReader )) {
110
113
properties .load (bufReader );
You can’t perform that action at this time.
0 commit comments