Java Code Examples for com.sun.org.apache.xerces.internal.impl.Constants#IS_JDK8_OR_ABOVE

The following examples show how to use com.sun.org.apache.xerces.internal.impl.Constants#IS_JDK8_OR_ABOVE . 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: XMLSchemaValidatorComponentManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 2
Source File: XMLSchemaValidatorComponentManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 3
Source File: XMLSchemaValidatorComponentManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 4
Source File: XMLSchemaValidatorComponentManager.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 5
Source File: XMLSchemaValidatorComponentManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 6
Source File: XMLSchemaValidatorComponentManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 7
Source File: XMLSchemaValidatorComponentManager.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 8
Source File: XMLSchemaValidatorComponentManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 9
Source File: XMLSchemaValidatorComponentManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of a feature.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception XMLConfigurationException If the requested feature is not known.
 */
public void setFeature(String featureId, boolean value) throws XMLConfigurationException {
    if (PARSER_SETTINGS.equals(featureId)) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (value == false && (VALIDATION.equals(featureId) || SCHEMA_VALIDATION.equals(featureId))) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    else if (USE_GRAMMAR_POOL_ONLY.equals(featureId) && value != fUseGrammarPoolOnly) {
        throw new XMLConfigurationException(Status.NOT_SUPPORTED, featureId);
    }
    if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
        if (_isSecureMode && !value) {
            throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
        }

        fInitSecurityManager.setSecureProcessing(value);
        setProperty(SECURITY_MANAGER, fInitSecurityManager);

        if (value && Constants.IS_JDK8_OR_ABOVE) {
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                    XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
        }

        return;
    }
    fConfigUpdated = true;
    fEntityManager.setFeature(featureId, value);
    fErrorReporter.setFeature(featureId, value);
    fSchemaValidator.setFeature(featureId, value);
    if (!fInitFeatures.containsKey(featureId)) {
        boolean current = super.getFeature(featureId);
        fInitFeatures.put(featureId, current ? Boolean.TRUE : Boolean.FALSE);
    }
    super.setFeature(featureId, value);
}
 
Example 10
Source File: XMLSchemaFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }

    if ((fXmlFeatures != null) &&
                fXmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
        if (name.equals(JdkXmlUtils.OVERRIDE_PARSER)
                || name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
            fXMLSchemaLoader.setFeature(name, value);
        }
        return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 11
Source File: XMLSchemaFactory.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let _useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 12
Source File: XMLSchemaFactory.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let _useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 13
Source File: XMLSchemaFactory.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let _useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 14
Source File: XMLSchemaFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }

    if ((fXmlFeatures != null) &&
                fXmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
        if (name.equals(JdkXmlUtils.OVERRIDE_PARSER)
                || name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
            fXMLSchemaLoader.setFeature(name, value);
        }
        return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 15
Source File: XMLSchemaFactory.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }

    if ((fXmlFeatures != null) &&
                fXmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
        if (name.equals(JdkXmlUtils.OVERRIDE_PARSER)
                || name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
            fXMLSchemaLoader.setFeature(name, value);
        }
        return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 16
Source File: XMLSchemaFactory.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let _useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 17
Source File: XMLSchemaFactory.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }

    if ((fXmlFeatures != null) &&
                fXmlFeatures.setFeature(name, JdkXmlFeatures.State.APIPROPERTY, value)) {
        if (name.equals(JdkXmlUtils.OVERRIDE_PARSER)
                || name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
            fXMLSchemaLoader.setFeature(name, value);
        }
        return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 18
Source File: XMLSchemaFactory.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public void setFeature(String name, boolean value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        if (System.getSecurityManager() != null && (!value)) {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(null,
                    "jaxp-secureprocessing-feature", null));
        }

        fSecurityManager.setSecureProcessing(value);
        if (value) {
            if (Constants.IS_JDK8_OR_ABOVE) {
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
                fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
                        XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
            }
        }

        fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
        return;
    } else if (name.equals(Constants.ORACLE_FEATURE_SERVICE_MECHANISM)) {
        //in secure mode, let _useServicesMechanism be determined by the constructor
        if (System.getSecurityManager() != null)
            return;
    }
    try {
        fXMLSchemaLoader.setFeature(name, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "feature-not-supported", new Object [] {identifier}));
        }
    }
}