Example usage for org.xml.sax SAXException getException

List of usage examples for org.xml.sax SAXException getException

Introduction

In this page you can find the example usage for org.xml.sax SAXException getException.

Prototype

public Exception getException() 

Source Link

Document

Return the embedded exception, if any.

Usage

From source file:org.xulux.dataprovider.DictionaryHandler.java

/**
 * Read the dictionary from an inputstream
 * @param stream the stream with the dictionary xml
 *//*  w  ww . j  a  v a  2s .com*/
public void read(InputStream stream) {
    SAXParser saxParser = null;
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(false);
    try {
        saxParser = factory.newSAXParser();
        try {
            saxParser.parse(stream, this);
        } catch (SAXException se) {
            se.printStackTrace(System.err);
            se.getException().printStackTrace(System.err);
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
    }
    // and clean up..
    saxParser = null;
    factory = null;
}

From source file:org.xulux.guidriver.XuluxGuiDriver.java

/**
 * Start processing the xml/* www . j  ava2  s .c  o m*/
 * @param stream the stream containing the xml
 */
public void read(InputStream stream) {
    if (factory == null) {
        factory = SAXParserFactory.newInstance();
        factory.setValidating(false);
    }
    try {
        SAXParser saxParser = factory.newSAXParser();
        try {
            saxParser.parse(stream, this);
            stream.close();
        } catch (SAXException se) {
            if (log.isFatalEnabled()) {
                log.fatal("Exception during parsing of part xml", se);
                log.fatal("Exception during parsing of part xml", se.getException());
            }
        } finally {
            // and clean up..
            saxParser = null;
        }
    } catch (Exception e) {
        if (log.isFatalEnabled()) {
            log.fatal("Exception during parsing of part xml", e);
        }
    }
}