Java Code Examples for com.sun.org.apache.xerces.internal.impl.XMLErrorReporter#putMessageFormatter()

The following examples show how to use com.sun.org.apache.xerces.internal.impl.XMLErrorReporter#putMessageFormatter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchemaValidatorConfiguration.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example 2
Source File: SchemaValidatorConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example 3
Source File: SchemaValidatorConfiguration.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example 4
Source File: SchemaValidatorConfiguration.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example 5
Source File: SchemaValidatorConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public SchemaValidatorConfiguration(XMLComponentManager parentManager,
        XSGrammarPoolContainer grammarContainer, ValidationManager validationManager) {
    fParentComponentManager = parentManager;
    fGrammarPool = grammarContainer.getGrammarPool();
    fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
    fValidationManager = validationManager;
    // add schema message formatter to error reporter
    try {
        XMLErrorReporter errorReporter = (XMLErrorReporter) fParentComponentManager.getProperty(ERROR_REPORTER);
        if (errorReporter != null) {
            errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    // Ignore exception.
    catch (XMLConfigurationException exc) {}
}
 
Example 6
Source File: XMLSchemaLoader.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the state of a property.
 *
 * @param propertyId The property identifier.
 * @param state     The state of the property.
 *
 * @throws XMLConfigurationException Thrown when a property is not
 *                  recognized or cannot be set.
 */
public void setProperty(String propertyId,
        Object state) throws XMLConfigurationException {
    fSettingsChanged = true;
    fLoaderConfig.setProperty(propertyId, state);
    if (propertyId.equals(JAXP_SCHEMA_SOURCE)) {
        fJAXPSource = state;
        fJAXPProcessed = false;
    }
    else if (propertyId.equals(XMLGRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)state;
    }
    else if (propertyId.equals(SCHEMA_LOCATION)) {
        fExternalSchemas = (String)state;
    }
    else if (propertyId.equals(SCHEMA_NONS_LOCATION)) {
        fExternalNoNSSchema = (String) state;
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) state);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityManager.setProperty(ENTITY_RESOLVER, state);
    }
    else if (propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)state;
        if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
            fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    else if (propertyId.equals(XML_SECURITY_PROPERTY_MANAGER)) {
        XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)state;
        faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
    }
}
 
Example 7
Source File: StreamValidatorHelper.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));
    fConfiguration = new SoftReference(config);
    return config;
}
 
Example 8
Source File: StreamValidatorHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));
    fConfiguration = new SoftReference(config);
    return config;
}
 
Example 9
Source File: StreamValidatorHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));
    fConfiguration = new SoftReference(config);
    return config;
}
 
Example 10
Source File: StreamValidatorHelper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));
    fConfiguration = new SoftReference(config);
    return config;
}
 
Example 11
Source File: XMLDTDLoader.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Sets the value of a property. This method is called by the component
 * manager any time after reset when a property changes value.
 * <p>
 * <strong>Note:</strong> Components should silently ignore properties
 * that do not affect the operation of the component.
 *
 * @param propertyId The property identifier.
 * @param value      The value of the property.
 *
 * @throws SAXNotRecognizedException The component should not throw
 *                                   this exception.
 * @throws SAXNotSupportedException The component should not throw
 *                                  this exception.
 */
public void setProperty(String propertyId, Object value)
        throws XMLConfigurationException {
    if (propertyId.equals(SYMBOL_TABLE)) {
        fSymbolTable = (SymbolTable)value;
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if(propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)value;
        // Add XML message formatter if there isn't one.
        if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
            XMLMessageFormatter xmft = new XMLMessageFormatter();
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
        }
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ERROR_HANDLER)) {
        fErrorReporter.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityResolver = (XMLEntityResolver)value;
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) value);
    }
    else if(propertyId.equals(GRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)value;
    }
    else {
        throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId);
    }
}
 
Example 12
Source File: StreamValidatorHelper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));

    // Passing on the CatalogFeatures settings
    JdkXmlUtils.catalogFeaturesConfig2Config(fComponentManager, config);

    config.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE,
            fComponentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE));

    fConfiguration = new SoftReference<>(config);
    return config;
}
 
Example 13
Source File: StreamValidatorHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));

    // Passing on the CatalogFeatures settings
    JdkXmlUtils.catalogFeaturesConfig2Config(fComponentManager, config);

    config.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE,
            fComponentManager.getProperty(JdkXmlUtils.CDATA_CHUNK_SIZE));

    fConfiguration = new SoftReference<>(config);
    return config;
}
 
Example 14
Source File: XMLSchemaLoader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the state of a property.
 *
 * @param propertyId The property identifier.
 * @param state     The state of the property.
 *
 * @throws XMLConfigurationException Thrown when a property is not
 *                  recognized or cannot be set.
 */
public void setProperty(String propertyId,
        Object state) throws XMLConfigurationException {
    fSettingsChanged = true;
    fLoaderConfig.setProperty(propertyId, state);
    if (propertyId.equals(JAXP_SCHEMA_SOURCE)) {
        fJAXPSource = state;
        fJAXPProcessed = false;
    }
    else if (propertyId.equals(XMLGRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)state;
    }
    else if (propertyId.equals(SCHEMA_LOCATION)) {
        fExternalSchemas = (String)state;
    }
    else if (propertyId.equals(SCHEMA_NONS_LOCATION)) {
        fExternalNoNSSchema = (String) state;
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) state);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityManager.setProperty(ENTITY_RESOLVER, state);
    }
    else if (propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)state;
        if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
            fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    else if (propertyId.equals(XML_SECURITY_PROPERTY_MANAGER)) {
        XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)state;
        faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
    }
}
 
Example 15
Source File: XMLDTDLoader.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the value of a property. This method is called by the component
 * manager any time after reset when a property changes value.
 * <p>
 * <strong>Note:</strong> Components should silently ignore properties
 * that do not affect the operation of the component.
 *
 * @param propertyId The property identifier.
 * @param value      The value of the property.
 *
 * @throws SAXNotRecognizedException The component should not throw
 *                                   this exception.
 * @throws SAXNotSupportedException The component should not throw
 *                                  this exception.
 */
public void setProperty(String propertyId, Object value)
        throws XMLConfigurationException {
    if (propertyId.equals(SYMBOL_TABLE)) {
        fSymbolTable = (SymbolTable)value;
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if(propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)value;
        // Add XML message formatter if there isn't one.
        if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
            XMLMessageFormatter xmft = new XMLMessageFormatter();
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
        }
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ERROR_HANDLER)) {
        fErrorReporter.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityResolver = (XMLEntityResolver)value;
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) value);
    }
    else if(propertyId.equals(GRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)value;
    }
    else {
        throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId);
    }
}
 
Example 16
Source File: XMLSchemaLoader.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the state of a property.
 *
 * @param propertyId The property identifier.
 * @param state     The state of the property.
 *
 * @throws XMLConfigurationException Thrown when a property is not
 *                  recognized or cannot be set.
 */
public void setProperty(String propertyId,
        Object state) throws XMLConfigurationException {
    fSettingsChanged = true;
    fLoaderConfig.setProperty(propertyId, state);
    if (propertyId.equals(JAXP_SCHEMA_SOURCE)) {
        fJAXPSource = state;
        fJAXPProcessed = false;
    }
    else if (propertyId.equals(XMLGRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)state;
    }
    else if (propertyId.equals(SCHEMA_LOCATION)) {
        fExternalSchemas = (String)state;
    }
    else if (propertyId.equals(SCHEMA_NONS_LOCATION)) {
        fExternalNoNSSchema = (String) state;
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) state);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityManager.setProperty(ENTITY_RESOLVER, state);
    }
    else if (propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)state;
        if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
            fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    else if (propertyId.equals(XML_SECURITY_PROPERTY_MANAGER)) {
        XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)state;
        faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
    }
}
 
Example 17
Source File: XMLDTDLoader.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the value of a property. This method is called by the component
 * manager any time after reset when a property changes value.
 * <p>
 * <strong>Note:</strong> Components should silently ignore properties
 * that do not affect the operation of the component.
 *
 * @param propertyId The property identifier.
 * @param value      The value of the property.
 *
 * @throws SAXNotRecognizedException The component should not throw
 *                                   this exception.
 * @throws SAXNotSupportedException The component should not throw
 *                                  this exception.
 */
public void setProperty(String propertyId, Object value)
        throws XMLConfigurationException {
    if (propertyId.equals(SYMBOL_TABLE)) {
        fSymbolTable = (SymbolTable)value;
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if(propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)value;
        // Add XML message formatter if there isn't one.
        if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
            XMLMessageFormatter xmft = new XMLMessageFormatter();
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
        }
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ERROR_HANDLER)) {
        fErrorReporter.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityResolver = (XMLEntityResolver)value;
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) value);
    }
    else if(propertyId.equals(GRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)value;
    }
    else {
        throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId);
    }
}
 
Example 18
Source File: StreamValidatorHelper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private XMLParserConfiguration initialize() {
    XML11Configuration config = new XML11Configuration();
    if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
    }
    config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
    config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
    XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
    config.setProperty(ERROR_REPORTER, errorReporter);
    // add message formatters
    if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
        XMLMessageFormatter xmft = new XMLMessageFormatter();
        errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
        errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
    }
    config.setProperty(SYMBOL_TABLE, fComponentManager.getProperty(SYMBOL_TABLE));
    config.setProperty(VALIDATION_MANAGER, fComponentManager.getProperty(VALIDATION_MANAGER));
    config.setDocumentHandler(fSchemaValidator);
    config.setDTDHandler(null);
    config.setDTDContentModelHandler(null);
    config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
            fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
    config.setProperty(Constants.SECURITY_MANAGER,
            fComponentManager.getProperty(Constants.SECURITY_MANAGER));
    fConfiguration = new SoftReference(config);
    return config;
}
 
Example 19
Source File: XMLSchemaLoader.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the state of a property.
 *
 * @param propertyId The property identifier.
 * @param state     The state of the property.
 *
 * @throws XMLConfigurationException Thrown when a property is not
 *                  recognized or cannot be set.
 */
public void setProperty(String propertyId,
        Object state) throws XMLConfigurationException {
    fSettingsChanged = true;
    fLoaderConfig.setProperty(propertyId, state);
    if (propertyId.equals(JAXP_SCHEMA_SOURCE)) {
        fJAXPSource = state;
        fJAXPProcessed = false;
    }
    else if (propertyId.equals(XMLGRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)state;
    }
    else if (propertyId.equals(SCHEMA_LOCATION)) {
        fExternalSchemas = (String)state;
    }
    else if (propertyId.equals(SCHEMA_NONS_LOCATION)) {
        fExternalNoNSSchema = (String) state;
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) state);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityManager.setProperty(ENTITY_RESOLVER, state);
    }
    else if (propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)state;
        if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
            fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
        }
    }
    else if (propertyId.equals(XML_SECURITY_PROPERTY_MANAGER)) {
        XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)state;
        faccessExternalSchema = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA);
    }
}
 
Example 20
Source File: XMLDTDLoader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the value of a property. This method is called by the component
 * manager any time after reset when a property changes value.
 * <p>
 * <strong>Note:</strong> Components should silently ignore properties
 * that do not affect the operation of the component.
 *
 * @param propertyId The property identifier.
 * @param value      The value of the property.
 *
 * @throws SAXNotRecognizedException The component should not throw
 *                                   this exception.
 * @throws SAXNotSupportedException The component should not throw
 *                                  this exception.
 */
public void setProperty(String propertyId, Object value)
        throws XMLConfigurationException {
    if (propertyId.equals(SYMBOL_TABLE)) {
        fSymbolTable = (SymbolTable)value;
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if(propertyId.equals(ERROR_REPORTER)) {
        fErrorReporter = (XMLErrorReporter)value;
        // Add XML message formatter if there isn't one.
        if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
            XMLMessageFormatter xmft = new XMLMessageFormatter();
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
            fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
        }
        fDTDScanner.setProperty(propertyId, value);
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ERROR_HANDLER)) {
        fErrorReporter.setProperty(propertyId, value);
    }
    else if (propertyId.equals(ENTITY_RESOLVER)) {
        fEntityResolver = (XMLEntityResolver)value;
        fEntityManager.setProperty(propertyId, value);
    }
    else if (propertyId.equals(LOCALE)) {
        setLocale((Locale) value);
    }
    else if(propertyId.equals(GRAMMAR_POOL)) {
        fGrammarPool = (XMLGrammarPool)value;
    }
    else {
        throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId);
    }
}