This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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: 6502

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
jQuery in Action, 3rd edition