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

fp.bugs 4036 jdb: RemoteArray.getElementType() return -1, TC_ARRAY is expected

    Details

    • Subcomponent:
    • Resolved In Build:
      1.0.2
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description

      The attached file can be found in ~hagen/test/newsbugs/4036/TTY.ZIP since hagen@mile[157]: cd /net/elmer/export/bugtraq/etc/attached
      /net/elmer/export/bugtraq/etc/attached: Permission denied
      -Jim

      From: Jean-Paul Buu-Sao <###@###.###>
      This does not look like form output to me.


      1. OS
      WinNT 3.51

      2. VERSION
      JDK 1.0

      3. DESCRIPTION
      Type for RemoteArray.getElementType() return -1 when the dimension
      of the array is > 1. TC_ARRAY is expected instead.

      4. STEPS TO REPRODUCE

      Using the attached, modified JDB, which adds a "this" command to show
      member data on the "this" object, and given test11.java:

          public class test11
          {
            String names1[] = new String[2];
            String names2[][] = new String[2][4];
        
            test11()
            {
              for( int i = 0; i < 2; i++ )
              {
                names1[i] = Integer.toString(i);
                for( int j = 0; j < 4; j++ )
                  names2[i][j] = Integer.toString(i)+Integer.toString(j);
              }
              System.out.println( names1 );
              System.out.println( names2 );
            }
            public static void main( String args[] )
            {
              test11 t = new test11();
            }
          }

      Session log:

      jdb test11
      Initializing jdb...
      0x1045530:class(test11)
      > stop at test11:14
      Breakpoint set at test11:14
      > run
      run test11
      running ...
      main[1]
      Breakpoint hit: test11.<init> (test11:14)
      main[1] this
      String names1[] names1 = 0x1046c80 Object[2] = { 0, 1 } <<<< GOOD
      [Internal debugger error: Invalid array type: '[']
      [Internal debugger error: Invalid array type: '[']
      [Internal debugger error: Invalid array type: '[']
      String names2[][] names2 = 0x1046ca8 unknown type [2] = { null, null }
      <<< BAD
      main[1]

      5. SUGGESTED FIX

      In RemoteArray.java, method getElementType(), add the following case:

          case '[' :
            return TC_ARRAY;

      With this modified file, the session log becomes:

      jdb test11
      Initializing jdb...
      0x1045530:class(test11)
      > stop at test11:14
      Breakpoint set at test11:14
      > run
      run test11

      Breakpoint hit: running ...
      test11.<init> (test11:14)
      main[1] main[1] this
      String names1[] names1 = 0x1046c68 Object[2] = { 0, 1 }
      String names2[][] names2 = 0x1046c90 array[2] = { null, null } <<
      BETTER BUT STILL INCORRECT
      main[1]

      The result is better (the 2 dimensionnal array is recognized) but the
      values are still wrong.


        Attachments

          Activity

            People

            • Assignee:
              busersunw Btplusnull User (Inactive)
              Reporter:
              bhagen Benjamin Hagen (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: