Java Code Examples for jdk.xml.internal.JdkXmlFeatures#getFeature()

The following examples show how to use jdk.xml.internal.JdkXmlFeatures#getFeature() . 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: TransformerFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {



    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example 2
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {



    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example 3
Source File: XMLSchemaFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example 4
Source File: XMLSchemaFactory.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example 5
Source File: XMLSchemaFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
                    JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example 6
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 */
public TransformerFactoryImpl() {



    if (System.getSecurityManager() != null) {
        _isSecureMode = true;
        _isNotSecureProcessing = false;
    }

    _xmlFeatures = new JdkXmlFeatures(!_isNotSecureProcessing);
    _overrideDefaultParser = _xmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _xmlSecurityPropertyMgr = new XMLSecurityPropertyManager();
    _accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_DTD);
    _accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
            Property.ACCESS_EXTERNAL_STYLESHEET);

    //Parser's security manager
    _xmlSecurityManager = new XMLSecurityManager(true);
    //Unmodifiable hash map with loaded external extension functions
    _xsltcExtensionFunctions = null;
}
 
Example 7
Source File: XPathImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example 8
Source File: XSLTC.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLTC compiler constructor
 */
public XSLTC(JdkXmlFeatures featureManager) {
    _overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _parser = new Parser(this, _overrideDefaultParser);
    _xmlFeatures = featureManager;
    _extensionClassLoader = null;
    _externalExtensionFunctions = new HashMap<>();
}
 
Example 9
Source File: XPathExpressionImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
        JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
        XPathVariableResolver variableResolver, boolean featureSecureProcessing,
        JdkXmlFeatures featureManager) {
    this.xpath = xpath;
    this.prefixResolver = prefixResolver;
    this.functionResolver = functionResolver;
    this.variableResolver = variableResolver;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example 10
Source File: XSLTC.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * XSLTC compiler constructor
 */
public XSLTC(JdkXmlFeatures featureManager, boolean hasListener) {
    _overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _parser = new Parser(this, _overrideDefaultParser, hasListener);
    _xmlFeatures = featureManager;
    _extensionClassLoader = null;
    _externalExtensionFunctions = new HashMap<>();
}
 
Example 11
Source File: XPathExpressionImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
        JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
        XPathVariableResolver variableResolver, boolean featureSecureProcessing,
        JdkXmlFeatures featureManager) {
    this.xpath = xpath;
    this.prefixResolver = prefixResolver;
    this.functionResolver = functionResolver;
    this.variableResolver = variableResolver;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example 12
Source File: XSLTC.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLTC compiler constructor
 */
public XSLTC(JdkXmlFeatures featureManager) {
    _overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _parser = new Parser(this, _overrideDefaultParser);
    _xmlFeatures = featureManager;
    _extensionClassLoader = null;
    _externalExtensionFunctions = new HashMap<>();
}
 
Example 13
Source File: XPathExpressionImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
        JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
        XPathVariableResolver variableResolver, boolean featureSecureProcessing,
        JdkXmlFeatures featureManager) {
    this.xpath = xpath;
    this.prefixResolver = prefixResolver;
    this.functionResolver = functionResolver;
    this.variableResolver = variableResolver;
    this.featureSecureProcessing = featureSecureProcessing;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    this.featureManager = featureManager;
}
 
Example 14
Source File: XMLSchemaFactory.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public XMLSchemaFactory() {
    fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
    fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
    fXMLGrammarPoolWrapper = new XMLGrammarPoolWrapper();
    fXMLSchemaLoader.setFeature(SCHEMA_FULL_CHECKING, true);
    fXMLSchemaLoader.setProperty(XMLGRAMMAR_POOL, fXMLGrammarPoolWrapper);
    fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
    fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
    fUseGrammarPoolOnly = true;

    // Enable secure processing feature by default
    fSecurityManager = new XMLSecurityManager(true);
    fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);

    fSecurityPropertyMgr = new XMLSecurityPropertyManager();
    fXMLSchemaLoader.setProperty(XML_SECURITY_PROPERTY_MANAGER,
            fSecurityPropertyMgr);

    // use catalog
    fXMLSchemaLoader.setFeature(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT);
    for (Feature f : Feature.values()) {
        fXMLSchemaLoader.setProperty(f.getPropertyName(), null);
    }

    fXMLSchemaLoader.setProperty(JdkXmlUtils.CDATA_CHUNK_SIZE, JdkXmlUtils.CDATA_CHUNK_SIZE_DEFAULT);
    fXmlFeatures = new JdkXmlFeatures(fSecurityManager.isSecureProcessing());
    fOverrideDefaultParser = fXmlFeatures.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    fXMLSchemaLoader.setFeature(JdkXmlUtils.OVERRIDE_PARSER, fOverrideDefaultParser);
}
 
Example 15
Source File: XPathImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example 16
Source File: JAXPExtensionsProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public JAXPExtensionsProvider(XPathFunctionResolver resolver,
    boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
    this.resolver = resolver;
    if (featureSecureProcessing &&
            !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
        this.extensionInvocationDisabled = true;
    }
}
 
Example 17
Source File: XPathImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
        boolean featureSecureProcessing, JdkXmlFeatures featureManager) {
    this.origVariableResolver = this.variableResolver = vr;
    this.origFunctionResolver = this.functionResolver = fr;
    this.featureSecureProcessing = featureSecureProcessing;
    this.featureManager = featureManager;
    this.overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
}
 
Example 18
Source File: JAXPExtensionsProvider.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public JAXPExtensionsProvider(XPathFunctionResolver resolver,
    boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
    this.resolver = resolver;
    if (featureSecureProcessing &&
            !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
        this.extensionInvocationDisabled = true;
    }
}
 
Example 19
Source File: JAXPExtensionsProvider.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public JAXPExtensionsProvider(XPathFunctionResolver resolver,
    boolean featureSecureProcessing, JdkXmlFeatures featureManager ) {
    this.resolver = resolver;
    if (featureSecureProcessing &&
            !featureManager.getFeature(JdkXmlFeatures.XmlFeature.ENABLE_EXTENSION_FUNCTION)) {
        this.extensionInvocationDisabled = true;
    }
}
 
Example 20
Source File: XSLTC.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * XSLTC compiler constructor
 */
public XSLTC(JdkXmlFeatures featureManager) {
    _overrideDefaultParser = featureManager.getFeature(
            JdkXmlFeatures.XmlFeature.JDK_OVERRIDE_PARSER);
    _parser = new Parser(this, _overrideDefaultParser);
    _xmlFeatures = featureManager;
    _extensionClassLoader = null;
    _externalExtensionFunctions = new HashMap<>();
}