summaryrefslogtreecommitdiffstats
path: root/plugins/sonar-pmd-plugin
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-03-27 21:26:17 +0200
committersimonbrandhof <simon.brandhof@gmail.com>2011-03-27 21:26:17 +0200
commit2b560c35ab24a4f7db27d7e180a64e830b9a56a1 (patch)
tree59318ddf4d2e78688a7fa2ced83b37f921f6eac8 /plugins/sonar-pmd-plugin
parent9559e69e14d6123c3e03335e7d9b416cbac5e576 (diff)
downloadsonarqube-2b560c35ab24a4f7db27d7e180a64e830b9a56a1.tar.gz
sonarqube-2b560c35ab24a4f7db27d7e180a64e830b9a56a1.zip
fix coding violations
Diffstat (limited to 'plugins/sonar-pmd-plugin')
-rw-r--r--plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java29
1 files changed, 6 insertions, 23 deletions
diff --git a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java
index 1103d9fccb4..e1552a340f7 100644
--- a/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java
+++ b/plugins/sonar-pmd-plugin/src/main/java/org/sonar/plugins/pmd/PmdExecutor.java
@@ -19,27 +19,10 @@
*/
package org.sonar.plugins.pmd;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.List;
-
-import net.sourceforge.pmd.PMD;
-import net.sourceforge.pmd.PMDException;
-import net.sourceforge.pmd.Report;
-import net.sourceforge.pmd.RuleContext;
-import net.sourceforge.pmd.RuleSetFactory;
-import net.sourceforge.pmd.RuleSets;
-import net.sourceforge.pmd.SourceType;
+import net.sourceforge.pmd.*;
import net.sourceforge.pmd.renderers.Renderer;
import net.sourceforge.pmd.renderers.XMLRenderer;
+import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@@ -50,6 +33,9 @@ import org.sonar.api.resources.Project;
import org.sonar.api.utils.TimeProfiler;
import org.sonar.java.api.JavaUtils;
+import java.io.*;
+import java.util.List;
+
public class PmdExecutor implements BatchExtension {
private static final Logger LOG = LoggerFactory.getLogger(PmdExecutor.class);
@@ -147,13 +133,10 @@ public class PmdExecutor implements BatchExtension {
xmlRenderer.start();
xmlRenderer.renderFileReport(report);
xmlRenderer.end();
- String buffer = stringwriter.toString();
File xmlReport = new File(project.getFileSystem().getSonarWorkingDirectory(), "pmd-result.xml");
LOG.info("PMD output report: " + xmlReport.getAbsolutePath());
- Writer writer = new FileWriter(xmlReport);
- writer.write(buffer, 0, buffer.length());
- writer.close();
+ FileUtils.write(xmlReport, stringwriter.toString());
return xmlReport;
}