You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Brian Minchau (JIRA)" <xa...@xml.apache.org> on 2006/10/31 04:45:18 UTC

[jira] Resolved: (XALANJ-2312) Exception thrown in ErrorListener.warning() swallowed by org.apache.xml.serializer.ToXMLStream.addAttribute()

     [ http://issues.apache.org/jira/browse/XALANJ-2312?page=all ]

Brian Minchau resolved XALANJ-2312.
-----------------------------------

    Fix Version/s: Latest Development Code
       Resolution: Fixed

Thomas Mauch described the problem and its fix well enough. I approve
the fix, and applied the patch.

> 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
>         Assigned To: Brian Minchau
>            Priority: Minor
>             Fix For: Latest Development Code
>
>         Attachments: j2312.patch1.txt
>
>
> 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: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org