作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到了 findbug 警告,例如“从非常量字符串生成准备好的语句”。我的场景如下
//My code
public static int updateSQL(String sql) throws StoreException {
PreparedStatement statement = null;
statement = connection.prepareStatement(sql); //shows violation here
}
我通过方法的参数得到“sql”。如何纠正此警告?请帮助我解决此问题。
最佳答案
好吧,在这种情况下我建议忽略这个警告。它的优先级较低。这种特定错误模式的低优先级报告实际上大多是垃圾。在我看来,不应该报告它,因为 FindBugs 能够更进一步,查看 updateSQL 方法是否始终使用常量字符串调用(在这种情况下没有问题)或不(在这种情况下)将报告使用非常量字符串的具体位置)。我提交了bug report到我们的跟踪器。
关于java - FindsBug 警告 :A prepared statement is generated from a nonconstant String,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32373457/
我收到了 findbug 警告,例如“从非常量字符串生成准备好的语句”。我的场景如下 //My code public static int updateSQL(String sql) throws
我是一名优秀的程序员,十分优秀!