Hi,
There is a bug in the " while for" instruction code line 136 : some scripts are forgotten by the algorithm.
REPLACE :
final List toRemove = new ArrayList();
final Pattern p = Pattern.compile("(<script\s*)");
final Matcher m = p.matcher(a);
int start = 0;
while (m.find(start)) {
final int is = m.start();
int ie = m.start();
while (ie < a.length()) {
if (a.substring(ie).startsWith("")) {
ie = ie + 9;
break;
} else {
ie++;
}
}
start = ie + 1;
toRemove.add(a.substring(is, ie));
if (start >= a.length()) {
break;
}
}
for (int i = 0; i < toRemove.size(); i++) {
final String rem = (String) toRemove.get(i);
final int index = a.indexOf(rem);
a = a.substring(0, index) + a.substring(index + rem.length());
}
BY:
Pattern script = Pattern.compile("<script.*?>.*?</script>");
Matcher mscript = script.matcher(a);
while (mscript.find()) a = mscript.replaceAll("");
Hi, There is a bug in the " while for" instruction code line 136 : some scripts are forgotten by the algorithm.
REPLACE :
final List toRemove = new ArrayList(); final Pattern p = Pattern.compile("(<script\s*)"); final Matcher m = p.matcher(a); int start = 0; while (m.find(start)) { final int is = m.start(); int ie = m.start(); while (ie < a.length()) { if (a.substring(ie).startsWith("")) { ie = ie + 9; break; } else { ie++; } } start = ie + 1; toRemove.add(a.substring(is, ie)); if (start >= a.length()) { break; } } for (int i = 0; i < toRemove.size(); i++) { final String rem = (String) toRemove.get(i); final int index = a.indexOf(rem); a = a.substring(0, index) + a.substring(index + rem.length()); }
BY: