hudson.plugins.findbugs.parser
Class FindBugsParser

java.lang.Object
  extended by hudson.plugins.findbugs.parser.FindBugsParser
All Implemented Interfaces:
hudson.plugins.analysis.core.AnnotationParser, Serializable

public class FindBugsParser
extends Object
implements hudson.plugins.analysis.core.AnnotationParser

A parser for the native FindBugs XML files (ant task, batch file or maven-findbugs-plugin >= 1.2).

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
FindBugsParser(boolean isRankActivated)
          Creates a new instance of FindBugsParser.
FindBugsParser(Collection<String> sourceFolders, boolean isRankActivated)
          Creates a new instance of FindBugsParser.
 
Method Summary
 Map<String,String> createHashToMessageMapping(InputStream file)
          Creates a mapping of FindBugs warnings to messages.
 Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(File file, Collection<String> sources, String moduleName)
          Returns the parsed FindBugs analysis file.
 Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(File file, String moduleName)
          
 Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(InputStream file, Collection<String> sources, String moduleName, Map<String,String> hashToMessageMapping)
          Returns the parsed FindBugs analysis file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FindBugsParser

public FindBugsParser(boolean isRankActivated)
Creates a new instance of FindBugsParser.

Parameters:
isRankActivated - determines whether to use the rank when evaluation the priority

FindBugsParser

public FindBugsParser(Collection<String> sourceFolders,
                      boolean isRankActivated)
Creates a new instance of FindBugsParser.

Parameters:
sourceFolders - a collection of folders to scan for source files. If empty, the source folders are guessed.
isRankActivated - determines whether to use the rank when evaluation the priority
Method Detail

parse

public Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(File file,
                                                                           String moduleName)
                                                                    throws InvocationTargetException

Specified by:
parse in interface hudson.plugins.analysis.core.AnnotationParser
Throws:
InvocationTargetException

parse

public Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(File file,
                                                                           Collection<String> sources,
                                                                           String moduleName)
                                                                    throws IOException,
                                                                           org.hudson.dom4j.DocumentException,
                                                                           SAXException
Returns the parsed FindBugs analysis file. This scanner accepts files in the native FindBugs format.

Parameters:
file - the FindBugs analysis file
sources - a collection of folders to scan for source files
moduleName - name of maven module
Returns:
the parsed result (stored in the module instance)
Throws:
IOException - if the file could not be parsed
org.hudson.dom4j.DocumentException - if the file could not be read
SAXException - if the file could not be read

createHashToMessageMapping

public Map<String,String> createHashToMessageMapping(InputStream file)
                                              throws SAXException,
                                                     IOException
Creates a mapping of FindBugs warnings to messages. A bug is represented by its unique hash code.

Parameters:
file - the FindBugs XML file
Returns:
the map of warning messages
Throws:
SAXException - if the file contains no valid XML
IOException - signals that an I/O exception has occurred.

parse

public Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(InputStream file,
                                                                           Collection<String> sources,
                                                                           String moduleName,
                                                                           Map<String,String> hashToMessageMapping)
                                                                    throws IOException,
                                                                           org.hudson.dom4j.DocumentException
Returns the parsed FindBugs analysis file. This scanner accepts files in the native FindBugs format.

Parameters:
file - the FindBugs analysis file
sources - a collection of folders to scan for source files
moduleName - name of maven module
hashToMessageMapping - mapping of hash codes to messages
Returns:
the parsed result (stored in the module instance)
Throws:
IOException - if the file could not be parsed
org.hudson.dom4j.DocumentException - in case of a parser exception


Copyright © 2004-2012 Hudson. All Rights Reserved.