JDK-6476643 : JHAT - Missing array class mishandled
  • Type: Bug
  • Component: core-svc
  • Sub-Component: tools
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-09-29
  • Updated: 2011-02-16
  • Resolved: 2007-02-13
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
jdk-6-rc-src-b100-jrl-27_sep_2006

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
In JavaObjectArray.resolve, there is code to attempt to handle the case where the class object for the class of the array cannot be found.

        if (clazz == null) {
	    clazz = snapshot.getOtherArrayType();
        }

However, this does not work because fiels clazz is never null - it contains a Number which is the id of the class object we are looking for. JHAT then crashes when it tries to cast the Number to a JavaClass.


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
The followint change seems to work:
original:
    public void resolve(Snapshot snapshot) {
        long classID = getIdValue((Number)clazz);
        if (snapshot.isNewStyleArrayClass()) {
replacement:
    public void resolve(Snapshot snapshot) {
        long classID = getIdValue((Number)clazz);
        clazz=null;  // add this line
        if (snapshot.isNewStyleArrayClass()) {

Comments
EVALUATION This bug has been fixed as part of fix for 6467192 [jhat fails with java.lang.ClassCastException on file created by jmap from core file]. Since, this has been fixed already, I'm marking it as "duplicate".
13-02-2007