8280743: HSDB "Monitor Cache Dump" command might throw NPE

Reviewed-by: kevinw, sspitsyn
This commit is contained in:
Chris Plummer 2023-08-23 19:12:35 +00:00
parent 9435cd1916
commit 2c60cadfde

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,8 +67,12 @@ public class MonitorCacheDumpPanel extends JPanel {
tty.println();
tty.println(" _header: 0x" + Long.toHexString(mon.header().value()));
OopHandle obj = mon.object();
Oop oop = heap.newOop(obj);
tty.println(" _object: " + obj + ", a " + oop.getKlass().getName().asString());
if (obj == null) {
tty.println(" _object: null");
} else {
Oop oop = heap.newOop(obj);
tty.println(" _object: " + obj + ", a " + oop.getKlass().getName().asString());
}
Address owner = mon.owner();
tty.println(" _owner: " + owner);
if (!raw && owner != null) {