shashirajraja/shopping-cart

Possible null pointer dereference of conn in com.shashi.service.impl.UserServiceImpl.registerUser(UserBean)

Opened this issue · 0 comments

Describe the bug
There is a branch of statement that, if executed, guarantees that a null value will be dereferenced, which would generate a NullPointerException when the code is executed. Line 46 in UserServiceImpl.java

Found through FindBUgs, white box static code testing. ps = conn.prepareStatement("insert into " + IUserConstants.TABLE_USER + " values(?,?,?,?,?,?)");

if Conn is null this could cause issues. there is line 40 which checks if conn is null but this should also be used for the insert statement on line 46

if (conn != null) {....