findbug问题,在线等

hjx_gb2000 hjx_gb2000 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
写了一个方法如:

/*
* copyString
* 拷贝一段字符串到新的字符串中,这个方法会new一个新的指针
*/
public static String copyString(String src, int start, int len)
{
if(src == null)
{
return null;
}

StringBuffer sb = new StringBuffer();

for(int i = start; i < len; i++)
{
// 对src进行处理
}

return sb.toString();
}


findbugs插件检出高报警BUG。

Type Abbreviation Type Category
IL IL_INFINITE_LOOP:An apparent infinite loop
This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception).

这个BUG该怎么改啊?多谢!

...全文
评论 13
收藏 已收藏
分享
返回顶部
hjx_gb2000
Java EE 67,535 成员 225,843 内容