Package edu.umd.cs.findbugs
Class SAXBugCollectionHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
edu.umd.cs.findbugs.SAXBugCollectionHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
Build a BugCollection based on SAX events. This is intended to replace the
old DOM-based parsing of XML bug result files, which was very slow.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AnalysisError
private final File
private static final String
private BugAnnotationWithSourceLines
private final BugCollection
private BugInstance
private ClassFeatureSet
private static boolean
private Filter
private static final String
(package private) Pattern
private static final org.slf4j.Logger
private final Stack
<CompoundMatcher> private int
(package private) boolean
private final Project
private static final String
private final StringBuilder
private final String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionSAXBugCollectionHandler
(BugCollection bugCollection) SAXBugCollectionHandler
(BugCollection bugCollection, File base) SAXBugCollectionHandler
(Filter filter, File base) SAXBugCollectionHandler
(Project project, File base) private
SAXBugCollectionHandler
(String topLevelName, BugCollection bugCollection, Project project, File base) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
void
characters
(char[] ch, int start, int length) private SourceLineAnnotation
createSourceLineAnnotation
(String qName, Attributes attributes) boolean
discardedElement
(String qName) void
endElement
(String uri, String name, String qName) getOptionalAttribute
(Attributes attributes, String qName) private String
getRequiredAttribute
(Attributes attributes, String attrName, String elementName) private boolean
isCompoundElementTag
(String qName) private boolean
isTopLevelFilter
(String qName) private String
makeAbsolute
(String possiblyRelativePath) private String
private void
parseBugInstanceContents
(String qName, Attributes attributes) private long
private void
parseMatcher
(String qName, Attributes attributes) private void
private void
private void
setAnnotationRole
(Attributes attributes, BugAnnotation bugAnnotation) void
startElement
(String uri, String name, String qName, Attributes attributes) Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
FIND_BUGS_FILTER
- See Also:
-
PROJECT
- See Also:
-
BUG_COLLECTION
- See Also:
-
bugCollection
-
project
-
matcherStack
-
filter
-
cache
-
elementStack
-
textBuffer
-
bugInstance
-
bugAnnotationWithSourceLines
-
analysisError
-
classFeatureSet
-
stackTrace
-
nestingOfIgnoredElements
private int nestingOfIgnoredElements -
base
-
topLevelName
-
qnameCache
-
ignoredElement
Pattern ignoredElement -
DEBUG
private static boolean DEBUG -
nextMatchedIsDisabled
boolean nextMatchedIsDisabled -
outerElementTags
-
sourceDirs
-
-
Constructor Details
-
SAXBugCollectionHandler
private SAXBugCollectionHandler(String topLevelName, @CheckForNull BugCollection bugCollection, @CheckForNull Project project, @CheckForNull File base) -
SAXBugCollectionHandler
-
SAXBugCollectionHandler
-
SAXBugCollectionHandler
-
SAXBugCollectionHandler
-
-
Method Details
-
getOptionalAttribute
-
discardedElement
-
getTextContents
-
memoized
-
startElement
public void startElement(String uri, String name, String qName, Attributes attributes) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
isCompoundElementTag
-
isTopLevelFilter
-
addMatcher
-
pushCompoundMatcherAsChild
-
pushCompoundMatcher
-
parseMatcher
- Throws:
SAXException
-
parseBugInstanceContents
- Throws:
SAXException
-
parseLong
-
setAnnotationRole
-
createSourceLineAnnotation
private SourceLineAnnotation createSourceLineAnnotation(String qName, Attributes attributes) throws SAXException - Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
makeAbsolute
-
characters
public void characters(char[] ch, int start, int length) - Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
-
getRequiredAttribute
private String getRequiredAttribute(Attributes attributes, String attrName, String elementName) throws SAXException - Throws:
SAXException
-