string index out of bound occurs when you
substring a string more its length...
in your code...
s.substring(start, finish) - either both start
and finish or atleast finish is more than s.length()...
regards
Viju
I am searching a string "some stuff then
checkbox=thename^http://www.thelink.com
checkbox=thename^http://www.thelink.com
checkbox=thename^http://www.thelink.com
checkbox=thename^http://www.thelink.com then some more
junk" I want to store thename^http://www.thelink.com in a vector. I am getting an error (
java.lang.StringIndexOutOfBoundsException: String index out of range: -94) at
the statement
checkboxList.addElement(s.substring(start, finish)); what would you guys/gals
suggest I do logically to fix this snip of code? any help would be
appreciated greatly.
Travis
private Vector getDeletes(String
s){ Vector checkboxList = new
Vector(); try{ int
start = 0; int finish =
0;
for(int i =0; i <
s.length();){
try{ start =
s.indexOf("checkbox=", i) + 9;
} catch(Exception
e){
lf.writeLog("/opt/SUNWips/logs/","claimMyLinksErrors.txt", "Error4.1: "
+ e.toString());
}
try{ finish =
s.indexOf("checkbox=", start)
-1;
} catch(Exception
e){
lf.writeLog("/opt/SUNWips/logs/","claimMyLinksErrors.txt", "Error4.2: "
+ e.toString());
}
try{
checkboxList.addElement(s.substring(start,
finish));
} catch(Exception
e){
} }
} catch(Exception
e){
lf.writeLog("/opt/SUNWips/logs/","claimMyLinksErrors.txt", "Error4: "
+ e.toString()); }
return checkboxList; } }
This communication, including attachments, is for the exclusive
use of addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all
copies.
|