forked from phoedos/pmd
Fixed bug 797243 - CPD XML report can no longer contain ]]> (CDEnd)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2230 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -3,6 +3,7 @@ Fixed bug 782246 - FinalFieldCouldBeStatic no longer flags fields in interfaces.
|
||||
Fixed bug 782235 - "ant -version" now prints more details when a file errors out.
|
||||
Fixed bug 779874 - LooseCouplingRule no longer triggers on ArrayList
|
||||
Fixed bug 781393 - VariableNameDeclaration no longer throws ClassCastExpression since ASTLocalVariableDeclaration now subclasses AccessNode
|
||||
Fixed bug 797243 - CPD XML report can no longer contain ]]> (CDEnd)
|
||||
Fixed bug - Specifying a non-existing rule format on the command line no longer results in a ClassNotFoundException.
|
||||
XPath rules may now include pluggable parameters. This feature is very limited. For now.
|
||||
Tweaked CPD time display field
|
||||
|
@ -13,4 +13,8 @@ public class StringUtilTest extends TestCase {
|
||||
assertEquals("faaaa", StringUtil.replaceString("foo", 'o', "aa"));
|
||||
}
|
||||
|
||||
public void testReplaceStringWithString() {
|
||||
assertEquals("foo]]>bar", StringUtil.replaceString("foo]]>bar", "]]>", "]]>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package net.sourceforge.pmd.cpd;
|
||||
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.util.StringUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
@ -44,6 +45,6 @@ public class XMLRenderer implements Renderer
|
||||
buffer.append("</duplication>");
|
||||
}
|
||||
buffer.append("</pmd-cpd>");
|
||||
return buffer.toString();
|
||||
return StringUtil.replaceString(buffer.toString(), "]]>", "]]>");
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,18 @@ public class StringUtil {
|
||||
return desc.toString();
|
||||
}
|
||||
|
||||
public static String replaceString(String inputString, String oldString, String newString) {
|
||||
StringBuffer desc = new StringBuffer();
|
||||
int index = inputString.indexOf(oldString);
|
||||
int last = 0;
|
||||
while (index != -1) {
|
||||
desc.append(inputString.substring(last, index));
|
||||
desc.append(newString);
|
||||
last = index + oldString.length();
|
||||
index = inputString.indexOf(oldString, last);
|
||||
}
|
||||
desc.append(inputString.substring(last));
|
||||
return desc.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user