开发者导航

作者:开发者导航 网址:www.codernav.com 简介:开发者常用的网址集锦。

博客园 首页 新随笔 联系 订阅 管理

报错信息:

MessageParserUtil.java:122, DM_DEFAULT_ENCODING, Priority: High

Dm: Found reliance on default encoding in com.huawei.nos.nosimsys.parser.MessageParserUtil.parse(File): new java.io.FileReader(File)

Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.

翻译:

找到一个方法的调用,它将执行一个字节到字符串(或字符串到字节)的转换,并假定默认的平台编码是合适的。这会导致应用程序行为在不同平台之间变化。使用替代API并明确指定字符集名称或字符集对象

源代码:

1
2
//FileReader fileReader = new FileReader(file);
//BufferedReader br = new BufferedReader(fileReader);

改为:

1
2
InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "UTF-8");
BufferedReader br = new BufferedReader(isr);
 

 

posted on 2018-07-14 15:11  开发者导航  阅读(7830)  评论(0编辑  收藏  举报