报错信息:
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);
|