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

Remote exception duplicates information in printStackTrace()

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.4.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: skT45625 Date: 07/20/2000


      src_stage:/weblogic/dev/src_stage/tools/weblogic/qa/tests> java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Server VM (build 2.0fcs-E, mixed mode)

      This isn't a serious bug, but it is ugly. When you do a printStackTrace on a
      RemoteException which contains a non-null detail field (a nested exception) the
      toString() of the detail is printed twice.

      RemoteException: ; nested exception is:
           java.io.IOException: Some message here
      java.io.IOException: Some message here
      Stacktrace here.

      The problem lies in the combination getMessage() and printStackTrace() methods
      RemoteException and the toString(), getLocalizedMessage() and printStackTrace()
      methods of Throwable. Secifically:

      RemoteException.printStackTrace() does a println(this) which results in
      this.toString() being called.

        Throwable.toString() does a this.getLocalizedMessage(), which in turn does
        a this.getMessage().

          RemoteException.getMessage() calls detail.toString().

            Throwable.toString() goes through the above process again.

          getMessage() returns
       
        toString() returns

      RemoteException.printStackTrace() calls printStackTrace on the detail.

        Throwable.printStackTrace() does a println(this) which causes this.toString()
        to be called. At this point detail.toString() has been printed twice.
      (Review ID: 107196)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              peterjones Peter Jones
              Reporter:
              skondamasunw Suresh Kondamareddy (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: