GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes java. lang. NumberFormatException  ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java. lang. NumberFormatException  ?" Watch "java. lang. NumberFormatException  ?" New topic
Author

java. lang. NumberFormatException ?

Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
Hi all,
i try to realize multi client.my client fetch data from server using Socket, and server provide multithread to satisfy muliticlien.My first client can successfully get data from server, but clients after the first can not, and the server will paint:

java.lang.NumberFormatException: For input string: "le"
at java.lang.NumberFormatException.forInputString(NumberFormatException.
java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:518)
at KKMultiServerThread.getHotel(KKMultiServerThread.java:36)
at KKMultiServerThread.run(KKMultiServerThread.java:75)

Can any one help me ?


SCJP 1.4 SCJD
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The message seems explicit enough.
In getHotel(), you are trying to convert a String into an int,
but the String is not a number. Its value is actually "le".

Check the getHotel() function.


[My Blog]
All roads lead to JavaRanch
Zhixiong Pan
Ranch Hand

Joined: Jan 25, 2006
Posts: 239
Hi Satou,
Thanks for your advice.I finally got the critical mistake and solved it.
 
GeeCON Prague 2014
 
subject: java. lang. NumberFormatException ?