JDK-6889649 : SAXException.toString() implementation considered harmful
  • Type: Bug
  • Component: xml
  • Sub-Component: org.xml.sax
  • Affected Version: 6u14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-10-08
  • Updated: 2014-05-05
  • Resolved: 2009-10-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 h1180Fixed
Related Reports
Duplicate :  
Description
SAXException.toString() in JDK6 is implemented as follows:

    public String toString ()
    {
	if (exception != null) {
	    return exception.toString();
	} else {
	    return super.toString();
	}
    }

while this made sense back in the days when there was no notion of exception chaining, in modern Java, this only has the negative effect of not showing the real message associated with the exception. The toString method should be removed, as the super class already implements a desired behavior.

This change doesn't affect the signature of the classes, so I don't think the spec revision is necessary for this change.

Comments
EVALUATION ChangeSet=http://hg.openjdk.java.net/jdk6/jdk6/jaxp/rev/5c070921580c,ChangeRequest=6923146,ChangeRequest=6917454,ChangeRequest=6472982,ChangeRequest=6909759,ChangeRequest=6333993,ChangeRequest=6900779,ChangeRequest=6900773,ChangeRequest=6900249,ChangeRequest=6675332,ChangeRequest=6889654,ChangeRequest=6889649,ChangeRequest=6863312
18-02-2010

EVALUATION The toString method can not be removed since it's used to return the message carried in an 'exception' which may be passed in through the constructors. The additional message however, is added to the returned string.
23-10-2009