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

JDI: ArrayReference.getValues() throws undeclared IndexOutOfBoundsException

    • beta2
    • generic
    • generic
    • Verified



      Name: elR10090 Date: 04/11/2001



      Java HotSpot Server and Client VMs (build 1.4.0-beta-b59, build 1.3.1-rc1-b21)
      fail to pass the test

          nsk/jdi/ArrayReference/getValues/getvalues002
          
      This failure was observed on all platforms and in all modes.
          
      The test checks if ArrayReference.getValues() method returns all
      of the components in this array.

      Debuggee (getvalues002a file) declares 13 fields with empty arrays of
      values of primitive types:

          static boolean z1[] = {};
          static byte b1[] = {};
          static char c1[] = {};
          static double d1[] = {};
          static float f1[] = {};
          static int i1[] = {};
          static long l1[] = {};
          static short r1[] = {};

          static final long lF1[] = {};
          static private long lP1[] = {};
          static public long lU1[] = {};
          static protected long lR1[] = {};
          static transient long lT1[] = {};
          static volatile long lV1[] = {};
          
      Debugger (getvalues002 file) finds each field by name, gets its value and
      casts the value to ArrayReference type. Then debugger tries to invoke the
      method getValues(), but IndexOutOfBoundsException is always thrown.

      The specification of method ArrayReference.getValues() says nothing about
      throwing IndexOutOfBoundsException even if array in debuggee is empty:

          public List getValues()
          Returns all of the components in this array.
          Returns: a list of Value objects, one for each array component ordered by
                   array index.
          Throws: ObjectCollectedException - if this object has been garbage
                  collected.
                  
      Since the method getValues() returns List with N (N > 0) elements for array that consists
      of N components in debuggee, I guess getValues() should return empty list for empty
      array instead of throwing IndexOutOfBoundsException
                  
      See log:

      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b59)
      Java HotSpot(TM) Server VM (build 1.4.0-beta-b59, mixed mode)

      binder> Listening for a pipe connection to port: 7000
      binder> Binding to pipe socket
      binder> Listening to pipe server socket
      binder> VirtualMachineManager: version 1.4
      binder> FindingConnector: default
      binder> LaunchingConnector:
      binder> name: com.sun.jdi.CommandLineLaunch
      binder> description: Launches target using Sun Java VM command line and attaches to
      it
      binder> transport: dt_socket
      binder> Connector arguments:
      binder> home=/export/ld59/java/dest_old/jdk1.4.0beta-b59/solx86/jre
      binder> vmexec=java
      binder> options= -classpath
      ".:share/classes:/export/ld59/java/dest/jdk1.4.0beta-b59/solx86/lib/tools.jar"
      binder> main=nsk.jdi.ArrayReference.getValues.getvalues002a -verbose "-verbose"
      binder> quote="
      binder> suspend=true
      binder> Launch debugee
      test.pipe> Waiting for pipe connection
      debugee.err> debugee.pipe> Making pipe connection to socket: localhost:7000
      debugee.err> DEBUGEE> debugee started.
      debuger> debugee's "ready" signal recieved.
      debuger> Total fields in debugee read: 14 total fields in debuger: 14

      debuger> 0 field nsk.jdi.ArrayReference.getValues.ClassToCheck.z1 read.
      debuger> 0 field value is instance of boolean[0] (id=122)
      # ERROR: debuger FAILURE 4> Cannot get values from field z1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 0 field checked.

      debuger> 1 field nsk.jdi.ArrayReference.getValues.ClassToCheck.b1 read.
      debuger> 1 field value is instance of byte[0] (id=124)
      # ERROR: debuger FAILURE 4> Cannot get values from field b1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 1 field checked.

      debuger> 2 field nsk.jdi.ArrayReference.getValues.ClassToCheck.c1 read.
      debuger> 2 field value is instance of char[0] (id=126)
      # ERROR: debuger FAILURE 4> Cannot get values from field c1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 2 field checked.

      debuger> 3 field nsk.jdi.ArrayReference.getValues.ClassToCheck.d1 read.
      debuger> 3 field value is instance of double[0] (id=128)
      # ERROR: debuger FAILURE 4> Cannot get values from field d1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 3 field checked.

      debuger> 4 field nsk.jdi.ArrayReference.getValues.ClassToCheck.f1 read.
      debuger> 4 field value is instance of float[0] (id=130)
      # ERROR: debuger FAILURE 4> Cannot get values from field f1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 4 field checked.

      debuger> 5 field nsk.jdi.ArrayReference.getValues.ClassToCheck.i1 read.
      debuger> 5 field value is instance of int[0] (id=132)
      # ERROR: debuger FAILURE 4> Cannot get values from field i1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 5 field checked.

      debuger> 6 field nsk.jdi.ArrayReference.getValues.ClassToCheck.l1 read.
      debuger> 6 field value is instance of long[0] (id=134)
      # ERROR: debuger FAILURE 4> Cannot get values from field l1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 6 field checked.

      debuger> 7 field nsk.jdi.ArrayReference.getValues.ClassToCheck.r1 read.
      debuger> 7 field value is instance of short[0] (id=136)
      # ERROR: debuger FAILURE 4> Cannot get values from field r1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 7 field checked.

      debuger> 8 field nsk.jdi.ArrayReference.getValues.ClassToCheck.lF1 read.
      debuger> 8 field value is instance of long[0] (id=138)
      # ERROR: debuger FAILURE 4> Cannot get values from field lF1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 8 field checked.

      debuger> 9 field nsk.jdi.ArrayReference.getValues.ClassToCheck.lP1 read.
      debuger> 9 field value is instance of long[0] (id=139)
      # ERROR: debuger FAILURE 4> Cannot get values from field lP1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 9 field checked.

      debuger> 10 field nsk.jdi.ArrayReference.getValues.ClassToCheck.lU1 read.
      debuger> 10 field value is instance of long[0] (id=140)
      # ERROR: debuger FAILURE 4> Cannot get values from field lU1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 10 field checked.

      debuger> 11 field nsk.jdi.ArrayReference.getValues.ClassToCheck.lR1 read.
      debuger> 11 field value is instance of long[0] (id=141)
      # ERROR: debuger FAILURE 4> Cannot get values from field lR1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 11 field checked.

      debuger> 12 field nsk.jdi.ArrayReference.getValues.ClassToCheck.lT1 read.
      debuger> 12 field value is instance of long[0] (id=142)
      # ERROR: debuger FAILURE 4> Cannot get values from field lT1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 12 field checked.

      debuger> 13 field nsk.jdi.ArrayReference.getValues.ClassToCheck.lV1 read.
      debuger> 13 field value is instance of long[0] (id=143)
      # ERROR: debuger FAILURE 4> Cannot get values from field lV1
      # ERROR: debuger FAILURE 4> Exception: java.lang.IndexOutOfBoundsException: Invalid
      array index: 0
      debuger> 13 field checked.

      debugee.err> DEBUGEE> "quit" signal recieved.
      debugee.err> DEBUGEE> completed succesfully.
      # ERROR: debuger FAILURE> TEST FAILED
      test.pipe> Closing pipe socket
      binder> Closing pipe server socket

      The test will appear in the release r04 of testbase_nsk located at:

          /net/sqesvr.eng/export/vsn/VM/testbase/testbase_nsk.v14

      To reproduce the failure, please use 'doit.sh' script found
      in the directory:

          /net/sqesvr.eng/export/vsn/GammaBase/Bugs/<this bug number>

      Use:
          doit.sh $JAVA_HOME
          
      ======================================================================

            rfield Robert Field (Inactive)
            latkinsunw Latkin Latkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: