import org.sonar.plugins.findbugs.xml.FindBugsFilter;
import org.sonar.plugins.findbugs.xml.Match;
-import javax.annotation.CheckForNull;
-
import java.io.*;
import java.util.ArrayList;
import java.util.List;
this.projectClasspath = classpath;
}
- @CheckForNull
public File getTargetXMLReport() {
- if (settings.getBoolean(FindbugsConstants.GENERATE_XML_KEY)) {
- return new File(project.getFileSystem().getSonarWorkingDirectory(), "findbugs-result.xml");
- }
- return null;
+ return new File(project.getFileSystem().getSonarWorkingDirectory(), "findbugs-result.xml");
}
public edu.umd.cs.findbugs.Project getFindbugsProject() {
package org.sonar.plugins.findbugs;
import com.google.common.collect.Lists;
-import edu.umd.cs.findbugs.DetectorFactoryCollection;
-import edu.umd.cs.findbugs.FindBugs;
-import edu.umd.cs.findbugs.FindBugs2;
-import edu.umd.cs.findbugs.Plugin;
-import edu.umd.cs.findbugs.PluginException;
-import edu.umd.cs.findbugs.Priorities;
-import edu.umd.cs.findbugs.Project;
-import edu.umd.cs.findbugs.XMLBugReporter;
+import edu.umd.cs.findbugs.*;
import edu.umd.cs.findbugs.config.UserPreferences;
import edu.umd.cs.findbugs.plugins.DuplicatePluginIdException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
xmlBugReporter.setAddMessages(true);
File xmlReport = configuration.getTargetXMLReport();
- if (xmlReport != null) {
- LOG.info("Findbugs output report: " + xmlReport.getAbsolutePath());
- xmlOutput = FileUtils.openOutputStream(xmlReport);
- } else {
- xmlOutput = new NullOutputStream();
- }
+ LOG.info("Findbugs output report: " + xmlReport.getAbsolutePath());
+ xmlOutput = FileUtils.openOutputStream(xmlReport);
xmlBugReporter.setOutputStream(new PrintStream(xmlOutput));
engine.setBugReporter(xmlBugReporter);