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 AnalysisErrorprivate final Fileprivate static final Stringprivate BugAnnotationWithSourceLinesprivate final BugCollectionprivate BugInstanceprivate ClassFeatureSetprivate static booleanprivate Filterprivate static final String(package private) Patternprivate static final org.slf4j.Loggerprivate final Stack<CompoundMatcher> private int(package private) booleanprivate final Projectprivate static final Stringprivate final StringBuilderprivate final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionSAXBugCollectionHandler(BugCollection bugCollection) SAXBugCollectionHandler(BugCollection bugCollection, File base) SAXBugCollectionHandler(Filter filter, File base) SAXBugCollectionHandler(Project project, File base) privateSAXBugCollectionHandler(String topLevelName, BugCollection bugCollection, Project project, File base) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidcharacters(char[] ch, int start, int length) private SourceLineAnnotationcreateSourceLineAnnotation(String qName, Attributes attributes) booleandiscardedElement(String qName) voidendElement(String uri, String name, String qName) getOptionalAttribute(Attributes attributes, String qName) private StringgetRequiredAttribute(Attributes attributes, String attrName, String elementName) private booleanisCompoundElementTag(String qName) private booleanisTopLevelFilter(String qName) private StringmakeAbsolute(String possiblyRelativePath) private Stringprivate voidparseBugInstanceContents(String qName, Attributes attributes) private longprivate voidparseMatcher(String qName, Attributes attributes) private voidprivate voidprivate voidsetAnnotationRole(Attributes attributes, BugAnnotation bugAnnotation) voidstartElement(String uri, String name, String qName, Attributes attributes) Methods inherited from class DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
startElementin interfaceContentHandler- Overrides:
startElementin 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:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
makeAbsolute
-
characters
public void characters(char[] ch, int start, int length) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
getRequiredAttribute
private String getRequiredAttribute(Attributes attributes, String attrName, String elementName) throws SAXException - Throws:
SAXException
-