This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting NumberFormatException

 
toukhir mujawar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks friends i got the solution...i had made a silly mistake...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic