public SortedBugCollection(File f) throws IOException, DocumentException { this(); this.readXML(f); }
/** * Read XML data from given file into this object, populating given Project * as a side effect. * * @param fileName * name of the file to read */ @Override public void readXML(String fileName) throws IOException, DocumentException { readXML(new File(fileName)); }
public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: " + PrintAppVersion.class.getName() + " <bug collection>"); System.exit(1); } FindBugs.setNoAnalysis(); SortedBugCollection bugCollection = new SortedBugCollection(); bugCollection.readXML(args[0]); System.out.println(bugCollection.getCurrentAppVersion()); } }
public void readXML(URL u) throws IOException, DocumentException { InputStream in = progessMonitoredInputStream(u.openConnection(), "Loading analysis"); dataSource = u.toString(); try { readXML(in); } catch (IOException e) { throw newIOException(u, e); } catch (DocumentException e) { throw new DocumentException("Failing reading " + u, e); } }
public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: " + RegenerateClassFeatures.class.getName() + " <bug collection> <jar file>"); System.exit(1); } SortedBugCollection bugCollection = new SortedBugCollection(); bugCollection.readXML(args[0]); new RegenerateClassFeatures(bugCollection, args[1]).execute(); bugCollection.writeXML(System.out); } }
public CopyBuggySource(String[] args) throws Exception { origCollection = new SortedBugCollection(); origCollection.readXML(args[0]); project = origCollection.getProject(); sourceFinder = new SourceFinder(project); src = new File(args[1]); kind = SrcKind.get(src); switch (kind) { case DIR: break; case ZIP: zOut = new ZipOutputStream(new FileOutputStream(src)); break; case Z0P_GZ: zOut = new ZipOutputStream(new DeflaterOutputStream(new FileOutputStream(src))); zOut.setLevel(0); break; } }
public static void main(String[] args) throws Exception { FindBugs.setNoAnalysis(); DetectorFactoryCollection.instance(); // load plugins SortedBugCollection bugCollection = new SortedBugCollection(); int argCount = 0; if (argCount < args.length) { bugCollection.readXML(args[argCount++]); } else { bugCollection.readXML(System.in); } new TreemapVisualization().generateTreeMap(bugCollection); } }
public static void main(String[] args) throws Exception { if (args.length != 1) { System.out.println("Usage: " + ListErrors.class.getName() + " <bug collection>"); System.exit(1); } FindBugs.setNoAnalysis(); SortedBugCollection bugCollection = new SortedBugCollection(); bugCollection.readXML(args[0]); for (AnalysisError e : bugCollection.getErrors()) { String msg = e.getExceptionMessage(); if (msg != null && msg.trim().length() > 0) { System.out.println(e.getMessage() + " : " + msg); } else { System.out.println(e.getMessage()); } } } }
@SuppressFBWarnings("DM_EXIT") public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: " + AddMessages.class.getName() + " <input collection> <output collection>"); System.exit(1); } // Load plugins, in order to get message files DetectorFactoryCollection.instance(); String inputFile = args[0]; String outputFile = args[1]; Project project = new Project(); SortedBugCollection inputCollection = new SortedBugCollection(project); inputCollection.readXML(inputFile); Document document = inputCollection.toDocument(); AddMessages addMessages = new AddMessages(inputCollection, document); addMessages.execute(); XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(outputFile)), OutputFormat.createPrettyPrint()); writer.write(document); writer.close(); } }
/** * Read XML data from given file into this object, populating given Project * as a side effect. * * @param file * the file */ public void readXML(File file) throws IOException, DocumentException { project.setCurrentWorkingDirectory(file.getParentFile()); dataSource = file.getAbsolutePath(); InputStream in = progessMonitoredInputStream(file, "Loading analysis"); try { readXML(in, file); } catch (IOException e) { throw newIOException(file, e); } catch (DocumentException e) { throw new DocumentException("Failing reading " + file, e); } }
public final void reportBugsFromXml(@WillClose InputStream in, Project theProject) throws IOException, DocumentException { SortedBugCollection theCollection = new SortedBugCollection(theProject); theCollection.readXML(in); for (BugInstance bug : theCollection.getCollection()) { doReportBug(bug); } }
public static void main(String[] args) throws Exception { FindBugs.setNoAnalysis(); DetectorFactoryCollection.instance(); // load plugins RebornIssues reborn = new RebornIssues(); CommandLine commandLine = new CommandLine(); int argCount = commandLine.parse(args, 0, 2, "Usage: " + RebornIssues.class.getName() + " [options] [<xml results> [<history>]] "); SortedBugCollection bugCollection = new SortedBugCollection(); if (argCount < args.length) { bugCollection.readXML(args[argCount++]); } else { bugCollection.readXML(System.in); } reborn.setBugCollection(bugCollection); reborn.execute(); } }
public static void main(String[] args) throws Exception { DetectorFactoryCollection.instance(); // load plugins Churn churn = new Churn(); ChurnCommandLine commandLine = churn.new ChurnCommandLine(); int argCount = commandLine .parse(args, 0, 2, "Usage: " + Churn.class.getName() + " [options] [<xml results> [<history>]] "); SortedBugCollection bugCollection = new SortedBugCollection(); if (argCount < args.length) { bugCollection.readXML(args[argCount++]); } else { bugCollection.readXML(System.in); } churn.setBugCollection(bugCollection); churn.execute(); PrintStream out = System.out; try { if (argCount < args.length) { out = UTF8.printStream(new FileOutputStream(args[argCount++]), true); } churn.dump(out); } finally { out.close(); } } }
SortedBugCollection more = new SortedBugCollection(); more.readXML(argv[i]); if (results == null) { results = more.createEmptyCollectionWithMetadata();
@Test public void testBugInstanceXmlPropsWithReviews() throws Exception { SortedBugCollection bc = new SortedBugCollection(); bc.readXML(new StringReader( "<BugCollection version='1.3.10-dev-20100728' sequence='0' timestamp='1280333223462' analysisTimestamp='1280333224881' release=''>" + " <BugInstance type='MS_MUTABLE_ARRAY' priority='1' abbrev='MS' category='MALICIOUS_CODE' instanceHash='1acc5c5b9b7ab9efacede805afe1e53a' instanceOccurrenceNum='0' instanceOccurrenceMax='0' rank='16' ageInDays='108' firstSeen='4/11/10 11:24 AM' reviews='4' consensus='NOT_A_BUG' notAProblem='true'>"
@Test public void testBugInstanceXmlPropsWithReviewsShouldFix() throws Exception { SortedBugCollection bc = new SortedBugCollection(); bc.readXML(new StringReader( "<BugCollection version='1.3.10-dev-20100728' sequence='0' timestamp='1280333223462' analysisTimestamp='1280333224881' release=''>" + " <BugInstance type='MS_MUTABLE_ARRAY' priority='1' abbrev='MS' category='MALICIOUS_CODE' instanceHash='1acc5c5b9b7ab9efacede805afe1e53a' instanceOccurrenceNum='0' instanceOccurrenceMax='0' rank='16' ageInDays='108' firstSeen='4/11/10 11:24 AM' reviews='4' consensus='SHOULD_FIX' shouldFix='true'>"
@Test public void testBugInstanceXmlPropsNoReviews() throws Exception { SortedBugCollection bc = new SortedBugCollection(); bc.readXML(new StringReader( "<BugCollection version='1.3.10-dev-20100728' sequence='0' timestamp='1280333223462' analysisTimestamp='1280333224881' release=''>" + " <BugInstance type='MS_MUTABLE_ARRAY' priority='1' abbrev='MS' category='MALICIOUS_CODE' instanceHash='1acc5c5b9b7ab9efacede805afe1e53a' instanceOccurrenceNum='0' instanceOccurrenceMax='0' rank='16' ageInDays='108' firstSeen='4/11/10 11:24 AM'>"