博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
findbugs问题解析
阅读量:6998 次
发布时间:2019-06-27

本文共 1029 字,大约阅读时间需要 3 分钟。

hot3.png

findbugs BUG问题解析:

[RV] Exception created and dropped rather than thrown [RV_EXCEPTION_NOT_THROWN]

This code creates an exception (or error) object, but doesn't do anything with it. For example, something like

if (x < 0)

  new IllegalArgumentException("x must be nonnegative");

It was probably the intent of the programmer to throw the created exception:

if (x < 0)

  throw new IllegalArgumentException("x must be nonnegative");

Findbugs报错:

A prepared statement is generated from a nonconstant String

The code creates an SQL prepared statement from a nonconstant String. If unchecked, tainted data from a user is used in building this String, SQL injection could be used to make the prepared statement do something unexpected and undesirable.

修改方法:

java.sql.PreparedStatement如果含有变量,改成?,然后用setString、setInt等方法替代。例如

            prepareStatement = conn.prepareStatement("insert into tableName (id,name) values (?,?)");

            prepareStatement.setString(1, value1);

            prepareStatement.setString(2, value2);

转载于:https://my.oschina.net/ydsakyclguozi/blog/332799

你可能感兴趣的文章
redis
查看>>
开源项目学习方法
查看>>
block的使用
查看>>
使用Toolbar自定义布局的时候左边右边总有一点空间无法使用
查看>>
Photoshop 常用快捷键
查看>>
外观模式
查看>>
Extjs 4 grid修改某一行style
查看>>
background-position设置无效问题解决
查看>>
对称加密算法-DES
查看>>
Android BroadcastReceiver
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
jar包版本冲突问题
查看>>
物联网世界常见传输方式简介(思维导图)
查看>>
KSM导致的警告“ ksmtuned .... read-only system ” 的一些说明
查看>>
Objective C中数组排序的三种方法
查看>>
dedecms验证自定义表单不为空
查看>>
用户测评 | EDAS Serverless 上手体验
查看>>
mysql导出xls的格式
查看>>
开发者招聘节 | 2019阿里巴巴技术面试题分享(陆续放出)
查看>>