Java Code Examples for javax.xml.transform.dom.DOMSource#FEATURE

The following examples show how to use javax.xml.transform.dom.DOMSource#FEATURE . 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: SmartTransformerFactoryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 2
Source File: SmartTransformerFactoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 3
Source File: SmartTransformerFactoryImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 4
Source File: SmartTransformerFactoryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 5
Source File: SmartTransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 6
Source File: SmartTransformerFactoryImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 7
Source File: SmartTransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 8
Source File: SmartTransformerFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 9
Source File: SmartTransformerFactoryImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but it really does not matter in a function like this
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i]))
            return true;
    }

    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return featureSecureProcessing;
    }

    // unknown feature
    return false;
}
 
Example 10
Source File: TransformerFactoryImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (_featureManager != null) ?
            _featureManager.getValueAsString(name) : null;
    if (propertyValue != null) {
        return Boolean.parseBoolean(propertyValue);
    }

    // Feature not supported
    return false;
}
 
Example 11
Source File: TransformerFactoryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (_featureManager != null) ?
            _featureManager.getValueAsString(name) : null;
    if (propertyValue != null) {
        return Boolean.parseBoolean(propertyValue);
    }

    // Feature not supported
    return false;
}
 
Example 12
Source File: TransformerFactoryImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (_featureManager != null) ?
            _featureManager.getValueAsString(name) : null;
    if (propertyValue != null) {
        return Boolean.parseBoolean(propertyValue);
    }

    // Feature not supported
    return false;
}
 
Example 13
Source File: TransformerFactoryImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (_featureManager != null) ?
            _featureManager.getValueAsString(name) : null;
    if (propertyValue != null) {
        return Boolean.parseBoolean(propertyValue);
    }

    // Feature not supported
    return false;
}
 
Example 14
Source File: TransformerFactoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }

    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatues **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}
 
Example 15
Source File: TransformerFactoryImpl.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }

    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatues **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}
 
Example 16
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatures **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}
 
Example 17
Source File: TransformerFactoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatures **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}
 
Example 18
Source File: TransformerFactoryImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatures **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}
 
Example 19
Source File: TransformerFactoryImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i =0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (_featureManager != null) ?
            _featureManager.getValueAsString(name) : null;
    if (propertyValue != null) {
        return Boolean.parseBoolean(propertyValue);
    }

    // Feature not supported
    return false;
}
 
Example 20
Source File: TransformerFactoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * javax.xml.transform.sax.TransformerFactory implementation.
 * Look up the value of a feature (to see if it is supported).
 * This method must be updated as the various methods and features of this
 * class are implemented.
 *
 * @param name The feature name
 * @return 'true' if feature is supported, 'false' if not
 */
@Override
public boolean getFeature(String name) {
    // All supported features should be listed here
    String[] features = {
        DOMSource.FEATURE,
        DOMResult.FEATURE,
        SAXSource.FEATURE,
        SAXResult.FEATURE,
        StAXSource.FEATURE,
        StAXResult.FEATURE,
        StreamSource.FEATURE,
        StreamResult.FEATURE,
        SAXTransformerFactory.FEATURE,
        SAXTransformerFactory.FEATURE_XMLFILTER,
        XalanConstants.ORACLE_FEATURE_SERVICE_MECHANISM
    };

    // feature name cannot be null
    if (name == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
        throw new NullPointerException(err.toString());
    }

    // Inefficient, but array is small
    for (int i = 0; i < features.length; i++) {
        if (name.equals(features[i])) {
            return true;
        }
    }
    // secure processing?
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
            return !_isNotSecureProcessing;
    }

    /** Check to see if the property is managed by the JdkXmlFeatures **/
    int index = _xmlFeatures.getIndex(name);
    if (index > -1) {
        return _xmlFeatures.getFeature(index);
    }

    // Feature not supported
    return false;
}