Bug 561 : JRE 1.1 and replaceAll in the link function
Last modified: 2007-10-10 05:31




Status:
RESOLVED
Resolution:
WONTFIX -
Priority:
P4
Severity:
normal

 

Reporter:
Stephen Williams
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2007-05-21 02:07
There is a replaceAll function in the link function which is not supported
by JRE1.1. This prevents the redirect to java upon clicking the screen as
an exception is thrown. To solve the problem I have written a JRE1.1
compatable replaceAll function...

/**
* This funciton is a JRE 1.1 supported version of the JRE 1.4
* String.replaceAll function.
* @param str The string in which to perform the replace.
* @param target The string to be replaced.
* @param replaceWith The string to replace the target with.
* @return The string with the replacement performed.
*/
String replaceAll(String str, String target, String replaceWith){
int index = -1;
String resString = "";
while((index = str.indexOf(target))>=0){
resString += str.substring(0, index) + replaceWith;
str = str.substring(index+1);
}
return resString+str;
}



and changed the line in link() from
url = url.replaceAll("&","^&");
to...
url = replaceAll(url, "&","^&");



cheers,
Stephen
Additional Comment #1 From fry 2007-06-10 20:25
thanks, made a note of this. i'm not sure whether we'll drop 1.1 support
altogether for the 1.0 release of processing but we'll see.. :-/
Additional Comment #2 From fry 2007-10-10 05:31
thanks again, though we've decided that for my sanity, we're dropping
support for anything prior to 1.4, so i'll close the bug.