permaculture playing cards
The moose likes Servlets and the fly likes unable to understand error message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "unable to understand error message" Watch "unable to understand error message" New topic

unable to understand error message

amit malhotra
Ranch Hand

Joined: Aug 06, 2001
Posts: 30
i am trying to upload a file using servlets given in in a book the congifuration and all is done when i try to run the code the error i get is
An unexpected error has occoured
Error description :java.lang.StringIndexOutOfBoundsException: String index out of range: -1
could some one tell me why, it is really urgent
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

It might help if you try to figure out the general vicinity in your code where the exception occurs and then post that code.
Most likely, you are passing an invalid index to a String method such as substring() or charAt()
Junilu Lacar
Sun Certified Programmer for the Java� 2 Platform

Junilu - [How to Ask Questions] [How to Answer Questions]
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
And the index value that the original poster is trying to use is -1, which is invalid (needless to say).

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
I agree. Here's the link:
subject: unable to understand error message
It's not a secret anymore!