将字符串解析为双精度得到错误java.lang.NumberFormatException:空字符串

发布于 2025-01-06 08:18:38 字数 4165 浏览 1 评论 0 原文

当我计算字符串值时出现此错误:Double.toString(Double.parseDouble(suggestionSortScore) - 6)

17:47:19,983 信息 [STDOUT] [EDS 全部列表] NOC 黑名单:Sugeng 欣达乔

17:47:19,984 Servlet jsp 的错误 [[jsp]] Servlet.service() 抛出 异常 java.lang.NumberFormatException:空字符串 在 sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994) 在 java.lang.Double.parseDouble(Double.java:510) 在 org.apache.jsp.WEB_002dINF.jsp.n51Alist_jsp.getTransactionsFromIpg(n51Alist_jsp.java:380) 在 org.apache.jsp.WEB_002dINF.jsp.n51Alist_jsp._jspService(n51Alist_jsp.java:581) 在 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 在org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373) 在 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336) 在 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 在org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654) 在org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445) 在org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379) 在 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292) 在 nsia.owasp.util.Controller.doPost(Controller.java:166) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:710) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:803) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 在 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 在 org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) 在 org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) 在 org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) 在 org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437) 在 org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366) 在 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) 在 java.lang.Thread.run(Thread.java:662) 17:47:19,984 INFO [STDOUT] 异常 => org.apache.jasper.JasperException:异常 处理 JSP 页面 /WEB-INF/jsp/n51Alist.jsp 时发生在第 370 行

367:如果(cekBlackListByNoc==true){

368: System.out.println("[EDS 全部列表] NOC 黑色 列表:“+nameOnCardDecrypt);

369: 数据[0] = "黄色";

370: 数据[17] = Double.toString(Double.parseDouble(suggestionSortScore) - 6);

371: if (Double.parseDouble(data[17]) < 3.0) {

372: 数据[17] = "3.1";

373:}

为什么堆栈跟踪显示空字符串? suggestsortscore 填充值“5.0”。

i get this error when i calculate the string value : Double.toString(Double.parseDouble(suggestionSortScore) - 6)

17:47:19,983 INFO [STDOUT] [EDS ALL LIST] NOC BLACK LIST : Sugeng
Hindarjo

17:47:19,984 ERROR [[jsp]] Servlet.service() for servlet jsp threw
exception java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
at java.lang.Double.parseDouble(Double.java:510)
at org.apache.jsp.WEB_002dINF.jsp.n51Alist_jsp.getTransactionsFromIpg(n51Alist_jsp.java:380)
at org.apache.jsp.WEB_002dINF.jsp.n51Alist_jsp._jspService(n51Alist_jsp.java:581)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
at nsia.owasp.util.Controller.doPost(Controller.java:166)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:662) 17:47:19,984 INFO [STDOUT] Exception => org.apache.jasper.JasperException: An exception
occurred processing JSP page /WEB-INF/jsp/n51Alist.jsp at line 370

367: if(cekBlackListByNoc==true){

368: System.out.println("[EDS ALL LIST] NOC BLACK
LIST : " + nameOnCardDecrypt);

369: data[0] = "yellow";

370: data[17] =
Double.toString(Double.parseDouble(suggestionSortScore) - 6);

371: if (Double.parseDouble(data[17]) < 3.0) {

372: data[17] = "3.1";

373: }

why the stacktrace said emptystring? the suggestionsortscore is filled with value "5.0".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

终止放荡 2025-01-13 08:18:38

Double.toString(Double.parseDouble(suggestionSortScore) - 6) -- 仅当字符串 suggestionSortScore 不包含可解析的 double 时才会出现异常

Double.toString(Double.parseDouble(suggestionSortScore) - 6) -- will through an exception only when string suggestionSortScore does not contain a parsable double

难理解 2025-01-13 08:18:38

该异常由 Double.parseDouble(suggestionSortScore) 启动,并表示 suggestSortScore 为空,我将再次检查。

无论如何,您可以查看以下文档: parseDouble

The exception is launched by Double.parseDouble(suggestionSortScore) and says that suggestionSortScore is empty, I'll check that again.

Anyway you can check the documentation on: parseDouble

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文