bug fix: 修改使用默认的charset, 修改为文件自定的

Signed-off-by: 烈日下的从容 <wfh45678@163.com>
This commit is contained in:
烈日下的从容 2019-09-16 16:21:29 +08:00
parent e7a1d3cca5
commit 5c725a6b07
2 changed files with 3 additions and 8 deletions

View File

@ -49,13 +49,11 @@
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>4.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/tk.mybatis/mapper-spring-boot-starter -->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
@ -87,10 +85,6 @@
<artifactId>radar-service-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>

View File

@ -45,7 +45,7 @@ public class MobileInfoServiceImpl implements MobileInfoService {
int count = 0;
try {
Path p = FileSystems.getDefault().getPath(mobileInfoFilePath);
List<String> lines = Files.readAllLines(p, Charset.defaultCharset());
List<String> lines = Files.readAllLines(p, Charset.forName("UTF-8"));
List<MobileInfoVO> mobileInfoVOList = lines.stream().map(line -> {
String[] info = line.split(",");
MobileInfoVO mobile = new MobileInfoVO();
@ -62,7 +62,8 @@ public class MobileInfoServiceImpl implements MobileInfoService {
mobileMap.put(mobileInfoVO.getMobile(), mobileInfoVO);
}
count = mobileInfoVOList.size();
} catch (Exception ex) {
} catch (Throwable ex) {
logger.error("", ex);
throw new RuntimeException("mobile info load error");
} finally {
long cost = System.currentTimeMillis() - begin;