|  | 
| 1 | 1 | /* | 
| 2 |  | - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. | 
|  | 2 | + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. | 
| 3 | 3 |  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 
| 4 | 4 |  * | 
| 5 | 5 |  * This code is free software; you can redistribute it and/or modify it | 
|  | 
| 34 | 34 | import static java.lang.management.ManagementFactory.*; | 
| 35 | 35 | import java.lang.ref.WeakReference; | 
| 36 | 36 | import java.lang.reflect.*; | 
|  | 37 | +import java.net.URI; | 
| 37 | 38 | import java.rmi.*; | 
| 38 | 39 | import java.rmi.registry.*; | 
| 39 | 40 | import java.rmi.server.*; | 
| @@ -133,7 +134,24 @@ private ProxyClient(String url, | 
| 133 | 134 |         this.advancedUrl = url; | 
| 134 | 135 |         this.connectionName = getConnectionName(url, userName); | 
| 135 | 136 |         this.displayName = connectionName; | 
| 136 |  | -        setParameters(new JMXServiceURL(url), userName, password); | 
|  | 137 | +        JMXServiceURL jmxServiceURL = new JMXServiceURL(url); | 
|  | 138 | +        setParameters(jmxServiceURL, userName, password); | 
|  | 139 | +        if ("rmi".equals(jmxServiceURL.getProtocol())) { | 
|  | 140 | +            String path = jmxServiceURL.getURLPath(); | 
|  | 141 | +            if (path.startsWith("/jndi/")) { | 
|  | 142 | +                int end = path.indexOf(';'); | 
|  | 143 | +                if (end < 0) end = path.length(); | 
|  | 144 | +                String registryURIStr = path.substring(6, end); | 
|  | 145 | +                URI registryURI = URI.create(registryURIStr); | 
|  | 146 | +                if ("rmi".equals(registryURI.getScheme()) | 
|  | 147 | +                        && "/jmxrmi".equals(registryURI.getPath())) { | 
|  | 148 | +                    this.registryHostName = registryURI.getHost(); | 
|  | 149 | +                    this.registryPort = registryURI.getPort(); | 
|  | 150 | +                    this.vmConnector = true; | 
|  | 151 | +                    checkSslConfig(); | 
|  | 152 | +                } | 
|  | 153 | +            } | 
|  | 154 | +        } | 
| 137 | 155 |     } | 
| 138 | 156 | 
 | 
| 139 | 157 |     private ProxyClient(LocalVirtualMachine lvm) throws IOException { | 
|  | 
0 commit comments