United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6547811 JDWP: ReferringObjects and Instances commands return unexpected error
JDK-6547811 : JDWP: ReferringObjects and Instances commands return unexpected error

Details
Type:
Bug
Submit Date:
2007-04-19
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
core-svc
OS:
generic
Sub-Component:
debugger
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
Filed By       : JCK team
JDK            : java full version "1.6.0-fcs"
JCK            : 6a
Platform[s]    : all
switch/Mode    : default
JCK test owner : http://javaweb.sfbay/jcce/tcks/jck/docs/others/owners.jto
Failed tests:
  vm/jdwp/ObjectReference/ReferringObjects/referringobjects004/referringobjects004.html
  vm/jdwp/ReferenceType/Instances/instances004/instances004.html

Problem description
===================
The JDWP 6.0 specification for ObjectReference.ReferringObjects and ReferenceType.Instances commands at:
  http://javaweb.sfbay/java/re/jdk/6.0/latest/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ObjectReference_ReferringObjects
  http://javaweb.sfbay/java/re/jdk/6.0/latest/docs/platform/jpda/jdwp/jdwp-protocol.html#JDWP_ReferenceType_Instances
states as follows:
  ---Excerpt-from-spec-for-ObjectReference.ReferringObjects---
  Error Data
  ...
  INVALID_OBJECT    object is not a known ID
  ---End-of-excerpt---
and
  ---Excerpt-from-spec-for-ReferenceType.Instances---
  Error Data
  ...
  INVALID_OBJECT    refType is not a known ID
  ---End-of-excerpt---

However, if command packet which has been sent to debuggee contains unknown objectID/refType (e.g. 0 - null object) 
then returned reply packet contains unexpected ILLEGAL_ARGUMENT error code in packet header instead of
INVALID_OBJECT error code. According to JDWP specification the ILLEGAL_ARGUMENT error code is returned only when:
  ---Excerpt-from-spec-for-ObjectReference.ReferringObjects---
  ILLEGAL_ARGUMENT    maxReferrers is less than zero.
  ---End-of-excerpt---
and
  ---Excerpt-from-spec-for-ReferenceType.Instances---
  ILLEGAL_ARGUMENT    maxInstances is less than zero.
  ---End-of-excerpt---

The following new JCK 6a tests fail due to this issue:
  vm/jdwp/ObjectReference/ReferringObjects/referringobjects004/referringobjects004.html
  vm/jdwp/ReferenceType/Instances/instances004/instances004.html

Please see attached .jtr files for more details.

                                    

Comments
SUGGESTED FIX

classInstances and objectReferrers should return INVALID_OBJECT instead of 
ILLEGAL_ARGUMENT if the passed in ObjectID is NULL.

*** (#1 of 1): [ UNSAVED ] ###@###.###
                                     
2007-04-19
EVALUATION

- In inStream.c, read_ObjectRef just returns NULL if the object ref is NULL.
- This NULL is then passed to functions in util.c (classInstances, objectReferrers)
  which causes them to return ILLEGAL_ARGUMENT .
                                     
2007-04-19



Hardware and Software, Engineered to Work Together