Search in sources :

Example 1 with DefaultErrorHandler

use of org.apache.xml.utils.DefaultErrorHandler in project intellij-community by JetBrains.

the class XalanSupport method init.

public static boolean init(Transformer transformer, LocalDebugger dbg) {
    if (transformer instanceof TransformerImpl) {
        try {
            System.out.println("XALAN: " + Class.forName("org.apache.xalan.Version", true, transformer.getClass().getClassLoader()).getMethod("getVersion").invoke(null));
            final TransformerImpl tr = (TransformerImpl) transformer;
            tr.setErrorListener(new DefaultErrorHandler(false) {

                @Override
                public void fatalError(TransformerException exception) throws TransformerException {
                    if (!(exception.getCause() instanceof DebuggerStoppedException)) {
                        super.fatalError(exception);
                    }
                }
            });
            try {
                tr.getTraceManager().addTraceListener(new XalanTraceListener(dbg, tr));
            } catch (TooManyListenersException e) {
                throw new AssertionError(e);
            }
            return true;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return false;
}
Also used : TransformerImpl(org.apache.xalan.transformer.TransformerImpl) TooManyListenersException(java.util.TooManyListenersException) DefaultErrorHandler(org.apache.xml.utils.DefaultErrorHandler) TransformerException(javax.xml.transform.TransformerException) TooManyListenersException(java.util.TooManyListenersException) TransformerException(javax.xml.transform.TransformerException) DebuggerStoppedException(org.intellij.plugins.xsltDebugger.rt.engine.DebuggerStoppedException) DebuggerStoppedException(org.intellij.plugins.xsltDebugger.rt.engine.DebuggerStoppedException)

Aggregations

TooManyListenersException (java.util.TooManyListenersException)1 TransformerException (javax.xml.transform.TransformerException)1 TransformerImpl (org.apache.xalan.transformer.TransformerImpl)1 DefaultErrorHandler (org.apache.xml.utils.DefaultErrorHandler)1 DebuggerStoppedException (org.intellij.plugins.xsltDebugger.rt.engine.DebuggerStoppedException)1