System.err still used to report errors even if a custom ErrorListener has been 
registered for the TransformerFactory
--------------------------------------------------------------------------------------------------------------------

         Key: XALANJ-2233
         URL: http://issues.apache.org/jira/browse/XALANJ-2233
     Project: XalanJ2
        Type: Bug
    Versions: 2.7    
 Environment: I'm using Xalan 2.7.0 in my web application, which runs on a 
Tomcat 5.5 server.
    Reporter: Roger E.


Following the instructions of the new 2.7.0 version of Xalan, I've defined my 
custom ErrorListener for my TransformerFactory. My listener implements the 
javax.xml.transform.ErrorListener, and works ok. However, the errors are still 
being printed to System.err. In fact, as I'm using Xalan in a web application, 
those errors are printed on the Tomcat log file.

Here I paste part of my servlet code, just in case it helps:

--------------------------------------------
res.setContentType("text/html; charset=UTF-8");
PrintWriter out=res.getWriter();
TransformerFactory tFactory=new 
org.apache.xalan.processor.TransformerFactoryImpl();
tFactory.setErrorListener(new myErrorListener());
Transformer t=tFactory.newTransformer(new StreamSource("mySheet.xsl"));
t.transform(new DocumentSource("the xml goes here"),new StreamResult(out));
out.close();
--------------------------------------------

Now I paste the "myErrorListener" code:

--------------------------------------------
public class myErrorListener implements javax.xml.transform.ErrorListener{
        public void warning(TransformerException e) throws TransformerException{
        }

        public void error(TransformerException e) throws TransformerException{
                throw e;
        }

        public void fatalError(TransformerException e) throws 
TransformerException{
                throw e;
                     }
}
--------------------------------------------

If I introduce an error in the XSL file, the error listener receives the 
exceptions, but the error log file of my Tomcat server still shows lines like 
the following:

[Fatal Error] index.xsl:16:1: The end-tag for element type "div" must end with 
a '>' delimiter.

I suppose there is a bug somewhere, as the ErrorListener should avoid those 
errors to be printed to System.err

Thank you very much!

Roger.

-- 
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]

Reply via email to