我正在使用程序分析我的Java代码,我不明白错误或如何解决它 [英] I'm using a program to analyse my Java code and I don't understand the error or how to fix it
问题描述
我已经在许多平台上测试了我的代码,它的工作原理这个代码是不好的做法,可以做些什么来改进它?
这是告诉你编码(字符串如何变成字节)isn不要指定。
如果您在土耳其写了一个文本文件,并将其加载到乌兹别克斯坦,那么您可能会得到不同的结果。相反(例如),您可以直接通过使用指定的编码将字符串转换为字节,直接指定编码(请参阅 String.getBytes 为例)。
I'm using the FindBug program from Maryland University and it gives me this error.
I've tested my code on numerous platforms and it works, so why is this code bad-practice, and what can I do to improve it?
It's telling you the encoding (how the string is turned into bytes) isn't specified.
If you write a text file in Turkey, and load it up in Uzbekistan then you might get different results. Instead (for example) you could specify the encoding directly by converting the string to bytes yourself using a specified encoding (see String.getBytes for an example).
这篇关于我正在使用程序分析我的Java代码,我不明白错误或如何解决它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!