hudson.plugins.findbugs.parser
Class FindBugsParser

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

public class FindBugsParser
extends java.lang.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()
          Creates a new instance of FindBugsParser.
FindBugsParser(java.util.Collection<java.lang.String> sourceFolders)
          Creates a new instance of FindBugsParser.
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> createHashToMessageMapping(java.io.InputStream file)
          Creates a mapping of FindBugs warnings to messages.
 java.util.Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(java.io.File file, java.util.Collection<java.lang.String> sources, java.lang.String moduleName)
          Returns the parsed FindBugs analysis file.
 java.util.Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(java.io.File file, java.lang.String moduleName)
          
 java.util.Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(java.io.InputStream file, java.util.Collection<java.lang.String> sources, java.lang.String moduleName, java.util.Map<java.lang.String,java.lang.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()
Creates a new instance of FindBugsParser.


FindBugsParser

public FindBugsParser(java.util.Collection<java.lang.String> sourceFolders)
Creates a new instance of FindBugsParser.

Parameters:
sourceFolders - a collection of folders to scan for source files. If empty, the source folders are guessed.
Method Detail

parse

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

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

parse

public java.util.Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(java.io.File file,
                                                                                     java.util.Collection<java.lang.String> sources,
                                                                                     java.lang.String moduleName)
                                                                              throws java.io.IOException,
                                                                                     org.dom4j.DocumentException,
                                                                                     org.xml.sax.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:
java.io.IOException - if the file could not be parsed
org.dom4j.DocumentException - if the file could not be read
org.xml.sax.SAXException - if the file could not be read

createHashToMessageMapping

public java.util.Map<java.lang.String,java.lang.String> createHashToMessageMapping(java.io.InputStream file)
                                                                            throws org.xml.sax.SAXException,
                                                                                   java.io.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:
org.xml.sax.SAXException - if the file contains no valid XML
java.io.IOException - signals that an I/O exception has occurred.

parse

public java.util.Collection<hudson.plugins.analysis.util.model.FileAnnotation> parse(java.io.InputStream file,
                                                                                     java.util.Collection<java.lang.String> sources,
                                                                                     java.lang.String moduleName,
                                                                                     java.util.Map<java.lang.String,java.lang.String> hashToMessageMapping)
                                                                              throws java.io.IOException,
                                                                                     org.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:
java.io.IOException - if the file could not be parsed
org.dom4j.DocumentException - in case of a parser exception


Copyright © 2004-2011. All Rights Reserved.