allcolor/YaHP-Converter — Issue #2: Bug on <script> parsing in CHtmlToPdfFlyingSaucerTransformer.java 1.3
Author: sankarom
Created: 2012-01-13 14:24:09+00:00
State: open

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("(")) {
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(".*?");
Matcher mscript = script.matcher(a);
while (mscript.find()) a = mscript.replaceAll("");