8006078: [findbugs] java.lang.management.ThreadInfo returns mutable objects

Cloned the array before returning to caller.

Reviewed-by: dholmes, fparain
This commit is contained in:
Amit Sapre 2016-11-03 12:04:40 +05:30 committed by Vyom Tewari
parent ff33d165a6
commit e935e7cb1e

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, 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
@ -554,7 +554,7 @@ public class ThreadInfo {
* @return an array of {@code StackTraceElement} objects of the thread.
*/
public StackTraceElement[] getStackTrace() {
return stackTrace;
return stackTrace.clone();
}
/**
@ -868,7 +868,7 @@ public class ThreadInfo {
* @since 1.6
*/
public MonitorInfo[] getLockedMonitors() {
return lockedMonitors;
return lockedMonitors.clone();
}
/**
@ -885,7 +885,7 @@ public class ThreadInfo {
* @since 1.6
*/
public LockInfo[] getLockedSynchronizers() {
return lockedSynchronizers;
return lockedSynchronizers.clone();
}
private static final StackTraceElement[] NO_STACK_TRACE =