
|
If you were logged in you would be able to see more operations.
|
|
|
|
File Attachments:
|
|
|
Environment:
|
Windows XP Home, Java 1.5
|
|
| Resolution Date: |
31/Oct/06 03:44 AM
|
|
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.
|
|
Description
|
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.
|
Show » |
|