void check(ThreadReference thr) { // This calls each ThreadReference method that could fail due to the bug // that occurs if a resume is done while a call to the method is in process.
String kind = ""; if (thr != null) { try {
kind = "ownedMonitors()";
System.out.println("kind = " + kind); if (thr.ownedMonitors() == null) {
failure("failure: ownedMonitors = null");
}
kind = "currentContendedMonitor()";
System.out.println("kind = " + kind);
thr.currentContendedMonitor(); // no failure return value here; could cause an NPE
kind = "frames()";
System.out.println("kind = " + kind);
List<StackFrame> frames = thr.frames(); // no failure return value here; could cause an NPE
kind = "frames(0, size - 1)";
System.out.println("kind = " + kind); int nframes = frames.size(); while (nframes > 0) { try {
thr.frames(0, nframes - 1); break;
} catch (IndexOutOfBoundsException iobe) { // 6815126. let's try to get less frames
iobe.printStackTrace();
nframes--;
}
}
kind = "name()";
System.out.println("kind = " + kind); if (thr.name() == null) {
failure("failure: name = null");
}
kind = "status()";
System.out.println("kind = " + kind); if (thr.status() < 0) {
failure("failure: status < 0");
}
} catch (IncompatibleThreadStateException ee) { // ignore checks if thread was not suspended
} catch (ObjectCollectedException ee) { // ignore ownedMonitors failure
} catch (VMDisconnectedException ee) { // This is how we stop. The debuggee runs to completion // and we get this exception. throw ee;
} catch (Exception ee) {
failure("failure: Got exception from " + kind + ": " + ee );
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.