KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > XMLBugReporter


1 /*
2  * FindBugs - Find bugs in Java programs
3  * Copyright (C) 2003-2005, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs;
21
22 import java.io.IOException JavaDoc;
23 import java.math.BigInteger JavaDoc;
24 import java.security.MessageDigest JavaDoc;
25 import java.util.HashMap JavaDoc;
26 import java.util.HashSet JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.Set JavaDoc;
29
30 import edu.umd.cs.findbugs.xml.OutputStreamXMLOutput;
31 import edu.umd.cs.findbugs.xml.XMLAttributeList;
32 import edu.umd.cs.findbugs.xml.XMLOutput;
33
34 /**
35  * Report warnings as an XML document.
36  *
37  * @author David Hovemeyer
38  */

39 public class XMLBugReporter extends BugCollectionBugReporter {
40
41     public XMLBugReporter(Project project) {
42         super(project);
43     }
44
45     public void setAddMessages(boolean enable) {
46         getBugCollection().setWithMessages(enable);
47     }
48
49     public void finish() {
50         try {
51         getBugCollection().writeXML(new OutputStreamXMLOutput(outputStream), getProject());
52         } catch (IOException JavaDoc e) {
53             throw new FatalException("Error writing XML output", e);
54         }
55     }
56
57 }
58
59 // vim:ts=4
60
Popular Tags