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
RuntimeException
s 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
protected String
protected boolean
Determine if this listener should completely ignore the given exception.protected void
void
-
Field Details
-
log
-
xalanWorkarounds
protected final boolean xalanWorkarounds
-
-
Constructor Details
-
TransformErrorListener
-
-
Method Details
-
warning
- Specified by:
warning
in interfaceErrorListener
- Throws:
TransformerException
-
error
- Specified by:
error
in interfaceErrorListener
- Throws:
TransformerException
-
fatalError
- Specified by:
fatalError
in interfaceErrorListener
- Throws:
TransformerException
-
getLogMessageFor
-
rethrow
- Throws:
TransformerException
-
isIgnorable
Determine if this listener should completely ignore the given exception.The implementation in
TransformErrorListener
always returns false.- Parameters:
e
- exception- Returns:
- true to ignore the exception, false to handle normally
-