hudson.plugins.findbugs.parser
Class NativeFindBugsParser

java.lang.Object
  extended by hudson.plugins.findbugs.parser.NativeFindBugsParser

public class NativeFindBugsParser
extends java.lang.Object

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

Author:
Ulli Hafner

Constructor Summary
NativeFindBugsParser()
           
 
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<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<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

NativeFindBugsParser

public NativeFindBugsParser()
Method Detail

parse

public java.util.Collection<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
org.xml.sax.SAXException

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<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 © 2009. All Rights Reserved.