7145358: SA throws ClassCastException for partially loaded ConstantPool
authorpoonam
Mon, 20 Feb 2012 21:27:56 -0800
changeset 11882 cb4e9c768c67
parent 11881 9642744ae9a5
child 11883 2c3ad1773a76
child 11953 d06edd28ba62
7145358: SA throws ClassCastException for partially loaded ConstantPool Summary: In printValueOn() in ConstantPool.java check if the poolHolder is a valid Klass and only then print it. Reviewed-by: sla, sspitsyn Contributed-by: Krystal Mok <sajia@taobao.com>
hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Sun Feb 19 13:11:39 2012 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Mon Feb 20 21:27:56 2012 -0800
@@ -648,7 +648,12 @@
   }
 
   public void printValueOn(PrintStream tty) {
-    tty.print("ConstantPool for " + getPoolHolder().getName().asString());
+    Oop holder = poolHolder.getValue(this);
+    if (holder instanceof Klass) {
+      tty.print("ConstantPool for " + ((Klass)holder).getName().asString());
+    } else {
+      tty.print("ConstantPool for partially loaded class");
+    }
   }
 
   public long getObjectSize() {