Bug was happened if in code part is $ sign and html report is used
http://code.google.com/p/apache-rat-pd/source/detail?r=60
Modified:
/trunk/src/main/java/org/apache/rat/pd/report/HtmlReportGenerator.java
=======================================
--- /trunk/src/main/java/org/apache/rat/pd/report/HtmlReportGenerator.java
Fri Aug 21 06:53:09 2009
+++ /trunk/src/main/java/org/apache/rat/pd/report/HtmlReportGenerator.java
Tue Sep 8 14:11:42 2009
@@ -21,6 +21,7 @@
package org.apache.rat.pd.report;
import java.util.List;
+import java.util.regex.Matcher;
import org.apache.rat.pd.engines.SearchResult;
import org.apache.rat.pd.engines.google.RegexGenerator;
@@ -126,8 +127,10 @@
String toRet = codeInClass;
// basic code highlighting
for (int i = 0; i < matchedCode.size(); i++) {
+ //Matcher.quoteReplacement is here because bug fix. More
information can be found on:
+
//http://cephas.net/blog/2006/02/09/javalangillegalargumentexception-illegal-group-reference-replaceall-and-dollar-signs/
toRet = toRet.replaceAll("(?i:(" +
regexGenerator.stringToRegex(matchedCode.get(i)) + "))",
- "<b><span style=\"color: #800000\">" +
matchedCode.get(i) + "</span></b>");
+ "<b><span style=\"color: #800000\">" +
Matcher.quoteReplacement(matchedCode.get(i)) + "</span></b>");
}
// basic code formating
toRet = toRet.replaceAll("\\n", "<BR>").replaceAll("\\t", "
");