File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes mysterious NumberFormatException/Urgent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "mysterious NumberFormatException/Urgent" Watch "mysterious NumberFormatException/Urgent" New topic

mysterious NumberFormatException/Urgent

Jo Lee
Ranch Hand

Joined: Jun 26, 2001
Posts: 35
in my jsp pages, I use url to pass some integer parameters.
such as code=5
simple enough
But when the second page try to retrieve that number by
it gives me a NumberFormatException.
It only happens on some cases, for example, if I have code=5 and anthcode=6, only code=5 will give me an exception, but anthcode=6 does not.
I deleted the files in the tomcat-4.0.4's directly and restarted tomcat multiple times, and check double checked the difference between code=5 and anthcode=6, I am pulling my hair at the moment by this mystery.
Any help is really appreciated.

Thanks a zillion
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Perhaps your parameter has a space...?
Jo Lee
Ranch Hand

Joined: Jun 26, 2001
Posts: 35
Thanks Anthony;
I doubled checked the spaces, there is no extra spaces. Another funny thing that it seems other of my java program can not handle Integer.parseInt any more. If I use Integer.parseInt(string), I get a number format exception. It not only occur on one of my computer, it occurs on both of them.
I am really lost.
Kaustubh Patil
Ranch Hand

Joined: Aug 13, 2001
Posts: 164
I am not able to detect the exact cause for your problem. But you can try one thing. Type-cast the request.getParameter() in to String before doing a parseInt.
Also chect if the parameter you get is not null. If its null can cause the NumberFormatException.

Kaustubh. Mumbai, India.
Jo Lee
Ranch Hand

Joined: Jun 26, 2001
Posts: 35
I find the problem. One of the required int paremeter is missing from one of the links
After I fixed it, it all works now. One of the String parameter has a space missing.
Thanks again
I agree. Here's the link:
subject: mysterious NumberFormatException/Urgent
It's not a secret anymore!