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

SAXException.toString() implementation considered harmful

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 6u14
    • xml
    • h1180
    • generic
    • generic

      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.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: