Bug 36336 - java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Summary: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Webapps:Manager (show other bugs)
Version: 5.5.9
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-24 14:35 UTC by A.Grasoff
Modified: 2005-10-12 21:49 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description A.Grasoff 2005-08-24 14:35:29 UTC
Hi,

When I deploy (/manager) some web-application with extension .WAR (uppercase)
then I see:

SEVERE: HTMLManager: FAIL - Deploy Upload Failed, Exception: String index out of
range: -1
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(Unknown Source)
	at
org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:194)

In source of HTMLManagerServlet:

194: basename = war.substring(0, war.indexOf(".war")); // no lowerCase

BUT:

180: if (!war.toLowerCase().endsWith(".war")) // lowerCase

---
May be is better make so:

194: basename = war.substring(0, war.toLowerCase().indexOf(".war"));

Thanks.

Anton.

PS I am sorry for my English :)
Comment 1 Yoav Shapira 2005-10-13 05:49:30 UTC
Don't worry about your English ;)  Good catch, good recommendation, I've applied
it for 5.5.13.  Thank you ;)