--- a/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java Thu Oct 17 20:27:44 2019 +0100
+++ b/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java Thu Oct 17 20:53:35 2019 +0100
@@ -79,15 +79,10 @@
private static boolean check(VirtualMachineDescriptor vmd, String excludeClass, String partialMatch) {
- String mainClass = null;
+ // Try to get the main class name using (platform specific) ProcessHelper
+ String mainClass = ProcessHelper.getMainClass(vmd.id());
- // Get the main class name using platform specific helper
- ProcessHelper helper = ProcessHelper.platformProcessHelper();
- if (helper != null) {
- mainClass = helper.getMainClass(vmd.id());
- }
-
- // If the main class name is still unset then retrieve it with the attach mechanism
+ // If the main class name could not be retrieved by ProcessHelper, get it with the attach mechanism
if (mainClass == null) {
try {
VmIdentifier vmId = new VmIdentifier(vmd.id());
@@ -145,18 +140,14 @@
return vids;
}
- public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors(Class<?> excludeClass) {
+ public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors() {
if (singlePid != null) {
return getSingleVMD(singlePid);
} else {
- return getVMDs(excludeClass, matchClass);
+ return getVMDs(null, matchClass);
}
}
- public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors() {
- return this.getVirtualMachineDescriptors(null);
- }
-
public Collection<String> getVirtualMachinePids(Class<?> excludeClass) {
if (singlePid != null) {
// There is a bug in AttachProvider, when VM is debuggee-suspended it's not listed by the AttachProvider.
@@ -167,7 +158,4 @@
}
}
- public Collection<String> getVirtualMachinePids() {
- return this.getVirtualMachinePids(null);
- }
}