Skip to content

Commit 4939eff

Browse files
committed
Better handle cornercases in Overview - JVM & Java Home
1 parent 44e2c5c commit 4939eff

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

visualvm/applicationviews/src/org/graalvm/visualvm/application/views/overview/ApplicationOverviewModel.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -211,9 +211,22 @@ private void initialize(Application application) {
211211
mainArgs = jvm.getMainArgs();
212212
if (mainArgs == null) mainArgs = NbBundle.getMessage(ApplicationOverviewModel.class, "LBL_none"); // NOI18N
213213

214-
vmId = jvm.getVmName() + " (" + jvm.getVmVersion() + ", " + jvm.getVmInfo() + ")"; // NOI18N
214+
String vmVersion = jvm.getVmVersion();
215+
String vmInfo = jvm.getVmInfo();
216+
String vmName = jvm.getVmName();
217+
218+
String vmDetails = null;
219+
if (vmVersion != null && vmInfo != null) vmDetails = vmVersion + ", " + vmInfo; // NOI18N
220+
else if (vmVersion != null) vmDetails = vmVersion;
221+
else if (vmInfo != null) vmDetails = vmInfo;
222+
if (vmName == null || "".equals(vmName)) vmName = NbBundle.getMessage(ApplicationOverviewModel.class, "LBL_unknown"); // NOI18N
223+
224+
vmId = vmName;
225+
if (vmDetails != null) vmId += " (" + vmDetails + ")"; // NOI18N
215226

216227
javaHome = jvm.getJavaHome();
228+
if (javaHome == null || "".equals(javaHome)) javaHome = NbBundle.getMessage(ApplicationOverviewModel.class, "LBL_unknown"); // NOI18N
229+
217230
javaVersion = jvm.getJavaVersion();
218231
javaVendor = jvm.getVmVendor();
219232

0 commit comments

Comments
 (0)