Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to understand error message

 
amit malhotra
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
thanx,bye
 
Junilu Lacar
Bartender
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the index value that the original poster is trying to use is -1, which is invalid (needless to say).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic