mirror of
https://github.com/alibaba/arthas.git
synced 2026-10-21 04:27:37 +00:00
fix thread command NullPointerException. #2875
This commit is contained in:
@@ -212,8 +212,10 @@ public class ThreadCommand extends AnnotatedCommand {
|
||||
List<BusyThreadInfo> busyThreadInfos = new ArrayList<BusyThreadInfo>(topNThreads.size());
|
||||
for (ThreadVO thread : topNThreads) {
|
||||
ThreadInfo threadInfo = findThreadInfoById(threadInfos, thread.getId());
|
||||
BusyThreadInfo busyThread = new BusyThreadInfo(thread, threadInfo);
|
||||
busyThreadInfos.add(busyThread);
|
||||
if (threadInfo != null) {
|
||||
BusyThreadInfo busyThread = new BusyThreadInfo(thread, threadInfo);
|
||||
busyThreadInfos.add(busyThread);
|
||||
}
|
||||
}
|
||||
process.appendResult(new ThreadModel(busyThreadInfos));
|
||||
return ExitStatus.success();
|
||||
|
||||
@@ -266,6 +266,9 @@ abstract public class ThreadUtil {
|
||||
}
|
||||
|
||||
public static String getFullStacktrace(BusyThreadInfo threadInfo, int lockIdentityHashCode, int blockingThreadCount) {
|
||||
if (threadInfo == null) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("\"" + threadInfo.getName() + "\"");
|
||||
if (threadInfo.getId() > 0) {
|
||||
sb.append(" Id=").append(threadInfo.getId());
|
||||
|
||||
Reference in New Issue
Block a user