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".

4
  • 1
    pls. post code also. especially how do you initialize suggestionSortScore Commented Feb 15, 2012 at 11:10
  • 4
    You say that suggestionSortScore is 'filled' with "5.0" but personally I trust Double.parseDouble more than your assertion here... Commented Feb 15, 2012 at 11:14
  • Add a line System.out.println("["+suggestionSortScore+"]"); right before the offending line. Does it print [5.0]? Commented Feb 15, 2012 at 11:14
  • Did you examine the output of System.out.println(suggestionSortScore); immediately prior to your attempted conversion? I'm pretty sure it's not "5.0". Commented Feb 15, 2012 at 11:15

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.