• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

java numberformat exception

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
SunScreenCert
Asked:
SunScreenCert
1 Solution
 
zzynxSoftware engineerCommented:
Can you show us the method getParameter() used in

request.getParameter("billingDetailId");
0
 
__geof__Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now