报错信息:
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); |
--------------------迷人的分割线--------------------
作者:架构师小跟班
开发者导航: http://www.codernav.com
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
如果文中有什么错误,欢迎指出,以免更多的人被误导。
作者:架构师小跟班
开发者导航: http://www.codernav.com
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
如果文中有什么错误,欢迎指出,以免更多的人被误导。