Java. lang. NullPointerException java. lang. Double. parseDouble

Source: Internet
Author: User

Java. lang. NullPointerException:
 
1: java. lang. Double. parseDouble
 
Java code
Java. lang. NullPointerException
Sun. misc. FloatingDecimal. readJavaFormatString (FloatingDecimal. java: 991)
Java. lang. Double. parseDouble (Double. java: 510)
Com. huayu. shop. servlet. ProductCl. doPost (ProductCl. java: 115)
Javax. servlet. http. HttpServlet. service (HttpServlet. java: 710)
Javax. servlet. http. HttpServlet. service (HttpServlet. java: 803)
Com. huayu. filter. EncodeFilter. doFilter (EncodeFilter. java: 24)
 
Obviously, the problem lies in the line ProductCl. java: 115,
It may be because the passed value is null during type conversion, and a null pointer exception is reported.
You can use system. out. println ("") // output the passed value on the first line.
Or you can set a breakpoint on line 10 and debug it with debug. This will be helpful in the future.
 
Finally, the solution to this problem is:
Set the original
Double objNum = Double. parseDouble (list. get (I). getPctg_uv () * 350
/MaxNum;
Change
Double objNum = 0.0;
If (list. get (I). getPctg_amt () = null ){
} Else {
ObjNum = Double. parseDouble (list. get (I). getPctg_amt () * 350
/MaxNum;
}

Author "power of dreams"
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.