mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
fix NullPointerException in PidUtils. #1611
This commit is contained in:
@@ -13,16 +13,16 @@ public class PidUtils {
|
||||
|
||||
static {
|
||||
// https://stackoverflow.com/a/7690178
|
||||
String jvmName = ManagementFactory.getRuntimeMXBean().getName();
|
||||
int index = jvmName.indexOf('@');
|
||||
try {
|
||||
String jvmName = ManagementFactory.getRuntimeMXBean().getName();
|
||||
int index = jvmName.indexOf('@');
|
||||
|
||||
if (index > 0) {
|
||||
try {
|
||||
if (index > 0) {
|
||||
PID = Long.toString(Long.parseLong(jvmName.substring(0, index)));
|
||||
pid = Long.parseLong(PID);
|
||||
} catch (Throwable e) {
|
||||
// ignore
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user