Class SuppressionsLoader

  • All Implemented Interfaces:
    org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public final class SuppressionsLoader
    extends AbstractLoader
    Loads a filter chain of suppressions.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SuppressionsLoader()
      Creates a new SuppressionsLoader instance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.util.Map<java.lang.String,​java.lang.String> createIdToResourceNameMap()
      Creates mapping between local resources and dtd ids.
      static FilterSet loadSuppressions​(java.lang.String filename)
      Returns the suppression filters in a specified file.
      private static FilterSet loadSuppressions​(org.xml.sax.InputSource source, java.lang.String sourceName)
      Returns the suppression filters in a specified source.
      void startElement​(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)  
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DTD_PUBLIC_ID_1_0

        private static final java.lang.String DTD_PUBLIC_ID_1_0
        The public ID for the configuration dtd.
        See Also:
        Constant Field Values
      • DTD_RESOURCE_NAME_1_0

        private static final java.lang.String DTD_RESOURCE_NAME_1_0
        The resource for the configuration dtd.
        See Also:
        Constant Field Values
      • DTD_PUBLIC_ID_1_1

        private static final java.lang.String DTD_PUBLIC_ID_1_1
        The public ID for the configuration dtd.
        See Also:
        Constant Field Values
      • DTD_RESOURCE_NAME_1_1

        private static final java.lang.String DTD_RESOURCE_NAME_1_1
        The resource for the configuration dtd.
        See Also:
        Constant Field Values
      • UNABLE_TO_FIND_ERROR_MESSAGE

        private static final java.lang.String UNABLE_TO_FIND_ERROR_MESSAGE
        File search error message.
        See Also:
        Constant Field Values
      • filterChain

        private final FilterSet filterChain
        The filter chain to return in getAFilterChain(), configured during parsing.
    • Constructor Detail

      • SuppressionsLoader

        private SuppressionsLoader()
                            throws javax.xml.parsers.ParserConfigurationException,
                                   org.xml.sax.SAXException
        Creates a new SuppressionsLoader instance.
        Throws:
        javax.xml.parsers.ParserConfigurationException - if an error occurs
        org.xml.sax.SAXException - if an error occurs
    • Method Detail

      • startElement

        public void startElement​(java.lang.String namespaceUri,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes attributes)
                          throws org.xml.sax.SAXException
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
        Throws:
        org.xml.sax.SAXException
      • loadSuppressions

        public static FilterSet loadSuppressions​(java.lang.String filename)
                                          throws CheckstyleException
        Returns the suppression filters in a specified file.
        Parameters:
        filename - name of the suppressions file.
        Returns:
        the filter chain of suppression elements specified in the file.
        Throws:
        CheckstyleException - if an error occurs.
      • loadSuppressions

        private static FilterSet loadSuppressions​(org.xml.sax.InputSource source,
                                                  java.lang.String sourceName)
                                           throws CheckstyleException
        Returns the suppression filters in a specified source.
        Parameters:
        source - the source for the suppressions.
        sourceName - the name of the source.
        Returns:
        the filter chain of suppression elements in source.
        Throws:
        CheckstyleException - if an error occurs.
      • createIdToResourceNameMap

        private static java.util.Map<java.lang.String,​java.lang.String> createIdToResourceNameMap()
        Creates mapping between local resources and dtd ids.
        Returns:
        map between local resources and dtd ids.