Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dao层没有把错误处理完善,然后展示给用户,对项目调试也有影响,以注册为例 #124

Open
cheng1997-code opened this issue Jan 12, 2020 · 0 comments
Assignees
Labels
Bug Bug

Comments

@cheng1997-code
Copy link

cheng1997-code commented Jan 12, 2020

注释掉preparedStatement.setString(2, user.getUsername());,
当dao层的sql语句出错时,只会在后台报错,
例如,注册时只检测用户名以及邮箱是否已存在,
但是如果这两项没有问题,而是插入的sql语句有问题,没有成功注册,系统不会对用户提示注册失败,会直接跳转到登录界面:
java.sql.SQLException: No value specified for parameter 2
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:418)
at com.zhonghuasheng.musicstore.dao.impl.UserDAOImpl.create(UserDAOImpl.java:41)
at com.zhonghuasheng.musicstore.dao.impl.UserDAOImpl.create(UserDAOImpl.java:15)
at com.zhonghuasheng.musicstore.service.impl.UserServiceImpl.signUp(UserServiceImpl.java:49)
at com.zhonghuasheng.musicstore.action.user.RegisterAction.doPost(RegisterAction.java:50)

@cheng1997-code cheng1997-code added the Bug Bug label Jan 12, 2020
@cheng1997-code cheng1997-code added this to TODO in MusicStore-JSP via automation Jan 12, 2020
@cheng1997-code cheng1997-code changed the title bug:dao层没有把错误处理完善,然后展示给用户,以注册为例 bug:dao层没有把错误处理完善,然后展示给用户,对项目调试也有影响,以注册为例 Jan 12, 2020
@zhonghuasheng zhonghuasheng changed the title bug:dao层没有把错误处理完善,然后展示给用户,对项目调试也有影响,以注册为例 dao层没有把错误处理完善,然后展示给用户,对项目调试也有影响,以注册为例 Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug
Projects
Development

No branches or pull requests

2 participants