apply patch 3084292: character reference in xml report - thanks to Seko

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.3.x@7318 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Romain Pelisse 2011-09-23 17:34:11 +00:00
parent 4155d94028
commit 340e0f2583
2 changed files with 35 additions and 46 deletions

View File

@ -1,6 +1,7 @@
?? ??, 201? - 4.3:
Add options --ignore-literals and --ignore-identifiers to the CPD command line task, thanks to Cd-Man
Fixed character reference in xml report - thanks to Seko
September 14, 2011 - 4.2.6:
Fixed bug 2920057 - False + : CloseRessource whith an external getter

View File

@ -11,14 +11,6 @@ public class StringUtil {
public static final String[] EMPTY_STRINGS = new String[0];
private static final boolean supportsUTF8 = System.getProperty("net.sourceforge.pmd.supportUTF8", "no").equals("yes");
private static final String[] ENTITIES;
static {
ENTITIES = new String[256 - 126];
for (int i = 126; i <= 255; i++) {
ENTITIES[i - 126] = "&#" + i + ';';
}
}
public static String replaceString(String original, char oldChar, String newString) {
@ -79,11 +71,7 @@ public class StringUtil {
c = src.charAt(i);
if (c > '~') {// 126
if (!supportUTF8) {
if (c <= 255) {
buf.append(ENTITIES[c - 126]);
} else {
buf.append("&u").append(Integer.toHexString(c)).append(';');
}
buf.append("&#x").append(Integer.toHexString(c)).append(';');
} else {
buf.append(c);
}