7145358: SA throws ClassCastException for partially loaded ConstantPool

In printValueOn() in ConstantPool.java check if the poolHolder is a valid Klass and only then print it.

Reviewed-by: sla, sspitsyn
This commit is contained in:
Krystal Mok 2012-02-20 21:27:56 -08:00 committed by Poonam Bajaj
parent d856a7745c
commit 41f7f6302b

View File

@ -648,7 +648,12 @@ public class ConstantPool extends Oop implements ClassConstants {
}
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() {