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) {
|
if (heap instanceof GenCollectedHeap) {
|
||||||
GenCollectedHeap genheap = (GenCollectedHeap) heap;
|
GenCollectedHeap genheap = (GenCollectedHeap) heap;
|
||||||
if (genheap.isIn(a)) {
|
if (genheap.isIn(a)) {
|
||||||
|
loc.heap = heap;
|
||||||
for (int i = 0; i < genheap.nGens(); i++) {
|
for (int i = 0; i < genheap.nGens(); i++) {
|
||||||
Generation g = genheap.getGen(i);
|
Generation g = genheap.getGen(i);
|
||||||
if (g.isIn(a)) {
|
if (g.isIn(a)) {
|
||||||
|
@ -107,22 +107,21 @@ public class PointerLocation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInHeap() {
|
public boolean isInHeap() {
|
||||||
return (heap != null || (gen != null));
|
return (heap != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInNewGen() {
|
public boolean isInNewGen() {
|
||||||
return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(0)));
|
return ((gen != null) && (gen.equals(((GenCollectedHeap)heap).getGen(0))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInOldGen() {
|
public boolean isInOldGen() {
|
||||||
return ((gen != null) && (gen == ((GenCollectedHeap)heap).getGen(1)));
|
return ((gen != null) && (gen.equals(((GenCollectedHeap)heap).getGen(1))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean inOtherGen() {
|
public boolean inOtherGen() {
|
||||||
return (!isInNewGen() && !isInOldGen());
|
return (!isInNewGen() && !isInOldGen());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Only valid if isInHeap() */
|
|
||||||
public Generation getGeneration() {
|
public Generation getGeneration() {
|
||||||
return gen;
|
return gen;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user