Search in sources :

Example 21 with FactoryConfigurationError

use of javax.xml.parsers.FactoryConfigurationError in project robovm by robovm.

the class FactoryConfigurationErrorTest method test_Constructor.

public void test_Constructor() {
    FactoryConfigurationError fce = new FactoryConfigurationError();
    assertNull(fce.getMessage());
    assertNull(fce.getLocalizedMessage());
    assertNull(fce.getCause());
}
Also used : FactoryConfigurationError(javax.xml.parsers.FactoryConfigurationError)

Example 22 with FactoryConfigurationError

use of javax.xml.parsers.FactoryConfigurationError in project robovm by robovm.

the class FactoryConfigurationErrorTest method test_ConstructorLjava_lang_ExceptionLjava_lang_String.

public void test_ConstructorLjava_lang_ExceptionLjava_lang_String() {
    Exception e = new Exception();
    // case 1: Try to create FactoryConfigurationError
    // which is based on Exception without parameters.
    FactoryConfigurationError fce = new FactoryConfigurationError(e, "msg");
    assertNotNull(fce.getMessage());
    assertNotNull(fce.getLocalizedMessage());
    assertEquals(e.getCause(), fce.getCause());
    // case 2: Try to create FactoryConfigurationError
    // which is based on Exception with String parameter.
    e = new Exception("test message");
    fce = new FactoryConfigurationError(e, "msg");
    assertEquals("msg", fce.getMessage());
    assertEquals("msg", fce.getLocalizedMessage());
    assertEquals(e.getCause(), fce.getCause());
}
Also used : FactoryConfigurationError(javax.xml.parsers.FactoryConfigurationError)

Example 23 with FactoryConfigurationError

use of javax.xml.parsers.FactoryConfigurationError in project spring-security by spring-projects.

the class WebXmlMappableAttributesRetriever method getDocument.

/**
	 * @return Document for the specified InputStream
	 */
private Document getDocument(InputStream aStream) {
    Document doc;
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setValidating(false);
        DocumentBuilder db = factory.newDocumentBuilder();
        db.setEntityResolver(new MyEntityResolver());
        doc = db.parse(aStream);
        return doc;
    } catch (FactoryConfigurationError e) {
        throw new RuntimeException("Unable to parse document object", e);
    } catch (ParserConfigurationException e) {
        throw new RuntimeException("Unable to parse document object", e);
    } catch (SAXException e) {
        throw new RuntimeException("Unable to parse document object", e);
    } catch (IOException e) {
        throw new RuntimeException("Unable to parse document object", e);
    } finally {
        try {
            aStream.close();
        } catch (IOException e) {
            logger.warn("Failed to close input stream for web.xml", e);
        }
    }
}
Also used : DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) IOException(java.io.IOException) Document(org.w3c.dom.Document) FactoryConfigurationError(javax.xml.parsers.FactoryConfigurationError) SAXException(org.xml.sax.SAXException)

Aggregations

FactoryConfigurationError (javax.xml.parsers.FactoryConfigurationError)23 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)8 SAXException (org.xml.sax.SAXException)8 IOException (java.io.IOException)4 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 Properties (java.util.Properties)3 Document (org.w3c.dom.Document)3 Constructor (java.lang.reflect.Constructor)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Hashtable (java.util.Hashtable)2 SAXParserFactory (javax.xml.parsers.SAXParserFactory)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 TransformerFactoryConfigurationError (javax.xml.transform.TransformerFactoryConfigurationError)2 Element (org.w3c.dom.Element)2 InputSource (org.xml.sax.InputSource)2 SAXParseException (org.xml.sax.SAXParseException)2 XMLReader (org.xml.sax.XMLReader)2 ImmutableBiMap (com.google.common.collect.ImmutableBiMap)1 ImmutableMap (com.google.common.collect.ImmutableMap)1