Exception thrown in ErrorListener.warning() swallowed by
org.apache.xml.serializer.ToXMLStream.addAttribute()
-------------------------------------------------------------------------------------------------------------
Key: XALANJ-2312
URL: http://issues.apache.org/jira/browse/XALANJ-2312
Project: XalanJ2
Issue Type: Bug
Affects Versions: 2.7
Environment: Windows XP Home, Java 1.5
Reporter: Thomas Mauch
Priority: Minor
To prevent the processing of erroneous XSLT stylesheets, I wanted to add a
ErrorListener which throws an error even if the warning function is called. As
the warning function does not allow throwing a TransformerException, it wrap it
in a RuntimeException:
static class XMLErrorListener implements ErrorListener {
public void warning(TransformerException exception) {
throw new RuntimeException(exception);
}
I however noticed that I got fewer errors than were logged before. I found out
that the function org.apache.xml.serializer.ToXMLStream.addAttribute() contains
a catch (Exception e) {} clause which swallows all exception thrown. Swallowing
all exceptions is IMHO considered bad style. I see no reason why I should not
be able to decide that I want to treat even warnings as errors and stop
processing immediately.
Other XSLT warnings do not swallow a thrown exception and therefore allow me to
stop the processing.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]