| Author |
getting NumberFormatException
|
toukhir mujawar
Ranch Hand
Joined: Oct 11, 2006
Posts: 70
|
|
hi friends, i am getting this error while inserting the record... the error is like... java.lang.NumberFormatException: null java.lang.Integer.parseInt(Unknown Source) java.lang.Integer.parseInt(Unknown Source) dailycollection.DailyCollectionEntry.processRequest(DailyCollectionEntry.java:75) dailycollection.DailyCollectionEntry.doPost(DailyCollectionEntry.java:133) javax.servlet.http.HttpServlet.service(HttpServlet.java:760) javax.servlet.http.HttpServlet.service(HttpServlet.java:853) no null value is being inserted.... using JDK 1.5.... i m using the insert statement at one more place and it is working very well.... please help me
|
 |
A Kumar
Ranch Hand
Joined: Jul 04, 2004
Posts: 973
|
|
the values coming to the server from the client browser will be of type string.. Any int values that you are passing to the statement and which comes from the client ...has to be changed from string to int.... check in your code whether such a conversion is taking place...and what columns in the table are of type numeric...
|
 |
toukhir mujawar
Ranch Hand
Joined: Oct 11, 2006
Posts: 70
|
|
yes there are two numeric columns in the table.... but i want to know why is it working at other place?
|
 |
A Kumar
Ranch Hand
Joined: Jul 04, 2004
Posts: 973
|
|
|
Can you post the code...and what are the columns that are numeric and for what values are they causing the exception...??
|
 |
toukhir mujawar
Ranch Hand
Joined: Oct 11, 2006
Posts: 70
|
|
for the first time i am using the following code.... here the amountCash,amountCheque, amountDeposited are the numeric fields...still it is working.... For the second instance when i am trying to insert the record it is showing the following exception... and the error msg is like the above given.... note that the statement..... insert into tbl_daily_collection (collection_date,user_code,circle,amountCash,amountDeposited,DATE_OF_DEPOSITION,BANK_NAME) values (to_date('12/12/06','dd/mm/yyyy'),'wmsec','530','450','450',to_date('12/12/06','dd/mm/yyyy'),'bom'); is also working fine at SQL prompt... what can be the reason...
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
Go to Line no. 75 of DailyCollectionEntry.java Furthermore, check out Beware-of-Auto-boxing and Auto-unboxing. [ February 13, 2007: Message edited by: Adeel Ansari ]
|
 |
toukhir mujawar
Ranch Hand
Joined: Oct 11, 2006
Posts: 70
|
|
|
thanks friends i got the solution...i had made a silly mistake...
|
 |
 |
|
|
subject: getting NumberFormatException
|
|
|