Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6889649

SAXException.toString() implementation considered harmful

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 6u14
    • Fix Version/s: 1.4.0
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      h1180
    • CPU:
      generic
    • OS:
      generic

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joehw Joe Wang
                Reporter:
                kkawagucsunw Kohsuke Kawaguchi (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: