8340276: Test java/lang/management/ThreadMXBean/Locks.java failed with NullPointerException

Reviewed-by: cjplummer, lmesnik
This commit is contained in:
Kevin Walls 2024-09-19 08:28:51 +00:00
parent 67198992ce
commit c58fbef05e

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, 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
@ -422,6 +422,9 @@ public class Locks {
lock + " expected to have owner");
}
for (ThreadInfo info1 : infos) {
if (info1 == null) {
continue; // Missing thread, e.g. completed. Ignore.
}
if (info1.getThreadId() == threadId) {
ownerInfo = info1;
break;