?
Solved

java numberformat exception

Posted on 2009-05-01
2
Medium Priority
?
344 Views
Last Modified: 2013-11-24
i have a billingdetailid as an Integer field.

Now this has no value when called from database so billingdetails.getbillingdetailid is null.

Now when i do
 String billingDetailId = (request.getParameter("billingDetailId"));
it throws the following error.

java.lang.NumberFormatException: For input string: "null"

Please tell  me how can i rectify it.

Thanks
0
Comment
Question by:SunScreenCert
2 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 24285892
Can you show us the method getParameter() used in

request.getParameter("billingDetailId");
0
 
LVL 6

Accepted Solution

by:
__geof__ earned 200 total points
ID: 24292889
I guess you have something like Integer.parseInt(string_param) somewhere. This type of method requires a number as string_param and null is not. You need to fix the problem so the paramter is not null there either by checking that it is not null:
if !(string_param == null){
    Integer.parseInt(string_param);
}else{
    //do whatever necessary to handle null
}

Or you could make sure that the DB doesn't return null
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Introduction to Processes
Loops Section Overview
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question