类org.w3c.dom.ls.LSException源码实例Demo

下面列出了怎么用org.w3c.dom.ls.LSException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk1.8-source-analysis   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码2 项目: TencentKona-8   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码3 项目: jdk8u60   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码4 项目: JDKSourceCode1.8   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码5 项目: openjdk-jdk8u   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码7 项目: hottub   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码8 项目: openjdk-8-source   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码9 项目: openjdk-8   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码10 项目: j2objc   文件: LSSerializerImpl.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
private static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
源代码11 项目: juddi   文件: MappingApiToModel.java
private static String serializeTransformElement(Element xformEl) throws DOMException, LSException {
                Document document = xformEl.getOwnerDocument();
                DOMImplementationLS domImplLS = (DOMImplementationLS) document.getImplementation();
                LSSerializer serializer = domImplLS.createLSSerializer();
//        serializer.getDomConfig().setParameter("namespaces", true);
//        serializer.getDomConfig().setParameter("namespace-declarations", true);
                serializer.getDomConfig().setParameter("canonical-form", false);
                serializer.getDomConfig().setParameter("xml-declaration", false);
                String str = serializer.writeToString(xformEl);
                return str;
        }
 
源代码12 项目: jdk1.8-source-analysis   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码13 项目: jdk1.8-source-analysis   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码14 项目: TencentKona-8   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码15 项目: TencentKona-8   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码16 项目: jdk8u60   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码17 项目: jdk8u60   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码18 项目: JDKSourceCode1.8   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码19 项目: JDKSourceCode1.8   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码20 项目: openjdk-jdk8u   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码21 项目: openjdk-jdk8u   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码22 项目: openjdk-jdk8u-backup   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码24 项目: Bytecoder   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null, false);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码25 项目: Bytecoder   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码26 项目: Bytecoder   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null) lse.initCause(cause);
    return lse;
}
 
源代码27 项目: openjdk-jdk9   文件: DOMParserImpl.java
/**
 * Parse an XML document from a location identified by an URI reference.
 * If the URI contains a fragment identifier (see section 4.1 in ), the
 * behavior is not defined by this specification.
 *
 */
public Document parseURI (String uri) throws LSException {

    //If DOMParser insstance is already busy parsing another document when this
    // method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    XMLInputSource source = new XMLInputSource (null, uri, null, false);
    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (source);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e){
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
                DOMErrorImpl error = new DOMErrorImpl ();
                error.fException = e;
                error.fMessage = e.getMessage ();
                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                fErrorHandler.getErrorHandler ().handleError (error);
            }
            if (DEBUG) {
                e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码28 项目: openjdk-jdk9   文件: DOMParserImpl.java
/**
 * Parse an XML document from a resource identified by an
 * <code>LSInput</code>.
 *
 */
public Document parse (LSInput is) throws LSException {

    // need to wrap the LSInput with an XMLInputSource
    XMLInputSource xmlInputSource = dom2xmlInputSource (is);
    if ( fBusy ) {
        String msg = DOMMessageFormatter.formatMessage (
        DOMMessageFormatter.DOM_DOMAIN,
        "INVALID_STATE_ERR",null);
        throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
    }

    try {
        currentThread = Thread.currentThread();
                    fBusy = true;
        parse (xmlInputSource);
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            //reset interrupt state
            abortNow = false;
            Thread.interrupted();
        }
    } catch (Exception e) {
        fBusy = false;
        if (abortNow && currentThread.isInterrupted()) {
            Thread.interrupted();
        }
        if (abortNow) {
            abortNow = false;
            restoreHandlers();
            return null;
        }
        // Consume this exception if the user
        // issued an interrupt or an abort.
        if (e != Abort.INSTANCE) {
            if (!(e instanceof XMLParseException) && fErrorHandler != null) {
               DOMErrorImpl error = new DOMErrorImpl ();
               error.fException = e;
               error.fMessage = e.getMessage ();
               error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
               fErrorHandler.getErrorHandler().handleError (error);
            }
            if (DEBUG) {
               e.printStackTrace ();
            }
            throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
        }
    }
    Document doc = getDocument();
    dropDocumentReferences();
    return doc;
}
 
源代码29 项目: openjdk-jdk9   文件: DOMUtil.java
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null) lse.initCause(cause);
    return lse;
}
 
源代码30 项目: openjdk-jdk9   文件: LSSerializerTest.java
@Test
public void testDOMErrorHandler() {

    final String XML_DOCUMENT = "<?xml version=\"1.0\"?>" + "<hello>" + "world" + "</hello>";

    StringReader stringReader = new StringReader(XML_DOCUMENT);
    InputSource inputSource = new InputSource(stringReader);
    Document doc = null;
    try {
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        // LSSerializer defaults to Namespace processing
        // so parsing must also
        documentBuilderFactory.setNamespaceAware(true);
        DocumentBuilder parser = documentBuilderFactory.newDocumentBuilder();
        doc = parser.parse(inputSource);

    } catch (Throwable e) {
        e.printStackTrace();
        Assert.fail(e.toString());
    }

    DOMImplementation impl = doc.getImplementation();
    DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
    LSSerializer writer = implLS.createLSSerializer();

    System.out.println("Serializer is: " + implLS.getClass().getName() + " " + implLS);

    DOMErrorHandlerImpl eh = new DOMErrorHandlerImpl();
    writer.getDomConfig().setParameter("error-handler", eh);

    boolean serialized = false;
    try {
        serialized = writer.write(doc, new Output());

        // unexpected success
        Assert.fail("Serialized without raising an LSException due to " + "'no-output-specified'.");
    } catch (LSException lsException) {
        // expected exception
        System.out.println("Expected LSException: " + lsException.toString());
        // continue processing
    }

    Assert.assertFalse(serialized, "Expected writer.write(doc, new Output()) == false");

    Assert.assertTrue(eh.NoOutputSpecifiedErrorReceived, "'no-output-specified' error was expected");
}
 
 类所在包
 类方法
 同包方法