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

TTY: jdb produces malformed messages for caught exceptions on Linux and Solx86

XMLWordPrintable

    • x86
    • linux, solaris



      Name: dkR10014 Date: 12/24/2001


        The following simple test demonstrates that jdb produces malformed messages
      in stdout for caught exceptions when "catch" command is used. It looks like
      jdb prints the mesagges from different sources with overlap. The bug is observed
      on Linux and Solaris x86 only.

      ------------------ Test.java ------------------
      class Test {
          public static void main(String argv []) {
              for (int i = 0; i < 10; i++) {
                  try {
                      throw new MyException("User defined exception is thrown :" + i);
                  } catch (MyException e) {
                      System.out.println(e);
                  }
              }
          }
      }

      class MyException extends Exception {
          public MyException (String s) {
              super(s);
          }
      }
      -----------------------------------------------

      Steps to reproduce:

       1. Copy Test.java in your working directory and compile it.
       2. Launch jdb.
       3. When jdb gives the prompt, type the following jdb commands:
             catch MyException<enter>
             run Test<enter>
             
       4. Repeat "cont" command until jdb exit (10 times) when it reports
          about caught exceptions and waits for the input.
          
          
       Below is example of malformed output on Linux RedHat 6.2 ("^" symbol points at what is wrong ):

      ----------------------------------------------------------------------------------
      bash$ /export/ld24/java/hotspot/jdk1.4/linux/bin/jdb
      Initializing jdb ...
      > catch MyException
      Deferring exception catch MyException.
      It will be set after the class is loaded.
      > run Test
      run Test
      >
      VM Started: Set deferred exception catch MyException

      Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

      main[1] cont
      > MyException: User defined exception is thrown :0

      Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

          .........
          
      main[1] cont
      > MyException: User defined exception
                                           ^
                                           line is broken
                                           
      iException occurred: MyException (to be caught at: Test.main(), line=7 bci=32)s thrown :7
      ^ ^^^^^^^^^^^
      [this symbol should be in the previous line] [these symbols should be in the previous line]

      "thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

      main[1] cont
      > MyE
           ^
           [line is broken]
           
      xException occurred: MyException (to be caught at: Test.main(), line=7 bci=32)ception: User defined exception is thrown :8
      ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      [this symbol should be in the previous line] [these symbols should be in the previous line]

      "thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

      main[1] cont
      > MyException: User defined exception is thrown :9

      The application exited
      ----------------------------------------------------------------------------------
         

       Below is example of malformed output on Solaris x86 5.8 ("^" symbol points at what is wrong ):
      ----------------------------------------------------------------------------------

      kdos@novo92N36 /export/ld24/java/hotspot/jdk1.4/solx86/bin/jdb
      Initializing jdb ...
      > catch MyException
      Deferring exception catch MyException.
      It will be set after the class is loaded.
      > run Test
      run Test
      >
      VM Started: Set deferred exception catch MyException

      Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

      main[1] cont
      > MyException: User defined exception is thrown :0

      Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

      main[1] cont
      M> yException: User defined exception is thrown :1
       ^
       [the prompt symbol interrupts the line]
       
      Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

      main[1] cont
      MyExcep> tion: User defined exception is thrown :2
             ^
            [The prompt symbol interrupts the line]
             
      Exception occurred: MyException (to be caught at: Test.main(), line=7 bci=32)"thread=main", Test.main(), line=5 bci=31
      5 throw new MyException("User defined exception is thrown :" + i);

         ......
         
      main[1] cont
      MyE> xception: User defined exception is thrown :9
         ^
        [the prompt symbol interrupts the line]

      The application exited
      ----------------------------------------------------------------------------------

      This bug affects the following testbase_nsk test:

        nsk/jdb/caught_exception/caught_exception001

      ======================================================================

            Unassigned Unassigned
            kdossunw Kdos Kdos (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: