Package org.dellroad.stuff.xml
Class TransformErrorListener
java.lang.Object
org.dellroad.stuff.xml.TransformErrorListener
- All Implemented Interfaces:
ErrorListener
ErrorListener implementation that logs the messages 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">
In addition, by overriding isIgnorable() subclasses can ignore chosen issues.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidprotected Stringprotected booleanDetermine if this listener should completely ignore the given exception.protected voidvoid
-
Field Details
-
log
-
xalanWorkarounds
protected final boolean xalanWorkarounds
-
-
Constructor Details
-
TransformErrorListener
-
-
Method Details
-
warning
- Specified by:
warningin interfaceErrorListener- Throws:
TransformerException
-
error
- Specified by:
errorin interfaceErrorListener- Throws:
TransformerException
-
fatalError
- Specified by:
fatalErrorin interfaceErrorListener- Throws:
TransformerException
-
getLogMessageFor
-
rethrow
- Throws:
TransformerException
-
isIgnorable
Determine if this listener should completely ignore the given exception.The implementation in
TransformErrorListeneralways returns false.- Parameters:
e- exception- Returns:
- true to ignore the exception, false to handle normally
-