Issue Details (XML | Word | Printable)

Key: XALANJ-2312
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Brian Minchau
Reporter: Thomas Mauch
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XalanJ2

Exception thrown in ErrorListener.warning() swallowed by org.apache.xml.serializer.ToXMLStream.addAttribute()

Created: 10/Aug/06 10:16 PM   Updated: 11/Dec/07 04:57 PM
Return to search
Component/s: None
Affects Version/s: 2.7
Fix Version/s: 2.7.1

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works j2312.patch1.txt 2006-10-31 03:42 AM Brian Minchau 0.9 kB
Environment: Windows XP Home, Java 1.5

Resolution Date: 31/Oct/06 03:44 AM


 Description  « Hide
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.


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Brian Minchau added a comment - 17/Oct/06 05:09 PM
Per the JIRA triage meeting on Oct 16, 2005, assigning to Brian M.

Brian Minchau added a comment - 17/Oct/06 05:11 PM
Thomas, do you have a testcase for this one? Either an XSL/XML pair would, or a stand-alone Java program would be great, otherwise one can change the code and not really know if you fixed the problem.

Thanks,
Brian Minchau

Brian Minchau added a comment - 31/Oct/06 03:42 AM
Attaching patch1 which is the fix as described by the issue creator.

Brian Minchau added a comment - 31/Oct/06 03:44 AM
Thomas Mauch described the problem and its fix well enough. I approve
the fix, and applied the patch.

Brian Minchau added a comment - 11/Dec/07 04:57 PM
Would the originator of this issue please verify that this issue is fixed in the 2.7.1 release, by adding a comment to this issue, so that we can close this issue.

A lack of response by February 1, 2008 will be taken as consent that we can close this resolved issue.

Regards,
Brian Minchau