8281853: serviceability/sa/ClhsdbThreadContext.java failed with NullPointerException: Cannot invoke "sun.jvm.hotspot.gc.shared.GenCollectedHeap.getGen(int)" because "this.heap" is null
Reviewed-by: kevinw, sspitsyn
This commit is contained in:
parent
f9f439a19d
commit
2fef5d4a33
@ -87,6 +87,7 @@ public class PointerFinder {
|
||||
if (heap instanceof GenCollectedHeap) {
|
||||
GenCollectedHeap genheap = (GenCollectedHeap) heap;
|
||||
if (genheap.isIn(a)) {
|
||||
loc.heap = heap;
|
||||
for (int i = 0; i < genheap.nGens(); i++) {
|
||||
Generation g = genheap.getGen(i);
|
||||
if (g.isIn(a)) {
|
||||
|
@ -107,22 +107,21 @@ public class PointerLocation {
|
||||
}
|
||||
|
||||
public boolean isInHeap() {
|
||||
return (heap != null || (gen != null));
|
||||
return (heap != null);
|
||||
}
|
||||
|
||||
public boolean isInNewGen() {
|
||||
return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(0)));
|
||||
return ((gen != null) && (gen.equals(((GenCollectedHeap)heap).getGen(0))));
|
||||
}
|
||||
|
||||
public boolean isInOldGen() {
|
||||
return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(1)));
|
||||
return ((gen != null) && (gen.equals(((GenCollectedHeap)heap).getGen(1))));
|
||||
}
|
||||
|
||||
public boolean inOtherGen() {
|
||||
return (!isInNewGen() && !isInOldGen());
|
||||
}
|
||||
|
||||
/** Only valid if isInHeap() */
|
||||
public Generation getGeneration() {
|
||||
return gen;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user