我正在使用程序分析我的Java代码,我不明白错误或如何解决它 [英] I'm using a program to analyse my Java code and I don't understand the error or how to fix it

查看:104
本文介绍了我正在使用程序分析我的Java代码,我不明白错误或如何解决它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用马里兰大学的FindBug程序,它给了我这个错误。



我已经在许多平台上测试了我的代码,它的工作原理这个代码是不好的做法,可以做些什么来改进它?



解决方案

这是告诉你编码(字符串如何变成字节)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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆