Applied patch from : 1751053 - New XSL a la Checkstyle/Maven.

I removed a couple of System.out that i had forgotten about. 
I also tried to integrate this new Render into the PMDAntTask.

AntTask will now recognize this formatter:

<formatter      type="betterhtml" .../>

However, it failed very weirdly :

build.xml:81: Can't file XSLT sheet :etc/pmd-nicerhtml.xsl

Which is kind of weird as i use getClass().getResourceAsStream() to find the xsl, which is in the jar:

$ unzip -t pmd-4.0.jar | grep -e 'etc/pmd-n'
    testing: etc/pmd-nicerhtml.xsl    OK

I believe it is a classloarder problem, but i maybe wrong. I'll try to deceipher this later...


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5493 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Romain Pelisse 2007-08-30 17:50:45 +00:00
parent 59f4215435
commit 663d87db09
2 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ public class Formatter {
renderersByCode.put("xml", new RendererBuilder() {
public Renderer build(Object[] arg) { return new XMLRenderer(); }
});
renderersByCode.put("nicehtml", new RendererBuilder() {
renderersByCode.put("betterhtml", new RendererBuilder() {
public Renderer build(Object[] arg) { return new XSLTRenderer(); }
});
renderersByCode.put("html", new RendererBuilder() {

View File

@ -24,6 +24,8 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import net.sourceforge.pmd.ant.PMDTask;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
@ -51,12 +53,10 @@ public class XSLTRenderer extends XMLRenderer {
@Override
public void start() throws IOException {
// We keep the inital writer to put the final html output
System.out.println("render overrided");
this.outputWriter = getWriter();
// We use a new one to store the XML...
Writer w = new StringWriter();
setWriter(w);
System.out.println("Class of writer:" + getWriter().getClass());
// If don't find the xsl no need to bother doing the all report,
// so we check this here...
InputStream xslt = null;