JDK-6547811 : JDWP: ReferringObjects and Instances commands return unexpected error
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2007-04-19
  • Updated: 2012-03-22
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u4Fixed 7 b17Fixed
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 ] ###@###.###
19-04-2007

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 .
19-04-2007