首页 新闻 会员 周边 捐助

关于jsp报空

0
[待解决问题]

一月 30, 2021 6:38:24 下午 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet [SpglServlet] in context with path [/xiaomi] threw exception
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.valueOf(Integer.java:766)
at com.zepc.service.impl.GoodsServiceimpl.addTopicById(GoodsServiceimpl.java:85)
at com.zepc.servlet.SpglServlet.doGet(SpglServlet.java:128)
at com.zepc.servlet.SpglServlet.doPost(SpglServlet.java:160)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:651)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2451)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2440)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

血染白衣的主页 血染白衣 | 菜鸟二级 | 园豆:202
提问于:2021-01-30 18:39
< >
分享
所有回答(1)
0

分析错误信息:

java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.valueOf(Integer.java:766)
at com.zepc.service.impl.GoodsServiceimpl.addTopicById(GoodsServiceimpl.java:85)

分析上面四行错误信息:
首先第一行明确指出这是一个NumberFormatException异常,由于将null转换成数字导致;
第二行是抛出NumberFormatException异常的位置,是Integer类的parseInt方法里面抛出的;
然后下面的是方法调用链,第二行parseInt方法被第三行的valueOf方法调用,第三行的valueOf方法被第四行的GoodsServiceimpl.addTopicById方法调用;
好了,这就找出了出错的位置,是在GoodsServiceimpl类的addTopicById里面,然后在数字转换前面加一下非空判断即可。

叶遮沉阳 | 园豆:265 (菜鸟二级) | 2021-01-31 08:40
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册