Search in sources :

Example 6 with WriterException

use of net.sourceforge.pmd.eclipse.runtime.writer.WriterException in project pmd-eclipse-plugin by pmd.

the class RuleSetWriterImpl method write.

/**
 * Write a ruleset as an XML stream
 *
 * @param writer
 *            the output writer
 * @param ruleSet
 *            the ruleset to serialize
 */
public void write(OutputStream outputStream, RuleSet ruleSet) throws WriterException {
    try {
        RuleSetWriter ruleSetWriter = new RuleSetWriter(outputStream);
        ruleSetWriter.write(ruleSet);
        outputStream.flush();
    } catch (RuntimeException e) {
        throw new WriterException(e);
    } catch (IOException e) {
        throw new WriterException(e);
    }
}
Also used : IOException(java.io.IOException) RuleSetWriter(net.sourceforge.pmd.RuleSetWriter) IRuleSetWriter(net.sourceforge.pmd.eclipse.runtime.writer.IRuleSetWriter) WriterException(net.sourceforge.pmd.eclipse.runtime.writer.WriterException)

Aggregations

WriterException (net.sourceforge.pmd.eclipse.runtime.writer.WriterException)6 IOException (java.io.IOException)4 IRuleSetWriter (net.sourceforge.pmd.eclipse.runtime.writer.IRuleSetWriter)4 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 FileOutputStream (java.io.FileOutputStream)2 OutputStream (java.io.OutputStream)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 File (java.io.File)1 FactoryConfigurationError (javax.xml.parsers.FactoryConfigurationError)1 Transformer (javax.xml.transform.Transformer)1 TransformerException (javax.xml.transform.TransformerException)1 DOMSource (javax.xml.transform.dom.DOMSource)1 StreamResult (javax.xml.transform.stream.StreamResult)1 RuleSetWriter (net.sourceforge.pmd.RuleSetWriter)1 PMDPlugin (net.sourceforge.pmd.eclipse.plugin.PMDPlugin)1 PropertiesException (net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException)1 IAstWriter (net.sourceforge.pmd.eclipse.runtime.writer.IAstWriter)1 JavaCharStream (net.sourceforge.pmd.lang.ast.JavaCharStream)1