United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6889649 SAXException.toString() implementation considered harmful
JDK-6889649 : SAXException.toString() implementation considered harmful

Details
Type:
Bug
Submit Date:
2009-10-08
Status:
Resolved
Updated Date:
2012-04-25
Project Name:
JDK
Resolved Date:
2009-10-23
Component:
xml
OS:
generic
Sub-Component:
org.xml.sax
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u14
Fixed Versions:
1.4.0 (h1180)

Related Reports

Sub Tasks

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

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.
                                     
2009-10-23
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
                                     
2010-02-18



Hardware and Software, Engineered to Work Together