A null pointer exception is displayed. The role cannot be obtained

lwaooo0777 注册会员
2023-02-27 14:22

has been modified successfully, thank you for your comments, change the code role.equals(" administrator ") to Objects.equals(role, "administrator ") can be

dsyy80 注册会员
2023-02-27 14:22

Two directions:

First whether the role parameter is passed
@Param Parameter is passed from the front end by specifying the attribute value. Parameter is passed or no parameter is passed. If role is empty, the method cannot be invoked.

Second, from the perspective of compatibility,
does not use role to call equals directly, but uses "administrator ".equas(role) to do logical processing. If role is empty or null character, do processing; if not, do service processing.

daiemen 注册会员
2023-02-27 14:22

If the problem is solved, be sure to use it.

cyl821122 注册会员
2023-02-27 14:22

reference: < a > http://t.csdn.cn/Eisvx < / a >

cupidfang8 注册会员
2023-02-27 14:22

/login is called by the browser. Check whether the role parameter is passed during the request.

xuhui820407 注册会员
2023-02-27 14:22
I don't know if you have solved this problem, if not:
  • You can refer to this article:

If you have solved the problem, I really hope you can share the solution, write a blog post about it, put a link to it in the comments section, To help more people ^-^

About the Author

Question Info

Publish Time
2023-02-27 14:22
Update Time
2023-02-27 14:22

Related Question


WebRTC getDisplayMedia不支持移动端浏览器

我如何在discord.js中使用特定的公会ID ?