All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cflint.xml.stax.FindBugsCFLintResultMarshaller Maven / Gradle / Ivy

Go to download

A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.

There is a newer version: 1.5.0
Show newest version
package com.cflint.xml.stax;

import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import com.cflint.BugList;
import com.cflint.xml.CFLintResultMarshaller;
import com.cflint.xml.MarshallerException;

public class FindBugsCFLintResultMarshaller implements CFLintResultMarshaller {

    @Override
    public void output(BugList bugList, Writer writer, boolean showStats) throws MarshallerException {
        try {
            StringWriter sw = new StringWriter();
            DefaultCFlintResultMarshaller marshaller = new DefaultCFlintResultMarshaller();
            marshaller.output(bugList, sw, showStats);
            sw.flush();

            final Transformer transformer = TransformerFactory.newInstance().newTransformer(
                    new StreamSource(getClass().getResourceAsStream("/findbugs/cflint-to-findbugs.xsl")));

            transformer.transform(new StreamSource(new StringReader(sw.toString())), new StreamResult(writer));

        } catch (TransformerException e) {
            throw new MarshallerException(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy