Java Code Examples for org.xml.sax.SAXNotRecognizedException

The following examples show how to use org.xml.sax.SAXNotRecognizedException. These examples are extracted from open source projects. 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
public Object getProperty(String name)
throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) {
        return getLexicalHandler();
    } else if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) {
        return getDeclHandler();
    } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) {
        return getExternalVocabularies();
    } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) {
        return getRegisteredEncodingAlgorithms();
    } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) {
        return getEncodingAlgorithmContentHandler();
    } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) {
        return getPrimitiveTypeContentHandler();
    } else {
        throw new SAXNotRecognizedException(CommonResourceBundle.getInstance().
                getString("message.propertyNotRecognized", new Object[]{name}));
    }
}
 
Example 2
public boolean getFeature(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return (fSecurityManager != null && fSecurityManager.isSecureProcessing());
    }
    try {
        return fXMLSchemaLoader.getFeature(name);
    }
    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 3
Source Project: TencentKona-8   Source File: DOMParser.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void setProperty0(String propertyId, Object value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    try {
        fConfiguration.setProperty(propertyId, value);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "property-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "property-not-supported", new Object [] {identifier}));
        }
    }

}
 
Example 4
Source Project: openemm   Source File: HtmlUtils.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Parse an entire HTML document or a document fragment. Use lowercase translation for names of tags and attributes.
 * @param document a HTML code to parse.
 * @param encoding an encoding to use for a parser.
 * @return a parsed document representation.
 */
public static Document parseDocument(String document, String encoding) throws IOException, SAXException {
    DOMParser parser = new DOMParser(new HTMLConfiguration());

    try {
        // These URLs are predefined parameters' names (check org.cyberneko.html.HTMLConfiguration for more information)
        parser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower");
        parser.setProperty("http://cyberneko.org/html/properties/default-encoding", encoding);
    } catch (SAXNotRecognizedException | SAXNotSupportedException e) {
        logger.error("Unexpected parser configuration error occurred: " + e.getMessage());
        throw new RuntimeException(e);
    }

    StringReader reader = new StringReader(document);
    InputSource source = new InputSource(reader);
    parser.parse(source);

    return parser.getDocument();
}
 
Example 5
Source Project: jdk1.8-source-analysis   Source File: ValidatorImpl.java    License: Apache License 2.0 6 votes vote down vote up
public boolean getFeature(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException();
    }
    try {
        return fComponentManager.getFeature(name);
    }
    catch (XMLConfigurationException e) {
        final String identifier = e.getIdentifier();
        final String key = e.getType() == Status.NOT_RECOGNIZED ?
                "feature-not-recognized" : "feature-not-supported";
        throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fComponentManager.getLocale(),
                key, new Object [] {identifier}));
    }
}
 
Example 6
Source Project: jdk1.8-source-analysis   Source File: ValidatorImpl.java    License: Apache License 2.0 6 votes vote down vote up
public Object getProperty(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException();
    }
    //Support current-element-node; return current node if DOMSource is used.
    if (CURRENT_ELEMENT_NODE.equals(name)) {
        return (fDOMValidatorHelper != null) ? fDOMValidatorHelper.getCurrentElement() : null;
    }
    try {
        return fComponentManager.getProperty(name);
    }
    catch (XMLConfigurationException e) {
        final String identifier = e.getIdentifier();
        final String key = e.getType() == Status.NOT_RECOGNIZED ?
                "property-not-recognized" : "property-not-supported";
        throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fComponentManager.getLocale(),
                key, new Object [] {identifier}));
    }
}
 
Example 7
Source Project: jdk1.8-source-analysis   Source File: XMLSchemaFactory.java    License: Apache License 2.0 6 votes vote down vote up
public boolean getFeature(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "FeatureNameNull", null));
    }
    if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
        return (fSecurityManager != null && fSecurityManager.isSecureProcessing());
    }
    try {
        return fXMLSchemaLoader.getFeature(name);
    }
    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 8
public void setFeature(String name, boolean value)
        throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Features.NAMESPACES_FEATURE)) {
        if (!value) {
            throw new SAXNotSupportedException(name + ":" + value);
        }
    } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) {
        _namespacePrefixesFeature = value;
    } else if (name.equals(Features.EXTERNAL_GENERAL_ENTITIES)) {
        // ignore
    } else if (name.equals(Features.EXTERNAL_PARAMETER_ENTITIES)) {
        // ignore
    } else if (name.equals(Features.STRING_INTERNING_FEATURE)) {
        if (value != _stringInterningFeature) {
            throw new SAXNotSupportedException(name + ":" + value);
        }
    } else {
        throw new SAXNotRecognizedException(
                "Feature not supported: " + name);
    }
}
 
Example 9
public void setFeature(String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Features.NAMESPACES_FEATURE)) {
        if (value == false) {
            throw new SAXNotSupportedException(name + ":" + value);
        }
    } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) {
        _namespacePrefixesFeature = value;
    } else if (name.equals(Features.STRING_INTERNING_FEATURE) ||
            name.equals(FastInfosetReader.STRING_INTERNING_PROPERTY)) {
        setStringInterning(value);
    } else {
        throw new SAXNotRecognizedException(
                CommonResourceBundle.getInstance().getString("message.featureNotSupported") + name);
    }
}
 
Example 10
public boolean getFeature(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException();
    }
    try {
        return fComponentManager.getFeature(name);
    }
    catch (XMLConfigurationException e) {
        final String identifier = e.getIdentifier();
        final String key = e.getType() == Status.NOT_RECOGNIZED ?
                "feature-not-recognized" : "feature-not-supported";
        throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fComponentManager.getLocale(),
                key, new Object [] {identifier}));
    }
}
 
Example 11
Source Project: jdk1.8-source-analysis   Source File: SAXParserImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void setSchemaValidatorProperty(String name, Object value)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    try {
        fSAXParser.fSchemaValidator.setProperty(name, value);
    }
    // This should never be thrown from the schema validator.
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "property-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "property-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 12
Source Project: TencentKona-8   Source File: ValidatorImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public boolean getFeature(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException();
    }
    try {
        return fComponentManager.getFeature(name);
    }
    catch (XMLConfigurationException e) {
        final String identifier = e.getIdentifier();
        final String key = e.getType() == Status.NOT_RECOGNIZED ?
                "feature-not-recognized" : "feature-not-supported";
        throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fComponentManager.getLocale(),
                key, new Object [] {identifier}));
    }
}
 
Example 13
public boolean getFeature(String name)
        throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Features.NAMESPACES_FEATURE)) {
        return true;
    } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) {
        return _namespacePrefixesFeature;
    } else if (name.equals(Features.EXTERNAL_GENERAL_ENTITIES)) {
        return true;
    } else if (name.equals(Features.EXTERNAL_PARAMETER_ENTITIES)) {
        return true;
    } else if (name.equals(Features.STRING_INTERNING_FEATURE)) {
        return _stringInterningFeature;
    } else {
        throw new SAXNotRecognizedException(
                "Feature not supported: " + name);
    }
}
 
Example 14
Source Project: java-technology-stack   Source File: AbstractStaxXMLReader.java    License: MIT License 6 votes vote down vote up
@Override
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
	if (NAMESPACES_FEATURE_NAME.equals(name)) {
		return this.namespacesFeature;
	}
	else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) {
		return this.namespacePrefixesFeature;
	}
	else if (IS_STANDALONE_FEATURE_NAME.equals(name)) {
		if (this.isStandalone != null) {
			return this.isStandalone;
		}
		else {
			throw new SAXNotSupportedException("startDocument() callback not completed yet");
		}
	}
	else {
		return super.getFeature(name);
	}
}
 
Example 15
Source Project: TencentKona-8   Source File: SAXParserImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
public synchronized Object getProperty(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        // TODO: Add localized error message.
        throw new NullPointerException();
    }
    if (fSAXParser != null && JAXP_SCHEMA_LANGUAGE.equals(name)) {
        // JAXP 1.2 support
        return fSAXParser.schemaLanguage;
    }

    /** Check to see if the property is managed by the security manager **/
    String propertyValue = (fSecurityManager != null) ?
            fSecurityManager.getLimitAsString(name) : null;
    if (propertyValue != null) {
        return propertyValue;
    } else {
        propertyValue = (fSecurityPropertyMgr != null) ?
            fSecurityPropertyMgr.getValue(name) : null;
        if (propertyValue != null) {
            return propertyValue;
        }
    }

    return super.getProperty(name);
}
 
Example 16
public void setProperty(String name, Object object)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException();
    }
    try {
        fComponentManager.setProperty(name, object);
    }
    catch (XMLConfigurationException e) {
        final String identifier = e.getIdentifier();
        final String key = e.getType() == Status.NOT_RECOGNIZED ?
                "property-not-recognized" : "property-not-supported";
        throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fComponentManager.getLocale(),
                key, new Object [] {identifier}));
    }
}
 
Example 17
private void setFeatures( Map<String, Boolean> features)
    throws SAXNotSupportedException, SAXNotRecognizedException {
    if (features != null) {
        for (Map.Entry<String, Boolean> entry : features.entrySet()) {
            domParser.setFeature(entry.getKey(), entry.getValue());
    }
}
}
 
Example 18
Source Project: spring-analysis-note   Source File: AbstractXMLReader.java    License: MIT License 5 votes vote down vote up
/**
 * This implementation throws a {@code SAXNotRecognizedException} exception
 * for any feature outside of the "http://xml.org/sax/features/" namespace
 * and accepts a {@code false} value for any feature within.
 */
@Override
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
	if (name.startsWith("http://xml.org/sax/features/")) {
		if (value) {
			throw new SAXNotSupportedException(name);
		}
	}
	else {
		throw new SAXNotRecognizedException(name);
	}
}
 
Example 19
Source Project: spring-analysis-note   Source File: AbstractXMLReader.java    License: MIT License 5 votes vote down vote up
/**
 * Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical
 * handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
 */
@Override
@Nullable
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
	if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
		return this.lexicalHandler;
	}
	else {
		throw new SAXNotRecognizedException(name);
	}
}
 
Example 20
Source Project: spring-analysis-note   Source File: AbstractXMLReader.java    License: MIT License 5 votes vote down vote up
/**
 * Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical
 * handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}.
 */
@Override
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
	if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
		this.lexicalHandler = (LexicalHandler) value;
	}
	else {
		throw new SAXNotRecognizedException(name);
	}
}
 
Example 21
Source Project: spring-analysis-note   Source File: AbstractStaxXMLReader.java    License: MIT License 5 votes vote down vote up
@Override
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
	if (NAMESPACES_FEATURE_NAME.equals(name)) {
		this.namespacesFeature = value;
	}
	else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) {
		this.namespacePrefixesFeature = value;
	}
	else {
		super.setFeature(name, value);
	}
}
 
Example 22
Source Project: TencentKona-8   Source File: SAXParserImpl.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set any features of our XMLReader based on any features set on the
 * SAXParserFactory.
 *
 * XXX Does not handle possible conflicts between SAX feature names and
 * JAXP specific feature names, eg. SAXParserFactory.isValidating()
 */
private void setFeatures(Map<String, Boolean> features)
    throws SAXNotSupportedException, SAXNotRecognizedException {
    if (features != null) {
        for (Map.Entry<String, Boolean> entry : features.entrySet()) {
            xmlReader.setFeature0(entry.getKey(), entry.getValue());
        }
    }
}
 
Example 23
Source Project: java-technology-stack   Source File: MarshallingSource.java    License: MIT License 5 votes vote down vote up
@Override
@Nullable
public Object getProperty(String name) throws SAXNotRecognizedException {
	if ("http://xml.org/sax/properties/lexical-handler".equals(name)) {
		return this.lexicalHandler;
	}
	else {
		throw new SAXNotRecognizedException(name);
	}
}
 
Example 24
public void setProperty(String name, Object value)
        throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) {
        if (value instanceof LexicalHandler) {
            setLexicalHandler((LexicalHandler)value);
        } else {
            throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY);
        }
    } else {
        throw new SAXNotRecognizedException("Property not recognized: " + name);
    }
}
 
Example 25
Source Project: TencentKona-8   Source File: DOMParser.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the state of any feature in a SAX2 parser.  The parser
 * might not recognize the feature, and if it does recognize
 * it, it might not be able to fulfill the request.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception SAXNotRecognizedException If the
 *            requested feature is not known.
 * @exception SAXNotSupportedException If the
 *            requested feature is known, but the requested
 *            state is not supported.
 */
public void setFeature(String featureId, boolean state)
    throws SAXNotRecognizedException, SAXNotSupportedException {

    try {

        // http://xml.org/sax/features/use-entity-resolver2
        //   controls whether the methods of an object implementing
        //   org.xml.sax.ext.EntityResolver2 will be used by the parser.
        //
        if (featureId.equals(USE_ENTITY_RESOLVER2)) {
            if (state != fUseEntityResolver2) {
                fUseEntityResolver2 = state;
                // Refresh EntityResolver wrapper.
                setEntityResolver(getEntityResolver());
            }
            return;
        }

        //
        // Default handling
        //

        fConfiguration.setFeature(featureId, state);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "feature-not-supported", new Object [] {identifier}));
        }
    }

}
 
Example 26
Source Project: jdk1.8-source-analysis   Source File: JAXBSource.java    License: Apache License 2.0 5 votes vote down vote up
public void setProperty(String name, Object value) throws SAXNotRecognizedException {
    if( "http://xml.org/sax/properties/lexical-handler".equals(name) ) {
        this.lexicalHandler = (LexicalHandler)value;
        return;
    }
    throw new SAXNotRecognizedException(name);
}
 
Example 27
Source Project: jdk1.8-source-analysis   Source File: DOMParser.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Set the state of any feature in a SAX2 parser.  The parser
 * might not recognize the feature, and if it does recognize
 * it, it might not be able to fulfill the request.
 *
 * @param featureId The unique identifier (URI) of the feature.
 * @param state The requested state of the feature (true or false).
 *
 * @exception SAXNotRecognizedException If the
 *            requested feature is not known.
 * @exception SAXNotSupportedException If the
 *            requested feature is known, but the requested
 *            state is not supported.
 */
public void setFeature(String featureId, boolean state)
    throws SAXNotRecognizedException, SAXNotSupportedException {

    try {

        // http://xml.org/sax/features/use-entity-resolver2
        //   controls whether the methods of an object implementing
        //   org.xml.sax.ext.EntityResolver2 will be used by the parser.
        //
        if (featureId.equals(USE_ENTITY_RESOLVER2)) {
            if (state != fUseEntityResolver2) {
                fUseEntityResolver2 = state;
                // Refresh EntityResolver wrapper.
                setEntityResolver(getEntityResolver());
            }
            return;
        }

        //
        // Default handling
        //

        fConfiguration.setFeature(featureId, state);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "feature-not-supported", new Object [] {identifier}));
        }
    }

}
 
Example 28
Source Project: jdk1.8-source-analysis   Source File: DOMParser.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Query the state of a feature.
 *
 * Query the current state of any feature in a SAX2 parser.  The
 * parser might not recognize the feature.
 *
 * @param featureId The unique identifier (URI) of the feature
 *                  being set.
 * @return The current state of the feature.
 * @exception org.xml.sax.SAXNotRecognizedException If the
 *            requested feature is not known.
 * @exception SAXNotSupportedException If the
 *            requested feature is known but not supported.
 */
public boolean getFeature(String featureId)
    throws SAXNotRecognizedException, SAXNotSupportedException {

    try {

        // http://xml.org/sax/features/use-entity-resolver2
        //   controls whether the methods of an object implementing
        //   org.xml.sax.ext.EntityResolver2 will be used by the parser.
        //
        if (featureId.equals(USE_ENTITY_RESOLVER2)) {
            return fUseEntityResolver2;
        }

        //
        // Default handling
        //

        return fConfiguration.getFeature(featureId);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "feature-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
                "feature-not-supported", new Object [] {identifier}));
        }
    }

}
 
Example 29
Source Project: jdk1.8-source-analysis   Source File: XMLSchemaFactory.java    License: Apache License 2.0 5 votes vote down vote up
public Object getProperty(String name)
    throws SAXNotRecognizedException, SAXNotSupportedException {
    if (name == null) {
        throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "ProperyNameNull", null));
    }
    if (name.equals(SECURITY_MANAGER)) {
        return fSecurityManager;
    }
    else if (name.equals(XMLGRAMMAR_POOL)) {
        throw new SAXNotSupportedException(
                SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                "property-not-supported", new Object [] {name}));
    }
    try {
        return fXMLSchemaLoader.getProperty(name);
    }
    catch (XMLConfigurationException e) {
        String identifier = e.getIdentifier();
        if (e.getType() == Status.NOT_RECOGNIZED) {
            throw new SAXNotRecognizedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "property-not-recognized", new Object [] {identifier}));
        }
        else {
            throw new SAXNotSupportedException(
                    SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(),
                    "property-not-supported", new Object [] {identifier}));
        }
    }
}
 
Example 30
Source Project: native-obfuscator   Source File: Bug6359330.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    System.setSecurityManager(new SecurityManager());
    try {
        SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setNamespaceAware(true);
        spf.setValidating(true);
        SAXParser sp = spf.newSAXParser();
        // The following line shouldn't throw a
        // java.security.AccessControlException.
        sp.setProperty("foo", "bar");
    } catch (SAXNotRecognizedException e) {
        // Ignore this expected exception.
    }
}