final class ImportControlLoader extends AbstractLoader
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ALLOW_ELEMENT_NAME
Qualified name for element 'allow'.
|
private static java.lang.String |
DTD_PUBLIC_ID_1_0
The public ID for the configuration dtd.
|
private static java.lang.String |
DTD_PUBLIC_ID_1_1
The public ID for the configuration dtd.
|
private static java.lang.String |
DTD_PUBLIC_ID_1_2
The public ID for the configuration dtd.
|
private static java.lang.String |
DTD_PUBLIC_ID_1_3
The public ID for the configuration dtd.
|
private static java.util.Map<java.lang.String,java.lang.String> |
DTD_RESOURCE_BY_ID
The map to lookup the resource name by the id.
|
private static java.lang.String |
DTD_RESOURCE_NAME_1_0
The resource for the configuration dtd.
|
private static java.lang.String |
DTD_RESOURCE_NAME_1_1
The resource for the configuration dtd.
|
private static java.lang.String |
DTD_RESOURCE_NAME_1_2
The resource for the configuration dtd.
|
private static java.lang.String |
DTD_RESOURCE_NAME_1_3
The resource for the configuration dtd.
|
private static java.lang.String |
PKG_ATTRIBUTE_NAME
Name for attribute 'pkg'.
|
private java.util.Deque<ImportControl> |
stack
Used to hold the
ImportControl objects. |
private static java.lang.String |
STRATEGY_ON_MISMATCH_ALLOWED_VALUE
Value "allowed" for attribute 'strategyOnMismatch'.
|
private static java.lang.String |
STRATEGY_ON_MISMATCH_ATTRIBUTE_NAME
Name for attribute 'strategyOnMismatch'.
|
private static java.lang.String |
STRATEGY_ON_MISMATCH_DISALLOWED_VALUE
Value "disallowed" for attribute 'strategyOnMismatch'.
|
private static java.lang.String |
SUBPACKAGE_ELEMENT_NAME
Qualified name for element 'subpackage'.
|
Modifier | Constructor and Description |
---|---|
private |
ImportControlLoader()
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
private static void |
closeStream(java.io.InputStream inputStream)
This method exists only due to bug in cobertura library
https://github.com/cobertura/cobertura/issues/170
|
private static boolean |
containsRegexAttribute(org.xml.sax.Attributes attributes)
Check if the given attributes contain the regex attribute.
|
void |
endElement(java.lang.String namespaceUri,
java.lang.String localName,
java.lang.String qName) |
private ImportControl |
getRoot()
Returns root ImportControl.
|
private static MismatchStrategy |
getStrategyForImportControl(org.xml.sax.Attributes attributes)
Utility to get a strategyOnMismatch property for "import-control" tag.
|
private static MismatchStrategy |
getStrategyForSubpackage(org.xml.sax.Attributes attributes)
Utility to get a strategyOnMismatch property for "subpackage" tag.
|
private static ImportControl |
load(org.xml.sax.InputSource source,
java.net.URI uri)
Loads the import control file from a
InputSource . |
static ImportControl |
load(java.net.URI uri)
Loads the import control file from a file.
|
private static java.lang.String |
safeGet(org.xml.sax.Attributes attributes,
java.lang.String name)
Utility to safely get an attribute.
|
void |
startElement(java.lang.String namespaceUri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attributes) |
error, fatalError, parseInputSource, resolveEntity
private static final java.lang.String DTD_PUBLIC_ID_1_0
private static final java.lang.String DTD_PUBLIC_ID_1_1
private static final java.lang.String DTD_PUBLIC_ID_1_2
private static final java.lang.String DTD_PUBLIC_ID_1_3
private static final java.lang.String DTD_RESOURCE_NAME_1_0
private static final java.lang.String DTD_RESOURCE_NAME_1_1
private static final java.lang.String DTD_RESOURCE_NAME_1_2
private static final java.lang.String DTD_RESOURCE_NAME_1_3
private static final java.util.Map<java.lang.String,java.lang.String> DTD_RESOURCE_BY_ID
private static final java.lang.String PKG_ATTRIBUTE_NAME
private static final java.lang.String STRATEGY_ON_MISMATCH_ATTRIBUTE_NAME
private static final java.lang.String STRATEGY_ON_MISMATCH_ALLOWED_VALUE
private static final java.lang.String STRATEGY_ON_MISMATCH_DISALLOWED_VALUE
private static final java.lang.String SUBPACKAGE_ELEMENT_NAME
private static final java.lang.String ALLOW_ELEMENT_NAME
private final java.util.Deque<ImportControl> stack
ImportControl
objects.private ImportControlLoader() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
- if an error occurs.org.xml.sax.SAXException
- if an error occurs.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
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
private static boolean containsRegexAttribute(org.xml.sax.Attributes attributes)
attributes
- the attributes.public void endElement(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName)
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
public static ImportControl load(java.net.URI uri) throws CheckstyleException
uri
- the uri of the file to load.ImportControl
object.CheckstyleException
- if an error occurs.private static ImportControl load(org.xml.sax.InputSource source, java.net.URI uri) throws CheckstyleException
InputSource
.source
- the source to load from.uri
- uri of the source being loaded.ImportControl
object.CheckstyleException
- if an error occurs.private static void closeStream(java.io.InputStream inputStream) throws CheckstyleException
inputStream
- the InputStream to closeCheckstyleException
- if an error occurs.private ImportControl getRoot()
ImportControl
object loaded.private static MismatchStrategy getStrategyForImportControl(org.xml.sax.Attributes attributes)
attributes
- collect to get attribute from.private static MismatchStrategy getStrategyForSubpackage(org.xml.sax.Attributes attributes)
attributes
- collect to get attribute from.private static java.lang.String safeGet(org.xml.sax.Attributes attributes, java.lang.String name) throws org.xml.sax.SAXException
attributes
- collect to get attribute from.name
- name of the attribute to get.org.xml.sax.SAXException
- if the attribute does not exist.