You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Robin Green <gr...@hotmail.com> on 2000/11/07 19:21:48 UTC

SAX bugfix for displaying detailed XML parsing errors

Due to a bug in org.xml.sax.SAXException.toString(), and the fact that 
java.lang.Throwable.printStackTrace() calls toString in at least some JVMs, 
detail messages can be lost.

The following patch fixes the bug. Users of SAX parsers such as Xerces can 
use it by simply adding the attached sax-bugfix.jar to their CLASSPATH, 
before the jar of the parser.

    /**
     * Override toString to pick up any embedded exception.
     *
     * @return A string representation of this exception.
     */
    public String toString ()
    {
        if (exception != null) {
            return super.toString () + " (nested exception: " + 
exception.toString() + " )";
        } else {
            return super.toString();
        }
    }



_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.