changeset 3556:38fd165da001

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>
author poonam
date Mon, 20 Feb 2012 21:27:56 -0800
parents 0368109684cb
children 1a4e5feb63c4 645162d94294
files agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Sun Feb 19 13:11:39 2012 +0100
+++ b/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() {