Index: CoverageReport.java =================================================================== RCS file: /home/cvspublic/maven-plugins/jcoverage/src/main/org/apache/maven/jcoveragereport/CoverageReport.java,v retrieving revision 1.11 diff -u -r1.11 CoverageReport.java --- CoverageReport.java 15 Oct 2004 14:49:17 -0000 1.11 +++ CoverageReport.java 23 Jan 2005 18:44:32 -0000 @@ -280,7 +280,7 @@ 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(""); pw.println("" + cl.getName() + ""); pw.println("" + generatePercentResult(getPercentValue(cl.getLineRate())) + ""); @@ -331,7 +331,7 @@ 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(""); pw.println("" + cl.getName() + ""); pw.println("" + generatePercentResult(getPercentValue(cl.getLineRate())) + ""); @@ -349,6 +349,34 @@ 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 @@ 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)