org.dellroad.stuff.xml
Class TransformErrorListener
java.lang.Object
org.dellroad.stuff.xml.TransformErrorListener
- All Implemented Interfaces:
- ErrorListener
public class TransformErrorListener
- extends Object
- implements ErrorListener
ErrorListener implementation that logs the messgaes to a configured Logger
and throws exceptions in cases of errors and fatal errors.
This class also optionally works around some stupid Xalan-J bugs:
- Throw exceptions in the case of
warning(javax.xml.transform.TransformerException) also; this is required because Xalan-J
reports even <message terminate="yes"> messages as warnings
- When throwing exceptions, wrap them in
RuntimeExceptions to avoid being swallowed;
otherwise Xalan-J will not terminate on a <message terminate="yes">
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected final Logger log
xalanWorkarounds
protected final boolean xalanWorkarounds
TransformErrorListener
public TransformErrorListener(Logger log,
boolean xalanWorkarounds)
warning
public void warning(TransformerException e)
throws TransformerException
- Specified by:
warning in interface ErrorListener
- Throws:
TransformerException
error
public void error(TransformerException e)
throws TransformerException
- Specified by:
error in interface ErrorListener
- Throws:
TransformerException
fatalError
public void fatalError(TransformerException e)
throws TransformerException
- Specified by:
fatalError in interface ErrorListener
- Throws:
TransformerException
getLogMessageFor
protected String getLogMessageFor(TransformerException e)
rethrow
protected void rethrow(TransformerException e)
throws TransformerException
- Throws:
TransformerException