MPJCOVERAGE-18. Fix report for Inner/anonymous classes.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@126544 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -33,7 +33,7 @@ import org.apache.oro.text.perl.Perl5Util;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Venisse
|
||||
* @version $Id: CoverageReport.java,v 1.11 2004/10/15 14:49:17 evenisse Exp $
|
||||
* @version $Id$
|
||||
*/
|
||||
public class CoverageReport
|
||||
{
|
||||
@@ -280,7 +280,7 @@ public class CoverageReport
|
||||
Clazz cl = (Clazz) it.next();
|
||||
if (cl.getFile().indexOf("[Unknown]")<0)
|
||||
{
|
||||
String classFilename = cl.getFile().substring(cl.getFile().lastIndexOf("/")+1, cl.getFile().lastIndexOf(".")) + ".html";
|
||||
String classFilename = getShortFilename(cl);
|
||||
pw.println("<tr class=\"report\">");
|
||||
pw.println("<td class=\"reportText\" colspan=\"2\"><a href=\"" + classFilename + "\">" + cl.getName() + "</a></td>");
|
||||
pw.println("<td class=\"reportValue\">" + generatePercentResult(getPercentValue(cl.getLineRate())) + "</td>");
|
||||
@@ -331,7 +331,7 @@ public class CoverageReport
|
||||
Clazz cl = (Clazz) iter.next();
|
||||
if (cl.getFile().indexOf("[Unknown]")<0)
|
||||
{
|
||||
String classFilename = cl.getFile().substring(cl.getFile().lastIndexOf("/")+1, cl.getFile().lastIndexOf(".")) + ".html";
|
||||
String classFilename = getShortFilename(cl);
|
||||
pw.println("<tr class=\"report\">");
|
||||
pw.println("<td class=\"reportText\" colspan=\"2\"><a href=\"" + classFilename + "\">" + cl.getName() + "</a></td>");
|
||||
pw.println("<td class=\"reportValue\">" + generatePercentResult(getPercentValue(cl.getLineRate())) + "</td>");
|
||||
@@ -349,6 +349,34 @@ public class CoverageReport
|
||||
pw.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name to output the file to.
|
||||
*
|
||||
* @param cl the class to get the filename for
|
||||
* @return the filename
|
||||
*/
|
||||
private String getShortFilename(Clazz cl) {
|
||||
String name = cl.getFile().substring(cl.getFile().lastIndexOf("/")+1, cl.getFile().lastIndexOf("."));
|
||||
if (cl.getName().indexOf('$') >= 0) {
|
||||
name = name + "_" + cl.getName().substring(cl.getName().indexOf('$') + 1);
|
||||
}
|
||||
return name + ".html";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name to output the file to.
|
||||
*
|
||||
* @param cl the class to get the filename for
|
||||
* @return the filename
|
||||
*/
|
||||
private String getFullFilename(Clazz cl) {
|
||||
String name = cl.getFile().substring(0, cl.getFile().lastIndexOf("."));
|
||||
if (cl.getName().indexOf('$') >= 0) {
|
||||
name = name + "_" + cl.getName().substring(cl.getName().indexOf('$') + 1);
|
||||
}
|
||||
return name + ".html";
|
||||
}
|
||||
|
||||
private void generateSourceFiles(File dir) throws IOException
|
||||
{
|
||||
for (Iterator iter = coverage.getClasses().iterator(); iter.hasNext(); )
|
||||
@@ -364,7 +392,7 @@ public class CoverageReport
|
||||
|
||||
private void generateSourceFile(File directory, Clazz theClass) throws IOException
|
||||
{
|
||||
String srcOutputFilename = theClass.getFile().substring(0, theClass.getFile().lastIndexOf(".")) + ".html";
|
||||
String srcOutputFilename = getFullFilename(theClass);
|
||||
File srcOutputFile = new File(directory, srcOutputFilename);
|
||||
File dirOutputFile = srcOutputFile.getParentFile();
|
||||
if (dirOutputFile != null)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<action dev="evenisse" type="fix">Open report in a new window.</action>
|
||||
<action dev="evenisse" type="fix" issue="MPJCOVERAGE-20">Allow comma separeted values for maven.jcoverage.instrumentation.excludes.</action>
|
||||
<action dev="evenisse" type="fix" issue="MPJCOVERAGE-16">Fix tests failures when user use maven.jcoverage.instrumentation.excludes</action>
|
||||
<action dev="evenisse" type="fix" issue="MPJCOVERAGE-18">Fix report for Inner/anonymous classes.</action>
|
||||
</release>
|
||||
<release version="1.0.9" date="2004-11-10">
|
||||
<action dev="brett" type="fix">Fix incorrect usage of maven:addPath tag</action>
|
||||
|
||||
Reference in New Issue
Block a user